| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
#ifndef QXTSPANSLIDER_P_H |
| 26 |
#define QXTSPANSLIDER_P_H |
| 27 |
|
| 28 |
#include <QStyle> |
| 29 |
#include <QObject> |
| 30 |
#include "qxtspanslider.h" |
| 31 |
|
| 32 |
QT_FORWARD_DECLARE_CLASS(QStylePainter) |
| 33 |
QT_FORWARD_DECLARE_CLASS(QStyleOptionSlider) |
| 34 |
|
| 35 |
class QxtSpanSliderPrivate : public QObject, public QxtPrivate<QxtSpanSlider> |
| 36 |
{ |
| 37 |
Q_OBJECT |
| 38 |
|
| 39 |
public: |
| 40 |
QXT_DECLARE_PUBLIC(QxtSpanSlider) |
| 41 |
|
| 42 |
QxtSpanSliderPrivate(); |
| 43 |
void initStyleOption(QStyleOptionSlider* option, QxtSpanSlider::SpanHandle handle = QxtSpanSlider::UpperHandle) const; |
| 44 |
int pick(const QPoint& pt) const |
| 45 |
{ |
| 46 |
return qxt_p().orientation() == Qt::Horizontal ? pt.x() : pt.y(); |
| 47 |
} |
| 48 |
int pixelPosToRangeValue(int pos) const; |
| 49 |
void handleMousePress(const QPoint& pos, QStyle::SubControl& control, int value, QxtSpanSlider::SpanHandle handle); |
| 50 |
void drawHandle(QStylePainter* painter, QxtSpanSlider::SpanHandle handle) const; |
| 51 |
void setupPainter(QPainter* painter, Qt::Orientation orientation, qreal x1, qreal y1, qreal x2, qreal y2) const; |
| 52 |
void drawSpan(QStylePainter* painter, const QRect& rect) const; |
| 53 |
void triggerAction(QAbstractSlider::SliderAction action, bool main); |
| 54 |
void swapControls(); |
| 55 |
|
| 56 |
int lower; |
| 57 |
int upper; |
| 58 |
int lowerPos; |
| 59 |
int upperPos; |
| 60 |
int offset; |
| 61 |
int position; |
| 62 |
QxtSpanSlider::SpanHandle lastPressed; |
| 63 |
QxtSpanSlider::SpanHandle mainControl; |
| 64 |
QStyle::SubControl lowerPressed; |
| 65 |
QStyle::SubControl upperPressed; |
| 66 |
QxtSpanSlider::HandleMovementMode movement; |
| 67 |
bool firstMovement; |
| 68 |
bool blockTracking; |
| 69 |
bool showRail; |
| 70 |
|
| 71 |
public Q_SLOTS: |
| 72 |
void updateRange(int min, int max); |
| 73 |
void movePressedHandle(); |
| 74 |
}; |
| 75 |
|
| 76 |
#endif |