src/RangedSlider.h

changeset 97
8283bbf95806
parent 96
c36fef8bb088
child 99
053c0578cf58
equal deleted inserted replaced
96:c36fef8bb088 97:8283bbf95806
46 46
47 double value() const { return _val; } 47 double value() const { return _val; }
48 48
49 //! \brief Set the background brush for the widget. 49 //! \brief Set the background brush for the widget.
50 void setBackgroundBrush( QBrush const& brush ); 50 void setBackgroundBrush( QBrush const& brush );
51 //! \brief Set the brush for the preffered range.
52 void setPreferredRangeBrush( QBrush const& brush );
53 //! \brief Set the pen for the preferred range
54 void setPreferredRangePen( QPen const& pen );
55 //! \brief Set the brush for the marker. 51 //! \brief Set the brush for the marker.
56 void setMarkerBrush( QBrush const& brush ); 52 void setMarkerBrush( QBrush const& brush );
57 //! \brief Set the text displayed above the marker. 53 //! \brief Set the text displayed above the marker.
58 void setMarkerText( QString const& text ); 54 void setMarkerText( QString const& text );
59 //! \brief If true, the marker text will always be updated to the value given by \c setValue(). 55 //! \brief If true, the marker text will always be updated to the value given by \c setValue().
60 void setMarkerTextIsValue(bool val); 56 void setMarkerTextIsValue(bool val);
61
62 /*!
63 * \brief Set the tick mark intervals.
64 *
65 * If either parameter is <= 0, then the tick marks are not drawn.
66 *
67 * \param primaryInterval How often to draw big tick marks.
68 * \param secondaryTicks Number of secondary ticks per primary tick.
69 */
70 void setTickMarks( double primaryInterval, int secondaryTicks = 1 );
71 57
72 //! \brief Set the \c precision for displaying values. 58 //! \brief Set the \c precision for displaying values.
73 void setPrecision(int precision); 59 void setPrecision(int precision);
74 60
75 //! \brief Reimplemented from QWidget. 61 //! \brief Reimplemented from QWidget.
76 virtual QSize sizeHint() const; 62 virtual QSize sizeHint() const;
77 63
78 public slots: 64 public slots:
79 65 /**
80 //! \brief Set the \c value for the indicator. 66 * @brief Set the value for the indicator.
67 */
81 void setValue(double value); 68 void setValue(double value);
82 69
83 /*! 70 /**
84 * \brief Set the range of values considered to be *best* 71 * @brief Set the range of values considered to be *best* and calculate
72 * the real widget display.
85 * 73 *
86 * \param range \c range.first and \c range.second are the min and max 74 * @param range range.first and range.second are the min and max
87 * values for the preferred range resp.
88 */
89 void setPreferredRange(QPair<double,double> range);
90
91 /*!
92 * \brief Set the range of values that the widget displays
93 *
94 * \param range \c range.first and \c range.second are the min and max
95 * values for the preferred range resp. 75 * values for the preferred range resp.
96 */ 76 */
97 void setRange(QPair<double,double> range); 77 void setRange(QPair<double,double> range);
98 78
99 //! \brief Convenience method for setting the widget range 79 /**
80 * @brief Convenience method for setting the widget range
81 */
100 void setRange( double min, double max ); 82 void setRange( double min, double max );
101
102 //! \brief Convenience method for setting the preferred range
103 // Note that this is completely unrelated to "preferred size".
104 void setPreferredRange( double min, double max );
105 83
106 protected: 84 protected:
107 //! \brief Reimplemented from QWidget. 85 //! \brief Reimplemented from QWidget.
108 virtual void paintEvent(QPaintEvent* event); 86 virtual void paintEvent(QPaintEvent* event);
109 //! \brief Reimplemented from QWidget for popup on mouseover. 87 //! \brief Reimplemented from QWidget for popup on mouseover.
136 */ 114 */
137 double _prefMax; 115 double _prefMax;
138 double _val; 116 double _val;
139 QString _markerText; 117 QString _markerText;
140 int _prec; 118 int _prec;
141 double _tickInterval;
142 int _secondaryTicks;
143 QString _tooltipText; 119 QString _tooltipText;
144 QBrush _bgBrush; 120 QBrush _bgBrush;
145 QBrush _prefRangeBrush; 121 QBrush _prefRangeBrush;
146 QPen _prefRangePen; 122 QPen _prefRangePen;
147 QBrush _markerBrush; 123 QBrush _markerBrush;

mercurial