diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 5e4e749c83..0db4176607 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -1786,6 +1786,23 @@ static inline xcb_rectangle_t qRectToXCBRectangle(const QRect &r) return result; } +void QXcbWindow::setOpacity(qreal level) +{ + if (!m_window) + return; + + quint32 value = qRound64(qBound(qreal(0), level, qreal(1)) * 0xffffffff); + + Q_XCB_CALL(xcb_change_property(xcb_connection(), + XCB_PROP_MODE_REPLACE, + m_window, + atom(QXcbAtom::_NET_WM_WINDOW_OPACITY), + XCB_ATOM_CARDINAL, + 32, + 1, + (uchar *)&value)); +} + void QXcbWindow::setMask(const QRegion ®ion) { if (!connection()->hasXShape()) diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index bd4d18a175..07ac0e0fcb 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -109,6 +109,8 @@ public: bool startSystemResize(const QPoint &pos, Qt::Corner corner); + void setOpacity(qreal level); + #if !defined(QT_NO_SHAPE) void setMask(const QRegion ®ion); #endif // !QT_NO_SHAPE