From 689e440bf160a0ed094f03eca9d307e1d1d0f63c Mon Sep 17 00:00:00 2001 From: zccrs Date: Fri, 3 Aug 2018 14:08:30 +0800 Subject: [PATCH] feat: anyway try to enable dxcb for QMenu and QTipLabel Change-Id: Idf3576c59ed1700ec8f7e6af50555e74508b9661 --- dstyleplugin/style.cpp | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/dstyleplugin/style.cpp b/dstyleplugin/style.cpp index a4fcddec..e2132557 100644 --- a/dstyleplugin/style.cpp +++ b/dstyleplugin/style.cpp @@ -180,31 +180,35 @@ void Style::polish(QWidget *w) w->setFont(font); } - if (DApplication::isDXcbPlatform() && (!w->windowHandle() || DPlatformWindowHandle::isEnabledDXcb(w))) { + if (DApplication::isDXcbPlatform()) { if (qobject_cast(w)) { DPlatformWindowHandle handle(w); - const QColor &color = m_palette->brush(PaletteExtended::Menu_BorderColor).color(); + if (DPlatformWindowHandle::isEnabledDXcb(w)) { + const QColor &color = m_palette->brush(PaletteExtended::Menu_BorderColor).color(); - if (color.isValid()) - handle.setBorderColor(color); + if (color.isValid()) + handle.setBorderColor(color); - handle.setShadowOffset(QPoint(0, 4)); - handle.setShadowRadius(15); - handle.setShadowColor(QColor(0, 0, 0, 100)); -#ifdef DTK_SUPPORT_BLUR_WINDOW - handle.setEnableBlurWindow(true); -#endif - handle.setTranslucentBackground(true); + handle.setShadowOffset(QPoint(0, 4)); + handle.setShadowRadius(15); + handle.setShadowColor(QColor(0, 0, 0, 100)); + #ifdef DTK_SUPPORT_BLUR_WINDOW + handle.setEnableBlurWindow(true); + #endif + handle.setTranslucentBackground(true); - w->setAttribute(Qt::WA_TranslucentBackground); + w->setAttribute(Qt::WA_TranslucentBackground); + } } else if (w->inherits("QTipLabel")) { DPlatformWindowHandle handle(w); - handle.setShadowOffset(QPoint(0, 2)); - handle.setShadowRadius(4); + if (DPlatformWindowHandle::isEnabledDXcb(w)) { + handle.setShadowOffset(QPoint(0, 2)); + handle.setShadowRadius(4); - w->setAttribute(Qt::WA_TranslucentBackground); + w->setAttribute(Qt::WA_TranslucentBackground); + } } }