summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2020-05-02 23:03:39 +0200
committerMarc Mutz <marc.mutz@kdab.com>2020-05-07 15:28:21 +0200
commitc3ca27d02c57c1f3c2865d09b7822c4e86d19fcb (patch)
tree28c7438d42d0c59244588d4ceab8cc5c93d46720 /src/widgets/styles
parenta96900eea51b1079efb7ee5c87a91a27306f03c7 (diff)
QStyleSheetStyle: port a local QSet to QDuplicateTracker
Apart from a more fitting, minimal, API, QDuplicateTracker also transparently uses C++17 pmr::monotonic_buffer_resource to avoid, or at least reduce, memory allocations. Change-Id: Ice3ebf1891141d2ac1ec9dd069fb40e98d4056c6 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/widgets/styles')
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index a180fbf4fd..8445a4440d 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -123,6 +123,8 @@
#include <QtGui/qpainterpath.h>
#include <QtGui/qscreen.h>
+#include <QtCore/private/qduplicatetracker_p.h>
+
QT_BEGIN_NAMESPACE
using namespace QCss;
@@ -2582,15 +2584,14 @@ void QStyleSheetStyle::setProperties(QWidget *w)
{
// scan decls for final occurrence of each "qproperty"
- QSet<const QString> propertySet;
+ QDuplicateTracker<QString> propertySet;
+ propertySet.reserve(decls.size());
for (int i = decls.count() - 1; i >= 0; --i) {
const QString property = decls.at(i).d->property;
if (!property.startsWith(QLatin1String("qproperty-"), Qt::CaseInsensitive))
continue;
- if (!propertySet.contains(property)) {
- propertySet.insert(property);
+ if (!propertySet.hasSeen(property))
finals.append(i);
- }
}
}