21 QPointF m_initialPoint;
23 const ToolPalette_T& m_parentSM;
24 View_T& m_scenarioView;
31 , m_parentSM{parentSM}
32 , m_scenarioView{scenarioview}
36 const QPointF& initialPoint()
const {
return m_initialPoint; }
37 const QPointF& movePoint()
const {
return m_movePoint; }
39 void on_pressAreaSelection()
override { m_initialPoint = m_parentSM.scenePoint; }
41 void on_moveAreaSelection()
override
43 m_movePoint = m_parentSM.scenePoint;
45 = QRectF{m_scenarioView.mapFromScene(m_initialPoint), m_scenarioView.mapFromScene(m_movePoint)}
47 m_scenarioView.setSelectionArea(area);
48 setSelectionArea(area);
51 void on_releaseAreaSelection()
override
53 if(m_parentSM.scenePoint == m_initialPoint)
55 dispatcher.deselect();
56 dispatcher.select(m_parentSM.model());
59 m_scenarioView.setSelectionArea(QRectF{});
62 void on_deselect()
override
64 dispatcher.deselect();
65 m_scenarioView.setSelectionArea(QRectF{});
68 void setSelectionArea(
const QRectF& area)
73 auto& presenter = m_parentSM.presenter();
74 auto& model = m_parentSM.model();
76 for(
const auto& elt : presenter.getIntervals())
78 if(area.intersects(elt.view()->boundingRect().translated(elt.view()->pos())))
80 sel.append(elt.model());
84 if constexpr(std::is_same_v<
85 std::remove_const_t<std::remove_reference_t<
decltype(presenter)>>,
88 for(
const auto& elt : presenter.getGraphIntervals())
90 if(area.intersects(elt.boundingRect().translated(elt.pos())))
92 sel.append(elt.model());
97 for(
const auto& elt : presenter.getTimeSyncs())
99 if(area.intersects(elt.view()->boundingRect().translated(elt.view()->pos())))
101 sel.append(elt.model());
105 && area.intersects(elt.trigger().boundingRect().translated(elt.view()->pos())))
107 sel.append(elt.model());
110 for(
const auto& elt : presenter.getEvents())
112 if(area.intersects(elt.view()->boundingRect().translated(elt.view()->pos())))
114 sel.append(elt.model());
117 elt.view()->conditionItem().isVisible()
119 elt.view()->conditionItem().boundingRect().translated(elt.view()->pos())))
121 sel.append(elt.model());
124 for(
const auto& elt : presenter.getStates())
126 auto& m = elt.model();
127 if(area.intersects(elt.view()->boundingRect().translated(elt.view()->pos())))
129 doStateSelection(sel, m, model);
134 filterSelections(sel, m_parentSM.model().selectedChildren(), multiSelection()));