Skip to content

Commit

Permalink
Merge pull request #12707 from ronso0/controls-no-duplicates
Browse files Browse the repository at this point in the history
ControlModel: avoid duplicates in developer tools window
  • Loading branch information
Swiftb0y authored Feb 1, 2024
2 parents 99da622 + 3958df3 commit 82c0ba2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/control/controlmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,21 @@ ControlModel::ControlModel(QObject* pParent)
const QList<QSharedPointer<ControlDoublePrivate>> controlsList =
ControlDoublePrivate::getAllInstances();

QSet<ConfigKey> controlKeys;

for (const QSharedPointer<ControlDoublePrivate>& pControl : controlsList) {
if (!pControl) {
continue;
}

// Skip duplicates
// This skips either the alias or original key, whatever comes first
// in controlsList, but that doesn't make a difference here.
if (controlKeys.contains(pControl->getKey())) {
continue;
}
controlKeys.insert(pControl->getKey());

addControl(pControl->getKey(),
pControl->name(),
pControl->description());
Expand Down

0 comments on commit 82c0ba2

Please sign in to comment.