From 92d289aba8207d2e95ff4117660f619e497f93e8 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Tue, 29 Apr 2014 14:15:42 +0200 Subject: 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 Reviewed-by: Gunnar Sletta --- src/widgets/kernel/qwindowcontainer.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') 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())); -- cgit v1.2.3