summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qplatformscreen_qpa.cpp
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2010-12-08 12:09:36 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2011-01-04 14:18:20 (GMT)
commitf6c5b16768d45f196bab0a2766d4be6027991e08 (patch)
tree610b9b3de9981916b4dc1abef43390caaed1616f /src/gui/kernel/qplatformscreen_qpa.cpp
parent3753b15e88f2c8220b887f27be79491c4135a291 (diff)
downloadQt-f6c5b16768d45f196bab0a2766d4be6027991e08.zip
Qt-f6c5b16768d45f196bab0a2766d4be6027991e08.tar.gz
Qt-f6c5b16768d45f196bab0a2766d4be6027991e08.tar.bz2
Add function QPlatformScreen::platformScreenForWidget
This so there is some logical connection between what screen a widget belongs to
Diffstat (limited to 'src/gui/kernel/qplatformscreen_qpa.cpp')
-rw-r--r--src/gui/kernel/qplatformscreen_qpa.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformscreen_qpa.cpp b/src/gui/kernel/qplatformscreen_qpa.cpp
index 5e80ba8..118835f 100644
--- a/src/gui/kernel/qplatformscreen_qpa.cpp
+++ b/src/gui/kernel/qplatformscreen_qpa.cpp
@@ -41,7 +41,11 @@
#include "qplatformscreen_qpa.h"
#include <QtGui/qapplication.h>
+#include <QtGui/private/qapplication_p.h>
#include <QtGui/qdesktopwidget.h>
+#include <QtGui/qplatformintegration_qpa.h>
+#include <QtGui/qwidget.h>
+#include <QtGui/private/qwidget_p.h>
/*!
Return the given top level widget for a given position.
@@ -77,6 +81,17 @@ QSize QPlatformScreen::physicalSize() const
return QSize(width,height);
}
+Q_GUI_EXPORT extern QWidgetPrivate *qt_widget_private(QWidget *widget);
+QPlatformScreen * QPlatformScreen::platformScreenForWidget(const QWidget *widget)
+{
+ QWidget *window = widget->window();
+ QWidgetPrivate *windowPrivate = qt_widget_private(window);
+ QTLWExtra * topData = windowPrivate->topData();
+ QPlatformIntegration *integration =
+ QApplicationPrivate::platformIntegration();
+ return integration->screens()[topData->screenIndex];
+}
+
/*!
\class QPlatformScreen
\since 4.8