Slider.h 971 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef SLIDER_H
  2. #define SLIDER_H
  3. #include <QMap>
  4. #include <QProxyStyle>
  5. #include <QSlider>
  6. #include <QVariant>
  7. class Slider : public QSlider
  8. {
  9. Q_OBJECT
  10. public:
  11. explicit Slider(Qt::Orientation orientation, QWidget *parent = nullptr);
  12. signals:
  13. void clicked(int);
  14. // QWidget interface
  15. protected:
  16. void mousePressEvent(QMouseEvent *event) override;
  17. };
  18. /// Hollow handle style
  19. class HollowHandleStyle : public QProxyStyle
  20. {
  21. Q_OBJECT
  22. public:
  23. HollowHandleStyle(const QMap<QString, QVariant> &cfg = QMap<QString, QVariant>());
  24. // QStyle interface
  25. public:
  26. void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,
  27. const QWidget *widget) const override;
  28. QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc,
  29. const QWidget *widget) const override;
  30. private:
  31. QMap<QString, QVariant> config;
  32. };
  33. #endif // SLIDER_H