diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 57fe8fa287e..46a787e7064 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -2231,20 +2231,26 @@ QObject *QWindow::focusObject() const /*! Shows the window. - This is equivalent to calling showFullScreen(), showMaximized(), or showNormal(), + For child windows, this is equivalent to calling showNormal(). + Otherwise, it is equivalent to calling showFullScreen(), showMaximized(), or showNormal(), depending on the platform's default behavior for the window type and flags. \sa showFullScreen(), showMaximized(), showNormal(), hide(), QStyleHints::showIsFullScreen(), flags() */ void QWindow::show() { - Qt::WindowState defaultState = QGuiApplicationPrivate::platformIntegration()->defaultWindowState(d_func()->windowFlags); - if (defaultState == Qt::WindowFullScreen) - showFullScreen(); - else if (defaultState == Qt::WindowMaximized) - showMaximized(); - else + if (parent()) { showNormal(); + } else { + const auto *platformIntegration = QGuiApplicationPrivate::platformIntegration(); + Qt::WindowState defaultState = platformIntegration->defaultWindowState(d_func()->windowFlags); + if (defaultState == Qt::WindowFullScreen) + showFullScreen(); + else if (defaultState == Qt::WindowMaximized) + showMaximized(); + else + showNormal(); + } } /*! diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index f9151f6147a..f644cb53eca 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -7954,21 +7954,29 @@ void QWidget::setUpdatesEnabled(bool enable) /*! Shows the widget and its child widgets. - This is equivalent to calling showFullScreen(), showMaximized(), or setVisible(true), - depending on the platform's default behavior for the window flags. + For child windows, this is equivalent to calling setVisible(true). + Otherwise, it 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(), + \sa raise(), showEvent(), hide(), setVisible(), showMinimized(), showMaximized(), showNormal(), isVisible(), windowFlags() */ void QWidget::show() { - Qt::WindowState defaultState = QGuiApplicationPrivate::platformIntegration()->defaultWindowState(data->window_flags); - if (defaultState == Qt::WindowFullScreen) - showFullScreen(); - else if (defaultState == Qt::WindowMaximized) - showMaximized(); - else - setVisible(true); // Don't call showNormal() as not to clobber Qt::Window(Max/Min)imized + // Note: We don't call showNormal() as not to clobber Qt::Window(Max/Min)imized + + if (!isWindow()) { + setVisible(true); + } else { + const auto *platformIntegration = QGuiApplicationPrivate::platformIntegration(); + Qt::WindowState defaultState = platformIntegration->defaultWindowState(data->window_flags); + if (defaultState == Qt::WindowFullScreen) + showFullScreen(); + else if (defaultState == Qt::WindowMaximized) + showMaximized(); + else + setVisible(true); + } } /*! \internal