summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-08-08 12:39:38 +0200
committerGunnar Sletta <gunnar.sletta@nokia.com>2011-08-10 08:17:41 +0200
commit24c7776c622b29fa3bdf62f7ab681c55af0d9bf0 (patch)
treec2b947d0ad492bdf758f3f505b3223bd1b5d13c5
parent2ac6eb142e4ee73309854ebf02b1dbac7a5b654b (diff)
Made QWindow::setVisible() send show and hide events.
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>
-rw-r--r--src/gui/kernel/qwindow.cpp21
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.cpp10
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.h2
3 files changed, 19 insertions, 14 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 95331a2415..9eb011abb1 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -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);
}
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp
index 298592bae3..a6115cc829 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.cpp
+++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp
@@ -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
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.h b/src/plugins/platforms/eglfs/qeglfswindow.h
index 32a6e71683..09f553d3b7 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.h
+++ b/src/plugins/platforms/eglfs/qeglfswindow.h
@@ -58,8 +58,6 @@ public:
void setGeometry(const QRect &);
WId winId() const;
- void setVisible(bool visible);
-
private:
WId m_winid;
};