2 #include <score/graphics/DefaultGraphicsSliderImpl.hpp>
3 #include <score/graphics/GraphicWidgets.hpp>
4 #include <score/widgets/DoubleSpinBox.hpp>
5 #include <score/widgets/SignalUtils.hpp>
7 #include <QGraphicsProxyWidget>
12 QGraphicsSliderBase<T>::QGraphicsSliderBase(QGraphicsItem* parent)
13 : QGraphicsItem{parent}
14 , impl{new RightClickImpl}
16 this->setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton);
20 QGraphicsSliderBase<T>::~QGraphicsSliderBase()
22 if(this->impl->spinbox || this->impl->spinboxProxy)
23 delete this->impl->spinboxProxy;
28 QRectF QGraphicsSliderBase<T>::boundingRect()
const
34 bool QGraphicsSliderBase<T>::isInHandle(QPointF p)
36 return m_rect.contains(p);
40 double QGraphicsSliderBase<T>::getHandleX()
const
42 return sliderRect().width() *
static_cast<const T&
>(*this).m_value;
46 double QGraphicsSliderBase<T>::getExecHandleX()
const
48 return sliderRect().width() *
static_cast<const T&
>(*this).m_execValue;
52 QRectF QGraphicsSliderBase<T>::sliderRect()
const
54 return QRectF{0, 0, m_rect.width(), 8};
58 QRectF QGraphicsSliderBase<T>::handleRect()
const
60 auto r = sliderRect();
61 r.setWidth(std::max(0.,
static_cast<const T&
>(*this).getHandleX()));
65 QRectF QGraphicsSliderBase<T>::execHandleRect()
const
67 return {0, 6,
static_cast<const T&
>(*this).getExecHandleX(), 2};
71 void QGraphicsSliderBase<T>::setRect(
const QRectF& r)
73 prepareGeometryChange();
Base toolkit upon which the software is built.
Definition: Application.cpp:90