--- a/src/gui/itemviews/qtreewidget.cpp Mon Jun 21 22:38:13 2010 +0100
+++ b/src/gui/itemviews/qtreewidget.cpp Thu Jul 22 16:41:55 2010 +0100
@@ -3039,10 +3039,14 @@
Q_D(const QTreeWidget);
QModelIndexList indexes = selectionModel()->selectedIndexes();
QList<QTreeWidgetItem*> items;
+ items.reserve(indexes.count());
+ QSet<QTreeWidgetItem *> seen;
+ seen.reserve(indexes.count());
for (int i = 0; i < indexes.count(); ++i) {
QTreeWidgetItem *item = d->item(indexes.at(i));
- if (isItemHidden(item) || items.contains(item)) // ### slow, optimize later
+ if (isItemHidden(item) || seen.contains(item))
continue;
+ seen.insert(item);
items.append(item);
}
return items;