summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-12-15 20:30:42 +0100
committerMarc Mutz <marc.mutz@kdab.com>2015-12-16 17:42:02 +0000
commitd8c996120c0443d60f33bc156f5fc9a598911bf5 (patch)
tree55a55c8b84c5b7b4ea9918597b65ff69da302c83 /src/widgets
parent0516487237145ad41b2fd13ecb5f63ba4325c02f (diff)
QFileDialogPrivate::restoreWidgetState(): use range-erase instead of while pop_front()
Depending on the number of popped arguments, repeated pop_front()s could turn quadratic even with QList. Change-Id: I1f29af4a61f0f8e13253807d2f208c7911e71378 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 1bf5691837..07d1ab0add 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -2761,8 +2761,10 @@ bool QFileDialogPrivate::restoreWidgetState(QStringList &history, int splitterPo
}
qFileDialogUi->sidebar->setUrls(sidebarUrls);
- while (history.count() > 5)
- history.pop_front();
+
+ static const int MaxHistorySize = 5;
+ if (history.size() > MaxHistorySize)
+ history.erase(history.begin(), history.end() - MaxHistorySize);
q->setHistory(history);
QHeaderView *headerView = qFileDialogUi->treeView->header();