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