Cocoa: don't show window when calling raise()
authorBradley T. Hughes <bradley.hughes@nokia.com>
Wed, 21 Mar 2012 08:43:45 +0000 (09:43 +0100)
committerQt by Nokia <qt-info@nokia.com>
Mon, 26 Mar 2012 09:41:07 +0000 (11:41 +0200)
Calling raise() on a hidden window should not show it. The setVisible()
function will ensure that the window is raised (since we use orderFront
or makeKeyAndOrderFront). This fixes the failing
tst_QDockWidget::task169808_setFloating() test as well.

Task-number: QTBUG-24774
Change-Id: If34472ebbcd615c10654efafd54c84c03d10bc8c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
src/plugins/platforms/cocoa/qcocoawindow.mm
tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp

index 7282a8d..46c1006 100644 (file)
@@ -198,13 +198,17 @@ void QCocoaWindow::raise()
 {
     //qDebug() << "raise" << this;
     // ### handle spaces (see Qt 4 raise_sys in qwidget_mac.mm)
-    if (m_nsWindow)
+    if (!m_nsWindow)
+        return;
+    if ([m_nsWindow isVisible])
         [m_nsWindow orderFront: m_nsWindow];
 }
 
 void QCocoaWindow::lower()
 {
-    if (m_nsWindow)
+    if (!m_nsWindow)
+        return;
+    if ([m_nsWindow isVisible])
         [m_nsWindow orderBack: m_nsWindow];
 }
 
index 7e7b049..43c0022 100644 (file)
@@ -764,9 +764,6 @@ void tst_QDockWidget::task169808_setFloating()
     qt_x11_wait_for_window_manager(&mw);
 #endif
 
-#ifdef Q_OS_MAC
-    QEXPECT_FAIL("", "Window handling: QTBUG-24774", Abort);
-#endif
     QCOMPARE(dw->widget()->size(), dw->widget()->sizeHint());
 
     //and now we try to test if the contents margin is taken into account