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

Method stateAdded

plugins/statemachineviewer/statemachineviewerwidget.cpp:319–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317}
318
319void StateMachineViewerWidget::stateAdded(const StateId stateId, const StateId parentId,
320 const bool hasChildren, const QString &label,
321 const StateType type, const bool connectToInitial)
322{
323 Q_UNUSED(hasChildren);
324 IF_DEBUG(qDebug() << "stateAdded" << stateId << parentId << label << type);
325
326 if (m_idToStateMap.contains(stateId))
327 return;
328
329 KDSME::State *parentState = m_idToStateMap.value(parentId);
330 KDSME::State *state = nullptr;
331 if (type == StateMachineState)
332 state = m_machine = new KDSME::StateMachine;
333 else if (type == GammaRay::FinalState)
334 state = new KDSME::FinalState(parentState);
335 else if (type == GammaRay::ShallowHistoryState)
336 state = new KDSME::HistoryState(KDSME::HistoryState::ShallowHistory, parentState);
337 else if (type == GammaRay::DeepHistoryState)
338 state = new KDSME::HistoryState(KDSME::HistoryState::DeepHistory, parentState);
339 else
340 state = new KDSME::State(parentState);
341
342 if (connectToInitial && parentState) {
343 KDSME::State *initialState = new KDSME::PseudoState(KDSME::PseudoState::InitialState,
344 parentState);
345 initialState->setFlags(KDSME::Element::ElementIsSelectable);
346 KDSME::Transition *transition = new KDSME::Transition(initialState);
347 transition->setTargetState(state);
348 transition->setFlags(KDSME::Element::ElementIsSelectable);
349 }
350
351 Q_ASSERT(state);
352 state->setLabel(label);
353 state->setInternalId(stateId);
354 state->setFlags(KDSME::Element::ElementIsSelectable);
355 m_idToStateMap[stateId] = state;
356}
357
358void StateMachineViewerWidget::transitionAdded(const TransitionId transitionId,
359 const StateId sourceId, const StateId targetId,

Callers

nothing calls this directly

Calls 2

setLabelMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected