From 92f984273262531f909ede17a324f546fe502b5c Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 6 May 2019 14:00:53 +0200 Subject: Deprecate conversion functions between QList and QSet Users should use range constructors instead to do the conversion. Keep conversion methods between QList and QVector as these will turn into a no-op in Qt 6, whereas forcing people to use range constructors would lead to deep copies of the data. Change-Id: Id9fc9e4d007044e019826da523e8418857c91283 Reviewed-by: Simon Hausmann --- src/corelib/statemachine/qstatemachine.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/corelib/statemachine') diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index ee3f7be279..be48dbc92f 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -370,10 +370,11 @@ static QList getEffectiveTargetStates(QAbstractTransition *tra QList historyConfiguration = QHistoryStatePrivate::get(historyState)->configuration; if (!historyConfiguration.isEmpty()) { // There is a saved history, so apply that. - targets.unite(historyConfiguration.toSet()); + targets.unite(QSet(historyConfiguration.constBegin(), historyConfiguration.constEnd())); } else if (QAbstractTransition *defaultTransition = historyState->defaultTransition()) { // No saved history, take all default transition targets. - targets.unite(defaultTransition->targetStates().toSet()); + const auto &targetStates = defaultTransition->targetStates(); + targets.unite(QSet(targetStates.constBegin(), targetStates.constEnd())); } else { // Woops, we found a history state without a default state. That's not valid! QStateMachinePrivate *m = QStateMachinePrivate::get(historyState->machine()); @@ -384,7 +385,7 @@ static QList getEffectiveTargetStates(QAbstractTransition *tra } } - targetsList = targets.toList(); + targetsList = targets.values(); cache->insert(transition, targetsList); return targetsList; } @@ -740,7 +741,7 @@ QList QStateMachinePrivate::computeExitSet(const QList statesToExit_sorted = computeExitSet_Unordered(enabledTransitions, cache).toList(); + QList statesToExit_sorted = computeExitSet_Unordered(enabledTransitions, cache).values(); std::sort(statesToExit_sorted.begin(), statesToExit_sorted.end(), stateExitLessThan); return statesToExit_sorted; } @@ -777,7 +778,7 @@ QSet QStateMachinePrivate::computeExitSet_Unordered(QAbstractTr // makes the state machine invalid. if (error == QStateMachine::NoError) setError(QStateMachine::NoCommonAncestorForTransitionError, t->sourceState()); - QList lst = pendingErrorStates.toList(); + QList lst = pendingErrorStates.values(); lst.prepend(t->sourceState()); domain = findLCCA(lst); @@ -879,7 +880,7 @@ QList QStateMachinePrivate::computeEntrySet(const QList statesToEnter_sorted = statesToEnter.toList(); + QList statesToEnter_sorted = statesToEnter.values(); std::sort(statesToEnter_sorted.begin(), statesToEnter_sorted.end(), stateEntryLessThan); return statesToEnter_sorted; } -- cgit v1.2.3