Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef QXTSPANSLIDER_P_H
00026 #define QXTSPANSLIDER_P_H
00027
00028 #include <QStyle>
00029 #include <QObject>
00030 #include "qxtspanslider.h"
00031 #include "qxtpimpl.h"
00032
00033 QT_FORWARD_DECLARE_CLASS(QStylePainter)
00034 QT_FORWARD_DECLARE_CLASS(QStyleOptionSlider)
00035
00036 class QxtSpanSliderPrivate : public QObject, public QxtPrivate<QxtSpanSlider>
00037 {
00038 Q_OBJECT
00039
00040 public:
00041 QXT_DECLARE_PUBLIC(QxtSpanSlider);
00042
00043 enum SpanHandle
00044 {
00045 NoHandle,
00046 LowerHandle,
00047 UpperHandle
00048 };
00049
00050 QxtSpanSliderPrivate();
00051 void initStyleOption(QStyleOptionSlider* option, SpanHandle handle = UpperHandle) const;
00052 int pick(const QPoint& pt) const
00053 {
00054 return qxt_p().orientation() == Qt::Horizontal ? pt.x() : pt.y();
00055 }
00056 int pixelPosToRangeValue(int pos) const;
00057 void handleMousePress(const QPoint& pos, QStyle::SubControl& control, int value, SpanHandle handle);
00058 void drawHandle(QStylePainter* painter, SpanHandle handle) const;
00059 void setupPainter(QPainter* painter, Qt::Orientation orientation, qreal x1, qreal y1, qreal x2, qreal y2) const;
00060 void drawSpan(QStylePainter* painter, const QRect& rect) const;
00061 void triggerAction(QAbstractSlider::SliderAction action, bool main);
00062 void swapControls();
00063
00064 int lower;
00065 int upper;
00066 int lowerPos;
00067 int upperPos;
00068 int offset;
00069 int position;
00070 SpanHandle lastPressed;
00071 SpanHandle mainControl;
00072 QStyle::SubControl lowerPressed;
00073 QStyle::SubControl upperPressed;
00074 QxtSpanSlider::HandleMovementMode movement;
00075 bool firstMovement;
00076 bool blockTracking;
00077
00078 public Q_SLOTS:
00079 void updateRange(int min, int max);
00080 void movePressedHandle();
00081 };
00082
00083 #endif // QXTSPANSLIDER_P_H