Made QWindow::setVisible() send show and hide events.
authorSamuel Rødal <samuel.rodal@nokia.com>
Mon, 8 Aug 2011 10:39:38 +0000 (12:39 +0200)
committerGunnar Sletta <gunnar.sletta@nokia.com>
Wed, 10 Aug 2011 06:17:41 +0000 (08:17 +0200)
Change-Id: Ideae15f7bd6801d7afe2354627c0893b0b6a32ca
Reviewed-on: http://codereview.qt.nokia.com/2741
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
src/gui/kernel/qwindow.cpp
src/plugins/platforms/eglfs/qeglfswindow.cpp
src/plugins/platforms/eglfs/qeglfswindow.h

index 95331a2..9eb011a 100644 (file)
@@ -123,7 +123,18 @@ void QWindow::setVisible(bool visible)
 
     if (!d->platformWindow)
         create();
+
+    if (visible) {
+        QShowEvent showEvent;
+        QGuiApplication::sendEvent(this, &showEvent);
+    }
+
     d->platformWindow->setVisible(visible);
+
+    if (!visible) {
+        QHideEvent hideEvent;
+        QGuiApplication::sendEvent(this, &hideEvent);
+    }
 }
 
 bool QWindow::visible() const
@@ -515,12 +526,10 @@ void QWindow::resizeEvent(QResizeEvent *)
 
 void QWindow::showEvent(QShowEvent *)
 {
-    qDebug() << "unimplemented:" << __FILE__ << __LINE__;
 }
 
 void QWindow::hideEvent(QHideEvent *)
 {
-    qDebug() << "unimplemented:" << __FILE__ << __LINE__;
 }
 
 bool QWindow::event(QEvent *event)
@@ -568,6 +577,14 @@ bool QWindow::event(QEvent *event)
         exposeEvent(static_cast<QExposeEvent *>(event));
         break;
 
+    case QEvent::Show:
+        showEvent(static_cast<QShowEvent *>(event));
+        break;
+
+    case QEvent::Hide:
+        hideEvent(static_cast<QHideEvent *>(event));
+        break;
+
     default:
         return QObject::event(event);
     }
index 298592b..a6115cc 100644 (file)
@@ -74,14 +74,4 @@ WId QEglFSWindow::winId() const
     return m_winid;
 }
 
-void QEglFSWindow::setVisible(bool visible)
-{
-    if (visible) {
-        QWindowSystemInterface::handleMapEvent(window());
-    } else {
-        QWindowSystemInterface::handleUnmapEvent(window());
-    }
-
-}
-
 QT_END_NAMESPACE
index 32a6e71..09f553d 100644 (file)
@@ -58,8 +58,6 @@ public:
     void setGeometry(const QRect &);
     WId winId() const;
 
-    void setVisible(bool visible);
-
 private:
     WId m_winid;
 };