#ifndef SLIDER_H #define SLIDER_H #include #include class Slider : public QWidget { Q_OBJECT bool isSliderDown_; int sliderPosition_; int value_; int minimum_; int maximum_; QPixmap groove; QPixmap sub; QPixmap handle; int grooveMin; int grooveMax; QPoint groovePoint; QPoint subPoint; bool subVisible_; public: explicit Slider(QWidget *parent = 0); void setSubPixmap(const QPixmap &pixmap); void setSubPixmap(const QString &fileName); void setSubVisible(bool visible); void setRange(int min, int max); void setMinimum(int min); void setMaximum(int max); int value(); int minimum(); int maximum(); bool isSliderDown(); int sliderPosition(); void setSliderPosition(int value); QList ticks; QList bigTicks; int tickInterval; int bigTickInterval; protected: virtual void mouseMoveEvent(QMouseEvent *event); virtual void mousePressEvent(QMouseEvent *event); virtual void mouseReleaseEvent(QMouseEvent *event); virtual void paintEvent(QPaintEvent *event); virtual void resizeEvent(QResizeEvent *event); private: int calcSliderPosition(int mouseX); int calcSubLength(int value); void updatePixmapPosition(); signals: void sliderMoved(int value); void valueChanged(int value); void sliderPressed(); void sliderReleased(); public slots: void setValue(int value); }; #endif // SLIDER_H