diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2013-11-20 13:03:14 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-20 16:09:28 +0100 |
commit | f1268d137ea7839b320c84314d0c2265f5a629ba (patch) | |
tree | 4bfb2a698f819d23c05b242eb08cd59e5ca26df3 /src/widgets | |
parent | 54b8c27e03d04c1e5cd35f75d5c0a8111240eb74 (diff) |
Allow platform to decide default behavior for show() based on window flags
The ShowIsMaximized and ShowIsFullscreen style hints were not granular
enough to build a default behavior from that would be correct for all
platforms. The recent Android patch that excluded dialogs from being
shown maximized (Ia249e93dbbea1) has now been moved into a platform
override in the Android integration plugin, leaving other platforms
to the default behavior of using the style-hints. We still special
case popup-windows though, as that behavior has been there for a
while.
Task-number: QTBUG-34969
Change-Id: Id36346d71bfc46171383ffe334592ca0b94e456f
Reviewed-by: BogDan Vatra <bogdan@kde.org>
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 933294e21f..1da0be9781 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -6999,23 +6999,23 @@ void QWidget::setUpdatesEnabled(bool enable) } /*! - Shows the widget and its child widgets. This function is - equivalent to setVisible(true) in the normal case, and equivalent - to showFullScreen() if the QStyleHints::showIsFullScreen() hint - is true and the window is not a popup. + Shows the widget and its child widgets. - \sa raise(), showEvent(), hide(), setVisible(), showMinimized(), showMaximized(), - showNormal(), isVisible(), windowFlags() + This is equivalent to calling showFullScreen(), showMaximized(), or setVisible(true), + depending on the platform's default behavior for the window flags. + + \sa raise(), showEvent(), hide(), setVisible(), showMinimized(), showMaximized(), + showNormal(), isVisible(), windowFlags(), flags() */ void QWidget::show() { - bool isPopup = data->window_flags & Qt::Popup & ~Qt::Window; - if (isWindow() && !isPopup && qApp->styleHints()->showIsFullScreen()) + Qt::WindowState defaultState = QGuiApplicationPrivate::platformIntegration()->defaultWindowState(data->window_flags); + if (defaultState == Qt::WindowFullScreen) showFullScreen(); - else if (isWindow() && !(data->window_flags & Qt::Dialog & ~Qt::Window) && !isPopup && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ShowIsMaximized).toBool()) + else if (defaultState == Qt::WindowMaximized) showMaximized(); else - setVisible(true); + setVisible(true); // FIXME: Why not showNormal(), like QWindow::show()? } /*! \internal |