diff options
author | Jan Arve Saether <jan-arve.saether@digia.com> | 2014-04-29 14:15:42 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-30 12:38:42 +0200 |
commit | 92d289aba8207d2e95ff4117660f619e497f93e8 (patch) | |
tree | a65b91b09d17c872c10d6149e578068500c552ec /src | |
parent | fd644f3bd0eee59a9cacfd0dd51a620c31c8e87d (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/kernel/qwindowcontainer.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index 4618e1c91d..1770e60c2e 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -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 ** ** This file is part of the QtWidgets module of the Qt Toolkit. @@ -72,7 +72,14 @@ public: void updateGeometry() { 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()); else window->setGeometry(QRect(q->mapTo(q->window(), QPoint()), q->size())); |