From 511d0150d8e03130d8233f257befda2cd33ea7e8 Mon Sep 17 00:00:00 2001 From: yeshanshan Date: Mon, 22 Jun 2026 13:19:54 +0800 Subject: [PATCH] fix: use platform check API for menu decoration in treeland MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Replace manual platform name checking with DTK API to detect Wayland platform 2. Fix menu decoration issue under treeland by using proper platform detection method 3. Include DGuiApplicationHelper header for the new API usage Log: Fixed menu decoration issue in treeland environment by using correct platform detection API Influence: 1. Test menu display in treeland environment 2. Verify menu decorations appear correctly 3. Test menu functionality in other window managers (dxcb, dwayland) 4. Verify no regression in normal X11 environment 5. Test context menus in various applications fix: 适配treeland下菜单无装饰器问题 1. 使用DTK API替换手动平台名称检查来检测Wayland平台 2. 通过正确的平台检测方法修复treeland下的菜单装饰问题 3. 添加DGuiApplicationHelper头文件以使用新的API Log: 修复treeland环境下菜单没有装饰器的问题 Influence: 1. 在treeland环境测试菜单显示 2. 验证菜单装饰器是否正确显示 3. 在其他窗口管理器(dxcb、dwayland)测试菜单功能 4. 验证在普通X11环境下没有回归问题 5. 测试各种应用程序中的上下文菜单 --- styleplugins/chameleon/chameleonstyle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/styleplugins/chameleon/chameleonstyle.cpp b/styleplugins/chameleon/chameleonstyle.cpp index 63b70621..1b0814bf 100644 --- a/styleplugins/chameleon/chameleonstyle.cpp +++ b/styleplugins/chameleon/chameleonstyle.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include @@ -4755,7 +4755,7 @@ void ChameleonStyle::polish(QWidget *w) view->setItemDelegate(new QStyledItemDelegate); } - if (DApplication::isDXcbPlatform() || (qApp->platformName() == "dwayland" || qApp->property("_d_isDwayland").toBool())) { + if (DApplication::isDXcbPlatform() || DGuiApplicationHelper::testAttribute(DGuiApplicationHelper::IsWaylandPlatform)) { bool is_menu = qobject_cast(w); bool is_tip = w->inherits("QTipLabel");