diff options
author | Thomas McGuire <thomas.mcguire.qnx@kdab.com> | 2012-06-27 15:45:42 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-30 23:20:59 +0200 |
commit | 2d450f8f6ed446d9a1a69364a3078374d354c7b8 (patch) | |
tree | 2f9300f74903e1f51a68cde6987f256a43c7eb54 /src | |
parent | f06a9289787c01de323fe6e1ae71ceb2e5348a61 (diff) |
Support the showIsFullScreen style hint in widgets.
Now QWidget::show() will be the same as QWidget::showFullScreen() if the
style hint is set.
This is consistent with QQuickView now.
De-inline related methods to make it easier to change them later
without breaking compatibility.
Change-Id: I843ac6f846428217bfc5dc9f1d0a554de9d0c08f
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 33 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.h | 6 |
2 files changed, 26 insertions, 13 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index bf21503f6e..a42fd7aa72 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -57,6 +57,7 @@ #include "qvariant.h" #include "qwidget.h" #include "qstyleoption.h" +#include "qstylehints.h" #ifndef QT_NO_ACCESSIBILITY # include "qaccessible.h" #endif @@ -2793,7 +2794,7 @@ void QWidget::showFullScreen() setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowMaximized)) | Qt::WindowFullScreen); - show(); + setVisible(true); activateWindow(); } @@ -6909,15 +6910,22 @@ void QWidget::setUpdatesEnabled(bool enable) d->setUpdatesEnabled_helper(enable); } -/*! \fn void QWidget::show() - +/*! Shows the widget and its child widgets. This function is - equivalent to setVisible(true). + equivalent to setVisible(true) in the normal case, and equivalent + to showFullScreen() if the QStyleHints::showIsFullScreen() hint + is true. \sa raise(), showEvent(), hide(), setVisible(), showMinimized(), showMaximized(), showNormal(), isVisible() */ - +void QWidget::show() +{ + if (isWindow() && qApp->styleHints()->showIsFullScreen()) + showFullScreen(); + else + setVisible(true); +} /*! \internal @@ -7091,8 +7099,7 @@ void QWidgetPrivate::show_helper() data.in_show = false; // reset qws optimization } -/*! \fn void QWidget::hide() - +/*! Hides the widget. This function is equivalent to setVisible(false). @@ -7103,6 +7110,10 @@ void QWidgetPrivate::show_helper() \sa hideEvent(), isHidden(), show(), setVisible(), isVisible(), close() */ +void QWidget::hide() +{ + setVisible(false); +} /*!\internal */ @@ -7313,11 +7324,13 @@ void QWidget::setVisible(bool visible) } } -/*!\fn void QWidget::setHidden(bool hidden) - +/*! Convenience function, equivalent to setVisible(!\a hidden). */ - +void QWidget::setHidden(bool hidden) +{ + setVisible(!hidden); +} void QWidgetPrivate::_q_showIfNotHidden() { diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index af87612013..67b5251852 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -465,9 +465,9 @@ public Q_SLOTS: // Widget management functions virtual void setVisible(bool visible); - inline void setHidden(bool hidden) { setVisible(!hidden); } - inline void show() { setVisible(true); } - inline void hide() { setVisible(false); } + void setHidden(bool hidden); + void show(); + void hide(); void showMinimized(); void showMaximized(); |