Skip to content

Commit

Permalink
[core] Add missing file
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Jul 28, 2024
1 parent a1e35e8 commit dc6c9ac
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/lib/score/graphics/DefaultControlImpl.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#pragma once
#include <QGraphicsItem>
#include <QGraphicsScene>
#include <QPointer>
#include <QTimer>

namespace score
{
struct DefaultControlImpl
{
static void editWidgetInContextMenu(
auto& self, QGraphicsScene* scene, QGraphicsItem* obj, double v)
{
self.m_value = self.unmap(v);

QPointer p{&self};
if constexpr(requires { self.m_noValueChangeOnMove; })
{
if(!self.m_noValueChangeOnMove)
self.sliderMoved();
}
else
{
self.sliderMoved();
}

if(p)
{
self.update();
}
else
{
QTimer::singleShot(0, &self, [scene, obj] {
scene->removeItem(obj);
delete obj;
});
}
}
};
}

0 comments on commit dc6c9ac

Please sign in to comment.