10#include <QStyleOption>
13#include <dtkwidget_global.h>
16DWIDGET_BEGIN_NAMESPACE
19class LIBDTKWIDGETSHARED_EXPORT
DSlider :
public QWidget,
public DTK_CORE_NAMESPACE::DObject
29 DSlider(Qt::Orientation orientation = Qt::Horizontal, QWidget *parent =
nullptr);
31 Qt::Orientation orientation()
const;
35 void setLeftIcon(
const QIcon &left);
36 void setRightIcon(
const QIcon &right);
38 void setIconSize(
const QSize &size);
40 void setMinimum(
int min);
43 void setValue(
int value);
46 void setPageStep(
int pageStep);
49 void setMaximum(
int max);
52 void setLeftTicks(
const QStringList &info);
53 void setRightTicks(
const QStringList &info);
55 void setAboveTicks(
const QStringList &info);
56 void setBelowTicks(
const QStringList &info);
58 void setMarkPositions(QList<int> list);
60 void setMouseWheelEnabled(
bool enabled);
62 void setTipValue(
const QString &value);
64 QSlider::TickPosition tickPosition()
const;
65 QSize sizeHint()
const override;
67 void setHandleVisible(
bool b);
68 bool handleVisible()
const;
70 void setEnabledAcrossStyle(
bool enabled);
87 bool event(QEvent *event)
override;
88 bool eventFilter(QObject *watched, QEvent *event)
override;
93 SpecialSlider(Qt::Orientation orientation, QWidget *parent =
nullptr) : QSlider(orientation, parent) {
96 void paintEvent(QPaintEvent *ev) {
99 QStyleOptionSlider opt;
100 initStyleOption(&opt);
102 DSlider* dSlider = qobject_cast<DSlider *>(this->parent());
108 opt.subControls = QStyle::SC_SliderGroove | QStyle::SC_SliderHandle;
110 opt.subControls = QStyle::SC_SliderGroove;
112 style()->drawComplexControl(QStyle::CC_Slider, &opt, &p, parentWidget());