Lighthouse: use maybetopdata instead of creating topdata for all
authorJørgen Lind <jorgen.lind@nokia.com>
Wed, 27 Apr 2011 08:05:52 +0000 (10:05 +0200)
committerSamuel Rødal <samuel.rodal@nokia.com>
Thu, 28 Apr 2011 13:39:20 +0000 (15:39 +0200)
widgets
(cherry picked from commit 873764aa3cfbbd87bbbb4f3224a7807d46a16fc7)

src/gui/kernel/qplatformscreen_qpa.cpp

index c9f3dc6..4fd6896 100644 (file)
@@ -84,12 +84,15 @@ QSize QPlatformScreen::physicalSize() const
 Q_GUI_EXPORT extern QWidgetPrivate *qt_widget_private(QWidget *widget);
 QPlatformScreen * QPlatformScreen::platformScreenForWidget(const QWidget *widget)
 {
+    int screenIndex = 0;
     QWidget *window = widget->window();
     QWidgetPrivate *windowPrivate = qt_widget_private(window);
-    QTLWExtra * topData = windowPrivate->topData();
+    QTLWExtra * topData = windowPrivate->maybeTopData();
+    if (topData)
+        screenIndex = topData->screenIndex;
     QPlatformIntegration *integration =
             QApplicationPrivate::platformIntegration();
-    return integration->screens()[topData->screenIndex];
+    return integration->screens()[screenIndex];
 }
 
 /*!