summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-12-21 09:49:12 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-12-21 15:49:44 +0000
commit309169afd9a500fb8c4e95dab3a7e0fb53e5d86b (patch)
treefb6156c9bc1fc055ed1e88c2e391d8f53a8e2969 /src/widgets
parent54519d7327014491a7f52ba8d40c884ed896e26e (diff)
QScroller: Fix deprecation warning about QDdesktopWidget:::primaryScreen()
In file included from ..\..\include\QtWidgets/qdesktopwidget.h:1:0, from kernel\qt_widgets_pch.h:71: ..\..\include\QtWidgets/../../src/widgets/kernel/qdesktopwidget.h:71:65: note: declared here QT_DEPRECATED_X("Use QGuiApplication::primaryScreen()") int primaryScreen() const; Use QScreen directly and remove the then unused function realDpi(). Change-Id: I526adb09ba35ed0699338d6a8d044c2ff9a03a1e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/util/qscroller.cpp38
-rw-r--r--src/widgets/util/qscroller_p.h1
2 files changed, 2 insertions, 37 deletions
diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp
index 50351ea568..4f5cf55a64 100644
--- a/src/widgets/util/qscroller.cpp
+++ b/src/widgets/util/qscroller.cpp
@@ -1013,40 +1013,6 @@ bool QScroller::handleInput(Input input, const QPointF &position, qint64 timesta
return false;
}
-#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
-// the Mac version is implemented in qscroller_mac.mm
-
-QPointF QScrollerPrivate::realDpi(int screenNumber) const
-{
-# if 0 /* Used to be included in Qt4 for Q_WS_X11 */ && !defined(QT_NO_XRANDR)
- if (X11 && X11->use_xrandr && X11->ptrXRRSizes && X11->ptrXRRRootToScreen) {
- int nsizes = 0;
- // QDesktopWidget is based on Xinerama screens, which do not always
- // correspond to RandR screens: NVidia's TwinView e.g. will show up
- // as 2 screens in QDesktopWidget, but libXRandR will only see 1 screen.
- // (although with the combined size of the Xinerama screens).
- // Additionally, libXrandr will simply crash when calling XRRSizes
- // for (the non-existent) screen 1 in this scenario.
- Window root = RootWindow(X11->display, screen == -1 ? X11->defaultScreen : screen);
- int randrscreen = (root != XNone) ? X11->ptrXRRRootToScreen(X11->display, root) : -1;
-
- XRRScreenSize *sizes = X11->ptrXRRSizes(X11->display, randrscreen == -1 ? 0 : randrscreen, &nsizes);
- if (nsizes > 0 && sizes && sizes->width && sizes->height && sizes->mwidth && sizes->mheight) {
- qScrollerDebug() << "XRandR DPI:" << QPointF(qreal(25.4) * qreal(sizes->width) / qreal(sizes->mwidth),
- qreal(25.4) * qreal(sizes->height) / qreal(sizes->mheight));
- return QPointF(qreal(25.4) * qreal(sizes->width) / qreal(sizes->mwidth),
- qreal(25.4) * qreal(sizes->height) / qreal(sizes->mheight));
- }
- }
-# endif
-
- const QScreen *screen = QDesktopWidgetPrivate::screen(screenNumber);
- return QPointF(screen->physicalDotsPerInchX(), screen->physicalDotsPerInchY());
-}
-
-#endif
-
-
/*! \internal
Returns the resolution of the used screen.
*/
@@ -1071,8 +1037,8 @@ void QScrollerPrivate::setDpi(const QPointF &dpi)
*/
void QScrollerPrivate::setDpiFromWidget(QWidget *widget)
{
- QDesktopWidget *dw = QApplication::desktop();
- setDpi(realDpi(widget ? dw->screenNumber(widget) : dw->primaryScreen()));
+ const QScreen *screen = QGuiApplication::screens().at(QApplication::desktop()->screenNumber(widget));
+ setDpi(QPointF(screen->physicalDotsPerInchX(), screen->physicalDotsPerInchY()));
}
/*! \internal
diff --git a/src/widgets/util/qscroller_p.h b/src/widgets/util/qscroller_p.h
index 4557e7cc33..5e0c359514 100644
--- a/src/widgets/util/qscroller_p.h
+++ b/src/widgets/util/qscroller_p.h
@@ -119,7 +119,6 @@ public:
bool prepareScrolling(const QPointF &position);
void handleDrag(const QPointF &position, qint64 timestamp);
- QPointF realDpi(int screen) const;
QPointF dpi() const;
void setDpi(const QPointF &dpi);
void setDpiFromWidget(QWidget *widget);