QWidget: allow modal top-levels to have WA_DontShowOnScreen
If a modal top-level widget has WA_DontShowOnScreen set, we need to call QGuiApplicationPrivate::showModalWindow() and hideModalWindow() ourselves, since we will not be calling QWindow::setVisible() (which would normally do the call for us). Change-Id: I1b22dd177c5956a2290f3ee031c95ab50d88f153 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>bb10
parent
a266c22bb8
commit
9839474e19
|
|
@ -441,8 +441,15 @@ void QWidgetPrivate::show_sys()
|
|||
{
|
||||
Q_Q(QWidget);
|
||||
q->setAttribute(Qt::WA_Mapped);
|
||||
|
||||
QWindow *window = q->windowHandle();
|
||||
|
||||
if (q->testAttribute(Qt::WA_DontShowOnScreen)) {
|
||||
invalidateBuffer(q->rect());
|
||||
if (q->isWindow() && q->windowModality() != Qt::NonModal && window) {
|
||||
// add our window to the modal window list
|
||||
QGuiApplicationPrivate::showModalWindow(window);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -451,7 +458,6 @@ void QWidgetPrivate::show_sys()
|
|||
if (!q->isWindow() && !q->testAttribute(Qt::WA_NativeWindow))
|
||||
return;
|
||||
|
||||
QWindow *window = q->windowHandle();
|
||||
if (window) {
|
||||
QRect geomRect = q->geometry();
|
||||
if (q->isWindow()) {
|
||||
|
|
@ -473,9 +479,7 @@ void QWidgetPrivate::show_sys()
|
|||
}
|
||||
|
||||
invalidateBuffer(q->rect());
|
||||
|
||||
if (window)
|
||||
window->setVisible(true);
|
||||
window->setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -484,6 +488,17 @@ void QWidgetPrivate::hide_sys()
|
|||
{
|
||||
Q_Q(QWidget);
|
||||
q->setAttribute(Qt::WA_Mapped, false);
|
||||
|
||||
QWindow *window = q->windowHandle();
|
||||
|
||||
if (q->testAttribute(Qt::WA_DontShowOnScreen)
|
||||
&& q->isWindow()
|
||||
&& q->windowModality() != Qt::NonModal
|
||||
&& window) {
|
||||
// remove our window from the modal window list
|
||||
QGuiApplicationPrivate::hideModalWindow(window);
|
||||
}
|
||||
|
||||
deactivateWidgetCleanup();
|
||||
if (!q->isWindow()) {
|
||||
QWidget *p = q->parentWidget();
|
||||
|
|
@ -492,9 +507,9 @@ void QWidgetPrivate::hide_sys()
|
|||
}
|
||||
return;
|
||||
}
|
||||
if (QWindow *window = q->windowHandle()) {
|
||||
window->setVisible(false);
|
||||
}
|
||||
|
||||
if (window)
|
||||
window->setVisible(false);
|
||||
}
|
||||
|
||||
void QWidgetPrivate::setMaxWindowState_helper()
|
||||
|
|
|
|||
Loading…
Reference in New Issue