Skip to content

Commit

Permalink
feat: anyway try to enable dxcb for QMenu and QTipLabel
Browse files Browse the repository at this point in the history
Change-Id: Idf3576c59ed1700ec8f7e6af50555e74508b9661
  • Loading branch information
zccrs committed Aug 3, 2018
1 parent b7b949a commit 689e440
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions dstyleplugin/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<QMenu*>(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);
}
}
}

Expand Down

0 comments on commit 689e440

Please sign in to comment.