diff --git lib/utils/qtprops.h lib/utils/qtprops.h
index 6589c779..2c52fdef 100644
@@ -34,6 +34,7 @@ struct _QtcQWidgetProps {
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
@@ -45,6 +46,7 @@ struct _QtcQWidgetProps {
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+ bool ensuringPolish: 1;
bool prePolishStarted: 1;
diff --git qt5/style/argbhelper.cpp qt5/style/argbhelper.cpp
index ccf17777..42838e54 100644
--- qt5/style/argbhelper.cpp
+++ qt5/style/argbhelper.cpp
#include <qtcurve-utils/qtutils.h>
+#include <qtcurve-utils/qtprops.h>
#include "private/qwidget_p.h"
__attribute__((hot)) void
addAlphaChannel(QWidget *widget)
- QTC_RET_IF_FAIL(!qtcGetWid(widget));
- // Set this for better efficiency for now
- widget->setAutoFillBackground(false);
- QWindow *window = widget->windowHandle();
- QWidgetPrivate *widgetPrivate =
- static_cast<QWidgetPrivate*>(QObjectPrivate::get(widget));
- widgetPrivate->updateIsOpaque();
- widgetPrivate->createTLExtra();
- widgetPrivate->createTLSysExtra();
- window = widget->windowHandle();
- // Maybe we can register event filters and/or listen for signals
- // like parent change or screen change on the QWidgetWindow
- // so that we have a better change to update the alpha info
- QSurfaceFormat format = window->format();
- format.setAlphaBufferSize(8);
- window->setFormat(format);
+ if (qobject_cast<QMenu*>(widget)) {
+ QtcQWidgetProps props(widget);
+ widget->setAttribute(Qt::WA_TranslucentBackground);
+ if (!props->ensuringPolish) {
+ props->ensuringPolish = true;
+ widget->ensurePolished();