Skip to content

Commit ee5bd70

Browse files
committed
fix: disable menu scroll indicator in application tray plugin
1. Removed scroll indicator functionality in QMenu submenus to prevent display issues 2. Added private Qt headers to access QMenuPrivate and disable scrolling 3. Adjusted window positioning logic for popup sub-windows Log: Disabled menu scroll indicator in application tray to fix display issues Influence: 1. Test application tray menu display without scroll indicators 2. Verify sub-menu opening behavior and positioning 3. Test popup window positioning for wayland integration 4. Verify menu size and layout correctness 5. Test on different screen resolutions and scaling factors fix: 禁止托盘菜单滚动指示器功能 1. 移除 QMenu 子菜单的滚动指示器功能,解决显示问题 2. 添加 Qt 私有头文件以访问 QMenuPrivate 并禁用滚动 3. 调整弹出子窗口的定位逻辑 Log: 禁用托盘菜单滚动指示器以修复显示问题 Influence: 1. 测试托盘菜单显示,确认无滚动指示器 2. 验证子菜单打开行为和定位 3. 测试 wayland 集成下的弹出窗口定位 4. 验证菜单尺寸和布局正确性 5. 在不同屏幕分辨率和缩放比例下测试 PMS: BUG-333243
1 parent bdcbe70 commit ee5bd70

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

plugins/application-tray/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ target_link_libraries(${PLUGIN_NAME}
7272
Qt${QT_VERSION_MAJOR}::Core
7373
Qt${QT_VERSION_MAJOR}::Gui
7474
Qt${QT_VERSION_MAJOR}::Widgets
75+
Qt${QT_VERSION_MAJOR}::CorePrivate
76+
Qt${QT_VERSION_MAJOR}::WidgetsPrivate
7577
Dtk${DTK_VERSION_MAJOR}::Core
7678
Dtk${DTK_VERSION_MAJOR}::Gui
7779
Dtk${DTK_VERSION_MAJOR}::Widget

plugins/application-tray/sniprotocolhandler.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include <QRunnable>
1818

1919
#include <DGuiApplicationHelper>
20+
#include <private/qobject_p.h>
21+
#include <private/qmenu_p.h>
2022

2123
DGUI_USE_NAMESPACE
2224

@@ -32,6 +34,12 @@ class DBusMenu : public DBusMenuImporter {
3234
{
3335
QObject::connect(this, &DBusMenuImporter::menuUpdated, this, [this] (QMenu *menu) {
3436
menu->setFixedSize(menu->sizeHint());
37+
// TODO 删除 QMenu 的滚动功能,修复首次子菜单显示滚动指示器问题
38+
if (auto dp = static_cast<QMenuPrivate*>(QObjectPrivate::get(menu))) {
39+
if (auto scroll = dp->scroll) {
40+
scroll->scrollFlags = QMenuPrivate::QMenuScroller::ScrollNone;
41+
}
42+
}
3543
}, Qt::QueuedConnection);
3644
}
3745
virtual QMenu *createMenu(QWidget *parent) override

0 commit comments

Comments
 (0)