MCPcopy Create free account
hub / github.com/KDAB/GammaRay / addState

Method addState

plugins/statemachineviewer/statemachineviewerserver.cpp:249–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247}
248
249void StateMachineViewerServer::addState(State state)
250{
251 if (!selectedStateMachine()->stateValid(state))
252 return;
253
254 if (!mayAddState(state))
255 return;
256
257 Q_ASSERT(!m_recursionGuard.contains(state));
258 m_recursionGuard.append(state);
259
260 State parentState = selectedStateMachine()->parentState(state);
261 addState(parentState); // be sure that parent is added first
262
263 const bool hasChildren = !selectedStateMachine()->stateChildren(state).isEmpty();
264 const QString &label = selectedStateMachine()->stateLabel(state);
265 // add a connection from parent state to initial state if
266 // parent state is valid and parent state has an initial state
267 const bool connectToInitial = parentState && selectedStateMachine()->isInitialState(state);
268 StateType type = selectedStateMachine()->stateType(state);
269
270 emit stateAdded(StateId(state), StateId(parentState),
271 hasChildren, label, type, connectToInitial);
272
273 // add outgoing transitions
274 Q_FOREACH (auto transition, selectedStateMachine()->stateTransitions(state)) {
275 addTransition(transition);
276 }
277
278 // add sub-states
279 Q_FOREACH (auto childState, selectedStateMachine()->stateChildren(state)) {
280 addState(childState);
281 }
282}
283
284void StateMachineViewerServer::addTransition(Transition transition)
285{

Callers

nothing calls this directly

Calls 9

StateIdClass · 0.85
appendMethod · 0.80
stateValidMethod · 0.45
parentStateMethod · 0.45
isEmptyMethod · 0.45
stateChildrenMethod · 0.45
stateLabelMethod · 0.45
isInitialStateMethod · 0.45
stateTypeMethod · 0.45

Tested by

no test coverage detected