21 bool eventTest(QEvent* e)
override
25 static const constexpr QEvent::Type types[] = {
26 QEvent::Type(QEvent::User + MoveOnNothing_Event::user_type),
27 QEvent::Type(QEvent::User + MoveOnState_Event::user_type),
28 QEvent::Type(QEvent::User + MoveOnEvent_Event::user_type),
29 QEvent::Type(QEvent::User + MoveOnTimeSync_Event::user_type),
30 QEvent::Type(QEvent::User + MoveOnInterval_Event::user_type),
31 QEvent::Type(QEvent::User + MoveOnLeftBrace_Event::user_type),
32 QEvent::Type(QEvent::User + MoveOnRightBrace_Event::user_type),
33 QEvent::Type(QEvent::User + MoveOnSlotHandle_Event::user_type),
36 return find(begin(types), end(types), e->type()) != end(types);
38 void onTransition(QEvent* event)
override { }
44 bool eventTest(QEvent* e)
override
48 static const constexpr QEvent::Type types[] = {
49 QEvent::Type(QEvent::User + ReleaseOnNothing_Event::user_type),
50 QEvent::Type(QEvent::User + ReleaseOnState_Event::user_type),
51 QEvent::Type(QEvent::User + ReleaseOnEvent_Event::user_type),
52 QEvent::Type(QEvent::User + ReleaseOnTimeSync_Event::user_type),
53 QEvent::Type(QEvent::User + ReleaseOnInterval_Event::user_type),
54 QEvent::Type(QEvent::User + ReleaseOnLeftBrace_Event::user_type),
55 QEvent::Type(QEvent::User + ReleaseOnRightBrace_Event::user_type),
56 QEvent::Type(QEvent::User + ReleaseOnSlotHandle_Event::user_type),
59 return find(begin(types), end(types), e->type()) != end(types);
61 void onTransition(QEvent* event)
override { }
71 , m_ongoingDispatcher{stack}
74 auto press =
new QState{
this};
75 this->setInitialState(press);
76 auto move =
new QState{
this};
77 auto release =
new QFinalState{
this};
79 score::make_transition<Scenario::MoveOnAnything_SlotTransition>(press, move);
80 score::make_transition<Scenario::MoveOnAnything_SlotTransition>(move, move);
81 score::make_transition<Scenario::ReleaseOnAnything_SlotTransition>(press, release);
82 score::make_transition<Scenario::ReleaseOnAnything_SlotTransition>(move, release);
84 connect(press, &QAbstractState::entered, [
this, &ctx = stack.context()] {
85 m_originalPoint = m_sm.scenePoint;
87 const IntervalModel& cst = this->currentSlot.interval.find(ctx);
88 m_originalHeight = cst.getSlotHeight(this->currentSlot);
91 connect(move, &QAbstractState::entered, [
this, &ctx = stack.context()] {
93 20.0, m_originalHeight + (m_sm.scenePoint.y() - m_originalPoint.y()));
95 const IntervalModel& cst = this->currentSlot.interval.find(ctx);
96 m_ongoingDispatcher.submit(cst, this->currentSlot, val);
99 connect(release, &QAbstractState::entered, [
this, &ctx = stack.context()] {
100 m_ongoingDispatcher.commit();
102 IntervalModel& cst = this->currentSlot.interval.find(ctx);
103 cst.heightFinishedChanging();
110 const ToolPalette_T& m_sm;