diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-05-15 15:14:53 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-05-15 18:20:20 +0200 |
commit | 6a28b391f71d8626c1793aa3bf732dea10519653 (patch) | |
tree | 9115d2ae20821b3a530330d66f9791f3270571b7 /src/widgets/kernel/qwhatsthis.cpp | |
parent | c4ce22ef249ef710ec0ff624b44aa948efe9327a (diff) | |
download | qtbase-6a28b391f71d8626c1793aa3bf732dea10519653.tar.gz |
Don't grab QWhatsThis background on non-Windows platforms
The logic was introduced in 186589abd48b17fdb9b631211008753e2d1701b3
due to Windows supposedly not supporting NoSystemBackground. It's
not clear whether this is still the case, but as this workaround
causes problems on other platforms, such as bringing up the screen
capturing permission dialog on macOS, it should be limited to Windows.
Fixes: QTBUG-113556
Pick-to: 6.5
Change-Id: I197adb5fc177faebc0f2fcd28612e3daa0c22ed5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/kernel/qwhatsthis.cpp')
-rw-r--r-- | src/widgets/kernel/qwhatsthis.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp index 3548d26647..c3365e46db 100644 --- a/src/widgets/kernel/qwhatsthis.cpp +++ b/src/widgets/kernel/qwhatsthis.cpp @@ -110,7 +110,9 @@ public: static QWhatsThat *instance; protected: +#if defined(Q_OS_WIN) void showEvent(QShowEvent *e) override; +#endif void mousePressEvent(QMouseEvent*) override; void mouseReleaseEvent(QMouseEvent*) override; void mouseMoveEvent(QMouseEvent*) override; @@ -123,7 +125,9 @@ private: QString text; QTextDocument* doc; QString anchor; +#if defined(Q_OS_WIN) QPixmap background; +#endif }; QWhatsThat *QWhatsThat::instance = nullptr; @@ -197,10 +201,12 @@ QWhatsThat::~QWhatsThat() delete doc; } +#if defined(Q_OS_WIN) void QWhatsThat::showEvent(QShowEvent *) { background = QGuiApplication::primaryScreen()->grabWindow(0, x(), y(), width(), height()); } +#endif void QWhatsThat::mousePressEvent(QMouseEvent* e) { @@ -261,7 +267,10 @@ void QWhatsThat::paintEvent(QPaintEvent*) if (drawShadow) r.adjust(0, 0, -shadowWidth, -shadowWidth); QPainter p(this); +#if defined(Q_OS_WIN) + // Needed due to supposed lack of support for NoSystemBackground on Windows p.drawPixmap(0, 0, background); +#endif p.setPen(QPen(palette().toolTipText(), 0)); p.setBrush(palette().toolTipBase()); p.drawRect(r); |