Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: The problem of incorrect scrollbars in the content area when adjusting the window size in grid view #2278

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,9 @@ bool FileView::edit(const QModelIndex &index, QAbstractItemView::EditTrigger tri

void FileView::resizeEvent(QResizeEvent *event)
{
d->isResizeEvent = true;
DListView::resizeEvent(event);
d->isResizeEvent = false;

updateHorizontalOffset();

Expand Down Expand Up @@ -1456,14 +1458,16 @@ void FileView::updateGeometries()
#ifdef DTKWIDGET_CLASS_DSizeMode
iconVerticalTopMargin = DSizeModeHelper::element(kCompactIconVerticalTopMargin, kIconVerticalTopMargin);
#endif
resizeContents(contentsSize().width(), contentsSize().height() + iconVerticalTopMargin);
if (!d->isResizeEvent
|| (d->isResizeEvent && d->lastContentHeight > 0 && d->lastContentHeight != contentsSize().height()))
resizeContents(contentsSize().width(), contentsSize().height() + iconVerticalTopMargin);
d->lastContentHeight = contentsSize().height();
}
if (!d->headerView || !d->allowedAdjustColumnSize) {
return DListView::updateGeometries();
}

resizeContents(d->headerView->length(), contentsSize().height());

DListView::updateGeometries();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class FileViewPrivate
int horizontalOffset { 0 };
int cachedViewWidth { -1 };
bool isShowViewSelectBox { false };
bool isResizeEvent { false };
int lastContentHeight { 0 };

QList<QUrl> preSelectionUrls;
QTimer *preSelectTimer { nullptr };
Expand Down
Loading