summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qlayout.cpp
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@qt.io>2019-05-03 15:47:57 +0200
committerJan Arve Sæther <jan-arve.saether@qt.io>2019-05-09 12:01:38 +0000
commit2b7edd053404f4819abf0203bb9c762799849638 (patch)
treeec7986c0673ffeb21f3c04703fd459d04118b818 /src/widgets/kernel/qlayout.cpp
parent7dd71e812542c561a00dd792d314843a81c5687c (diff)
Fix bug with QLayout::replaceWidget(a, a)
It should effectively leave the layout untouched Fixes: QTBUG-69706 Change-Id: I4d8232895bf1d1ae0d1b73156ef6ec6001d8968a Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Diffstat (limited to 'src/widgets/kernel/qlayout.cpp')
-rw-r--r--src/widgets/kernel/qlayout.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index e3f6a56875..8ea93f7d4e 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -1156,6 +1156,8 @@ QLayoutItem *QLayout::replaceWidget(QWidget *from, QWidget *to, Qt::FindChildOpt
Q_D(QLayout);
if (!from || !to)
return 0;
+ if (from == to) // Do not return a QLayoutItem for \a from, since ownership still
+ return nullptr; // belongs to the layout (since nothing was changed)
int index = -1;
QLayoutItem *item = 0;