From c3ca27d02c57c1f3c2865d09b7822c4e86d19fcb Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 2 May 2020 23:03:39 +0200 Subject: 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 --- src/widgets/styles/qstylesheetstyle.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/widgets/styles') 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 #include +#include + QT_BEGIN_NAMESPACE using namespace QCss; @@ -2582,15 +2584,14 @@ void QStyleSheetStyle::setProperties(QWidget *w) { // scan decls for final occurrence of each "qproperty" - QSet propertySet; + QDuplicateTracker 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); - } } } -- cgit v1.2.3