diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-08-13 15:19:20 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-08-18 13:10:23 +0000 |
commit | 23697466cae8f1a49537fed1e60db8cea79207b4 (patch) | |
tree | de527385caf854ddd810b39369370c8730c5306e /src/widgets/kernel/qwhatsthis.cpp | |
parent | 52ad5afe1c1d8f8d47fccbdf474f8c6119b94608 (diff) |
Reduce usage of QDesktopWidget to resolve screen properties in QtWidgets
Removes the need to initialize QDesktopWidget, just to look up which
screen a widget would map to, the geometry of a screen, number of
screens, etc.
Change-Id: Ieb153b9ff6d3fba645fc528d6e430e8392f990bf
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/widgets/kernel/qwhatsthis.cpp')
-rw-r--r-- | src/widgets/kernel/qwhatsthis.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp index e2cfebb8a1..91d2b503e0 100644 --- a/src/widgets/kernel/qwhatsthis.cpp +++ b/src/widgets/kernel/qwhatsthis.cpp @@ -42,6 +42,7 @@ #include "qapplication.h" #include <private/qguiapplication_p.h> #include "qdesktopwidget.h" +#include <private/qdesktopwidget_p.h> #include "qevent.h" #include "qpixmap.h" #include "qscreen.h" @@ -209,7 +210,7 @@ QWhatsThat::QWhatsThat(const QString& txt, QWidget* parent, QWidget *showTextFor } else { - int sw = QApplication::desktop()->width() / 3; + int sw = QDesktopWidgetPrivate::width() / 3; if (sw < 200) sw = 200; else if (sw > 300) @@ -582,14 +583,14 @@ void QWhatsThisPrivate::say(QWidget * widget, const QString &text, int x, int y) // okay, now to find a suitable location int scr = (widget ? - QApplication::desktop()->screenNumber(widget) : + QDesktopWidgetPrivate::screenNumber(widget) : #if 0 /* Used to be included in Qt4 for Q_WS_X11 */ && !defined(QT_NO_CURSOR) QCursor::x11Screen() #else - QApplication::desktop()->screenNumber(QPoint(x,y)) + QDesktopWidgetPrivate::screenNumber(QPoint(x,y)) #endif ); - QRect screen = QApplication::desktop()->screenGeometry(scr); + QRect screen = QDesktopWidgetPrivate::screenGeometry(scr); int w = whatsThat->width(); int h = whatsThat->height(); |