From edf2e699856e0385746ea03fea23ec20c08c0b2c Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 13 Apr 2018 09:19:48 +0200 Subject: Don't increase the size of the layout unnecessarily when moving toolbars When the toolbar was moved from one position to another it could end up increasing the size of the saveState data due to extra lines. This removes any needless ones that should not be included. Change-Id: I1c5d094ae1405d6a82db5fcdc3cd081904706837 Reviewed-by: Richard Moe Gustavsen --- src/widgets/widgets/qtoolbararealayout.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/widgets/widgets/qtoolbararealayout.cpp') diff --git a/src/widgets/widgets/qtoolbararealayout.cpp b/src/widgets/widgets/qtoolbararealayout.cpp index 884eface3c..adc329131c 100644 --- a/src/widgets/widgets/qtoolbararealayout.cpp +++ b/src/widgets/widgets/qtoolbararealayout.cpp @@ -1078,7 +1078,11 @@ bool QToolBarAreaLayout::insertGap(const QList &path, QLayoutItem *item) void QToolBarAreaLayout::remove(const QList &path) { Q_ASSERT(path.count() == 3); - docks[path.at(0)].lines[path.at(1)].toolBarItems.removeAt(path.at(2)); + QToolBarAreaLayoutInfo &dock = docks[path.at(0)]; + QToolBarAreaLayoutLine &line = dock.lines[path.at(1)]; + line.toolBarItems.removeAt(path.at(2)); + if (line.toolBarItems.isEmpty()) + dock.lines.removeAt(path.at(1)); } void QToolBarAreaLayout::remove(QLayoutItem *item) -- cgit v1.2.3