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>
This commit is contained in:
parent
0516487237
commit
d8c996120c
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user