From d4e0cd5d2109500ee24817928093512f3aa669f9 Mon Sep 17 00:00:00 2001 From: deepin-admin-bot Date: Tue, 13 Oct 2026 23:17:13 +0800 Subject: [PATCH] fix: recalc toolbar geometry on show and ready MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Root cause: resetBottomToolbarGeometry was commented out in showEvent, so toolbar width was not recomputed when the window became visible; slotOneImgReady updated menu content but also never triggered a toolbar re-layout, leaving thumbnails and prev/next buttons missing after async image load 2. Fix: restore resetBottomToolbarGeometry in showEvent and add the same call in slotOneImgReady so geometry is recomputed both on window show and on image-ready, covering both trigger paths 3. Impact: prev/next buttons and thumbnails now appear consistently when opening images; add temporary qInfo diagnostics tagged [BUG-376715] for FlemingX verification, removable after confirm Log: Fix missing prev/next buttons and thumbnails when opening images Influence: 1. Open images via double-click and drag-and-drop, verify toolbar buttons and thumbnails appear consistently 2. Repeat open/close 50+ times under high system load 3. Verify diagnostic logs output expected values on FlemingX fix: 显示与图片就绪时重算工具栏几何 1. 根因:showEvent 中 resetBottomToolbarGeometry 被注释,窗口显示时 未重算工具栏宽度;slotOneImgReady 仅更新菜单内容未触发工具栏 重布局,异步图片加载后缩略图与上一张/下一张按钮偶现缺失 2. 方案:恢复 showEvent 中的 resetBottomToolbarGeometry 调用,并在 slotOneImgReady 中补充同一调用,覆盖窗口显示与图片就绪两条触发路径 3. 影响:打开图片时上一张/下一张按钮与缩略图稳定显示;新增带 [BUG-376715] 标记的临时 qInfo 诊断日志供 FlemingX 验证,确认后可移除 Log: 修复打开图片时上一张/下一张按钮与缩略图偶现缺失 Influence: 1. 双击与拖拽方式打开图片,验证工具栏按钮与缩略图稳定显示 2. 高负载下重复打开关闭 50 次以上 3. 在 FlemingX 环境验证诊断日志输出符合预期 Bug: #376715 --- commit-msg.txt | 40 +++++++++++++++++++ .../viewpanel/contents/bottomtoolbar.cpp | 2 + libimageviewer/viewpanel/viewpanel.cpp | 11 ++++- 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 commit-msg.txt diff --git a/commit-msg.txt b/commit-msg.txt new file mode 100644 index 00000000..421afd60 --- /dev/null +++ b/commit-msg.txt @@ -0,0 +1,40 @@ +fix: recalc toolbar geometry on show and ready + +1. Root cause: resetBottomToolbarGeometry was commented out in + showEvent, so toolbar width was not recomputed when the window + became visible; slotOneImgReady updated menu content but also + never triggered a toolbar re-layout, leaving thumbnails and + prev/next buttons missing after async image load +2. Fix: restore resetBottomToolbarGeometry in showEvent and add + the same call in slotOneImgReady so geometry is recomputed both + on window show and on image-ready, covering both trigger paths +3. Impact: prev/next buttons and thumbnails now appear consistently + when opening images; add temporary qInfo diagnostics tagged + [BUG-376715] for FlemingX verification, removable after confirm + +Log: Fix missing prev/next buttons and thumbnails when opening images + +Influence: +1. Open images via double-click and drag-and-drop, verify toolbar + buttons and thumbnails appear consistently +2. Repeat open/close 50+ times under high system load +3. Verify diagnostic logs output expected values on FlemingX + +fix: 显示与图片就绪时重算工具栏几何 + +1. 根因:showEvent 中 resetBottomToolbarGeometry 被注释,窗口显示时 + 未重算工具栏宽度;slotOneImgReady 仅更新菜单内容未触发工具栏 + 重布局,异步图片加载后缩略图与上一张/下一张按钮偶现缺失 +2. 方案:恢复 showEvent 中的 resetBottomToolbarGeometry 调用,并在 + slotOneImgReady 中补充同一调用,覆盖窗口显示与图片就绪两条触发路径 +3. 影响:打开图片时上一张/下一张按钮与缩略图稳定显示;新增带 + [BUG-376715] 标记的临时 qInfo 诊断日志供 FlemingX 验证,确认后可移除 + +Log: 修复打开图片时上一张/下一张按钮与缩略图偶现缺失 + +Influence: +1. 双击与拖拽方式打开图片,验证工具栏按钮与缩略图稳定显示 +2. 高负载下重复打开关闭 50 次以上 +3. 在 FlemingX 环境验证诊断日志输出符合预期 + +PMS: BUG-376715 diff --git a/libimageviewer/viewpanel/contents/bottomtoolbar.cpp b/libimageviewer/viewpanel/contents/bottomtoolbar.cpp index 5bdd9bb8..c0414f18 100644 --- a/libimageviewer/viewpanel/contents/bottomtoolbar.cpp +++ b/libimageviewer/viewpanel/contents/bottomtoolbar.cpp @@ -644,6 +644,7 @@ void LibBottomToolbar::setAllFile(QString path, QStringList paths) { //每次打开清空一下缩略图 qDebug() << "Setting all files, count:" << paths.size() << "current path:" << path; + qInfo() << "[BUG-376715] setAllFile paths.size:" << paths.size(); m_imgListWidget->clearListView(); if (paths.size() <= 1) { qDebug() << "Single image mode, hiding navigation controls"; @@ -927,5 +928,6 @@ int LibBottomToolbar::estimatedDisplayCount() Q_EMIT displayItemGrowUp(m_estimateDisplayCount); } + qInfo() << "[BUG-376715] estimatedDisplayCount imgListWidget.width:" << m_imgListWidget->width() << "curCount:" << curCount; return curCount; } diff --git a/libimageviewer/viewpanel/viewpanel.cpp b/libimageviewer/viewpanel/viewpanel.cpp index 3de5aa35..47672c12 100644 --- a/libimageviewer/viewpanel/viewpanel.cpp +++ b/libimageviewer/viewpanel/viewpanel.cpp @@ -921,6 +921,7 @@ void LibViewPanel::setWallpaper(const QString &imgPath) bool LibViewPanel::startdragImage(const QStringList &paths, const QString &firstPath) { qInfo() << "Starting drag image operation with" << paths.size() << "images"; + qInfo() << "[BUG-376715] startdragImage paths.size:" << paths.size(); // 若为 MTP 挂载文件,转换为目录加载 QStringList realPaths = paths; QString realPath = firstPath; @@ -965,6 +966,7 @@ bool LibViewPanel::startdragImage(const QStringList &paths, const QString &first QString DirPath = image_list.first().left(image_list.first().lastIndexOf("/")); QDir _dirinit(DirPath); QFileInfoList m_AllPath = _dirinit.entryInfoList(QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot); + qInfo() << "[BUG-376715] startdragImage entryInfoList count:" << m_AllPath.size(); //修复Qt带后缀排序错误的问题 std::sort(m_AllPath.begin(), m_AllPath.end(), compareByFileInfo); @@ -998,6 +1000,7 @@ bool LibViewPanel::startdragImage(const QStringList &paths, const QString &first //stack设置正确位置 m_stack->setCurrentWidget(m_view); //展示当前图片 + qInfo() << "[BUG-376715] startdragImage final image_list.size:" << image_list.size(); loadImage(loadingPath, image_list); LibCommonService::instance()->m_listAllPath = image_list; @@ -1995,10 +1998,14 @@ void LibViewPanel::onMenuItemClicked(QAction *action) void LibViewPanel::slotOneImgReady(QString path, imageViewerSpace::ItemInfo itemInfo) { + qInfo() << "[BUG-376715] slotOneImgReady path:" << path; imageViewerSpace::ItemInfo ItemInfo = m_bottomToolbar->getCurrentItemInfo(); if (path.contains(ItemInfo.path)) { updateMenuContent(); } + //图片就绪后重算底部工具栏几何,覆盖缩略图内容不显示的独立根因 + resetBottomToolbarGeometry(m_stack->currentWidget() == m_view); + qInfo() << "[BUG-376715] slotOneImgReady re-layout triggered, currentWidget is view:" << (m_stack->currentWidget() == m_view); Q_UNUSED(itemInfo); } @@ -2040,6 +2047,7 @@ void LibViewPanel::resetBottomToolbarGeometry(bool visible) } if (visible) { int width = qMin(m_bottomToolbar->getToolbarWidth() + 22, (this->width() - RT_SPACING)); + qInfo() << "[BUG-376715] resetBottomToolbarGeometry visible:" << visible << "this->width():" << this->width() << "this->height():" << this->height() << "toolbarWidth:" << width; int x = (this->width() - width) / 2; //窗口高度-工具栏高度-工具栏到底部距离 //全屏默认隐藏 @@ -2196,12 +2204,13 @@ void LibViewPanel::resizeEvent(QResizeEvent *e) void LibViewPanel::showEvent(QShowEvent *e) { + qInfo() << "[BUG-376715] showEvent enter this->width():" << this->width(); if (this->m_topToolbar) { m_topToolbar->resize(width(), titleBarHeight()); } //显示的时候需要判断一次滑动 noAnimationBottomMove(); -// resetBottomToolbarGeometry(m_stack->currentWidget() == m_view); + resetBottomToolbarGeometry(m_stack->currentWidget() == m_view); QFrame::showEvent(e); }