From f1268d137ea7839b320c84314d0c2265f5a629ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 20 Nov 2013 13:03:14 +0100 Subject: 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 Reviewed-by: Paul Olav Tvete --- src/widgets/kernel/qwidget.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/widgets') 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 -- cgit v1.2.3 From 773610cc451bb2b4319da6567b21510022d08014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 21 Nov 2013 14:43:40 +0100 Subject: Revert "Ensure Qt::WA_Mapped is set in case of obscured native windows." Qt::WA_Mapped maps (sic) to windowHandle()->isExposed(), and we set/update it in QWidgetWindow::handleExposeEvent(). Setting it directly in show_sys shortcuts QPA and assumes showing a window is synchronous on all platforms, resulting in trying to flush the widget backingstore when the window was not exposed yet (due to discardSyncRequest starting to return false). This reverts commit 829b1d13b225e87b8a385397e2b53c7a9f8cda9e. Change-Id: I0bd700d4939bc69ba184d8586435b68ec3dd72fb Reviewed-by: Gunnar Sletta --- src/widgets/kernel/qwidget_qpa.cpp | 2 +- src/widgets/kernel/qwidgetwindow.cpp | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 3c4985591e..93234f3958 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -510,9 +510,9 @@ void QWidgetPrivate::show_sys() QWindow *window = q->windowHandle(); - q->setAttribute(Qt::WA_Mapped); if (q->testAttribute(Qt::WA_DontShowOnScreen)) { invalidateBuffer(q->rect()); + q->setAttribute(Qt::WA_Mapped); if (q->isWindow() && q->windowModality() != Qt::NonModal && window) { // add our window to the modal window list QGuiApplicationPrivate::showModalWindow(window); diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 22e15e23fe..e977ab3d6f 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -713,10 +713,6 @@ void QWidgetWindow::handleWindowStateChangedEvent(QWindowStateChangeEvent *event break; } - // Note that widgetState == m_widget->data->window_state when triggered by QWidget::setWindowState(). - if (!(widgetState & Qt::WindowMinimized)) - m_widget->setAttribute(Qt::WA_Mapped); - // Sent event if the state changed (that is, it is not triggered by // QWidget::setWindowState(), which also sends an event to the widget). if (widgetState != int(m_widget->data->window_state)) { -- cgit v1.2.3 From 7201148be075632124db3d6a4046b590dad09884 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 25 Nov 2013 13:13:11 +0100 Subject: Revert "Android: Use native platform menus." This reverts commit 98f0b4668999d677d8bf91d57ac095d96e7a661c. The native menu popup would never exit its event loop, because there's no listener for the closing of the menu. Since this is very last minute and the change is not ready, we revert it and use the widget menus instead. Change-Id: Ie9ae707300a265130a90d1ccb5f093f50cc0b2fb Reviewed-by: Paul Olav Tvete --- src/widgets/widgets/qmenu.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 0cbd1c720c..3a4fd449c8 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -1834,14 +1834,6 @@ QSize QMenu::sizeHint() const void QMenu::popup(const QPoint &p, QAction *atAction) { Q_D(QMenu); - -#ifdef Q_OS_ANDROID - if (!d->platformMenu.isNull() && !testAttribute(Qt::WA_SetStyle)) { - d->platformMenu->showPopup(window()->windowHandle(), p, 0); - return; - } -#endif - if (d->scroll) { // reset scroll state from last popup if (d->scroll->scrollOffset) d->itemsDirty = 1; // sizeHint will be incorrect if there is previous scroll -- cgit v1.2.3