DefaultControlImpl.hpp
1 #pragma once
2 #include <QGraphicsItem>
3 #include <QGraphicsScene>
4 #include <QPointer>
5 #include <QTimer>
6 
7 namespace score
8 {
10 {
11  static void editWidgetInContextMenu(
12  auto& self, QGraphicsScene* scene, QGraphicsItem* obj, double v)
13  {
14  self.m_value = self.unmap(v);
15 
16  QPointer p{&self};
17  if constexpr(requires { self.m_noValueChangeOnMove; })
18  {
19  if(!self.m_noValueChangeOnMove)
20  self.sliderMoved();
21  }
22  else
23  {
24  self.sliderMoved();
25  }
26 
27  if(p)
28  {
29  self.update();
30  }
31  else
32  {
33  QTimer::singleShot(0, &self, [scene, obj] {
34  scene->removeItem(obj);
35  delete obj;
36  });
37  }
38  }
39 };
40 }
Base toolkit upon which the software is built.
Definition: Application.cpp:90
Definition: DefaultControlImpl.hpp:10