Widgets going "undercover" should also undercover the QWindow
Sometimes Qt wants to hide a widget without calling setVisible(false). This is usually done by setting the widgets geometry outside the parents clip rect (and usually by setting its y coordinate to a sufficiently negative y coordinate). QSplitter uses this when it needs to collapse its children. Previously the QWindow was just moved straight above the QWidget it was hosted in. Task-number: QTBUG-38475 Change-Id: I154dd4d13f108c3d34c64eadb41dd6b477dc5c4e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
This commit is contained in:
parent
fd644f3bd0
commit
92d289aba8
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||||
** Contact: http://www.qt-project.org/legal
|
** Contact: http://www.qt-project.org/legal
|
||||||
**
|
**
|
||||||
** This file is part of the QtWidgets module of the Qt Toolkit.
|
** This file is part of the QtWidgets module of the Qt Toolkit.
|
||||||
@ -72,7 +72,14 @@ public:
|
|||||||
|
|
||||||
void updateGeometry() {
|
void updateGeometry() {
|
||||||
Q_Q(QWindowContainer);
|
Q_Q(QWindowContainer);
|
||||||
if (usesNativeWidgets)
|
if (q->geometry().bottom() <= 0 || q->geometry().right() <= 0)
|
||||||
|
/* Qt (e.g. QSplitter) sometimes prefer to hide a widget by *not* calling
|
||||||
|
setVisible(false). This is often done by setting its coordinates to a sufficiently
|
||||||
|
negative value so that its clipped outside the parent. Since a QWindow is not clipped
|
||||||
|
to widgets in general, it needs to be dealt with as a special case.
|
||||||
|
*/
|
||||||
|
window->setGeometry(q->geometry());
|
||||||
|
else if (usesNativeWidgets)
|
||||||
window->setGeometry(q->rect());
|
window->setGeometry(q->rect());
|
||||||
else
|
else
|
||||||
window->setGeometry(QRect(q->mapTo(q->window(), QPoint()), q->size()));
|
window->setGeometry(QRect(q->mapTo(q->window(), QPoint()), q->size()));
|
||||||
|
Loading…
Reference in New Issue
Block a user