From 24c7776c622b29fa3bdf62f7ab681c55af0d9bf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 8 Aug 2011 12:39:38 +0200 Subject: Made QWindow::setVisible() send show and hide events. Change-Id: Ideae15f7bd6801d7afe2354627c0893b0b6a32ca Reviewed-on: http://codereview.qt.nokia.com/2741 Reviewed-by: Qt Sanity Bot Reviewed-by: Gunnar Sletta --- src/gui/kernel/qwindow.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/gui/kernel/qwindow.cpp') 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(event)); break; + case QEvent::Show: + showEvent(static_cast(event)); + break; + + case QEvent::Hide: + hideEvent(static_cast(event)); + break; + default: return QObject::event(event); } -- cgit v1.2.3