From 23697466cae8f1a49537fed1e60db8cea79207b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Sun, 13 Aug 2017 15:19:20 +0200 Subject: Reduce usage of QDesktopWidget to resolve screen properties in QtWidgets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Simon Hausmann Reviewed-by: Tor Arne Vestbø --- src/widgets/util/qsystemtrayicon.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/widgets/util/qsystemtrayicon.cpp') diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index 19c22eca46..fb3782881c 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -59,6 +59,7 @@ #include "qgridlayout.h" #include "qapplication.h" #include "qdesktopwidget.h" +#include #include "qbitmap.h" #include @@ -535,7 +536,7 @@ QBalloonTip::QBalloonTip(const QIcon &icon, const QString &title, msgLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft); // smart size for the message label - int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 3; + int limit = QDesktopWidgetPrivate::availableGeometry(msgLabel).size().width() / 3; if (msgLabel->sizeHint().width() > limit) { msgLabel->setWordWrap(true); if (msgLabel->sizeHint().width() > limit) { @@ -602,7 +603,7 @@ void QBalloonTip::resizeEvent(QResizeEvent *ev) void QBalloonTip::balloon(const QPoint& pos, int msecs, bool showArrow) { this->showArrow = showArrow; - QRect scr = QApplication::desktop()->screenGeometry(pos); + QRect scr = QDesktopWidgetPrivate::screenGeometry(pos); QSize sh = sizeHint(); const int border = 1; const int ah = 18, ao = 18, aw = 18, rc = 7; -- cgit v1.2.3