KRuler Class Reference
A ruler widget. A ruler widget. More...
#include <kruler.h>
Inheritance diagram for KRuler:


Public Types | |
enum | MetricStyle { Custom = 0, Pixel, Inch, Millimetres, Centimetres, Metres } |
Public Slots | |
void | slotNewValue (int) |
void | slotNewOffset (int) |
void | slotEndOffset (int) |
Public Member Functions | |
KRuler (QWidget *parent=0, const char *name=0) | |
KRuler (Orientation orient, QWidget *parent=0, const char *name=0, WFlags f=0) | |
KRuler (Orientation orient, int widgetWidth, QWidget *parent=0, const char *name=0, WFlags f=0) | |
~KRuler () | |
void | setMinValue (int) |
int | minValue () const |
void | setMaxValue (int) |
int | maxValue () const |
void | setRange (int min, int max) |
void | setValue (int) |
int | value () const |
void | setTinyMarkDistance (int) |
int | tinyMarkDistance () const |
void | setLittleMarkDistance (int) |
int | littleMarkDistance () const |
void | setMediumMarkDistance (int) |
int | mediumMarkDistance () const |
void | setBigMarkDistance (int) |
int | bigMarkDistance () const |
void | setShowTinyMarks (bool) |
bool | showTinyMarks () const |
void | setShowLittleMarks (bool) |
bool | showLittleMarks () const |
void | setShowMediumMarks (bool) |
bool | showMediumMarks () const |
void | setShowBigMarks (bool) |
bool | showBigMarks () const |
void | setShowEndMarks (bool) |
bool | showEndMarks () const |
void | setShowPointer (bool) |
bool | showPointer () const |
void | setValuePerLittleMark (int) KDE_DEPRECATED |
void | setValuePerMediumMark (int) KDE_DEPRECATED |
void | setValuePerBigMark (int) KDE_DEPRECATED |
void | setShowEndLabel (bool) |
bool | showEndLabel () const |
void | setEndLabel (const QString &) |
QString | endLabel () const |
void | setRulerMetricStyle (KRuler::MetricStyle) |
void | setPixelPerMark (double rate) |
double | pixelPerMark () const |
void | setLength (int) |
int | length () const |
void | setLengthFixed (bool fix) |
bool | lengthFixed () const |
void | slideUp (int count=1) |
void | slideDown (int count=1) |
void | setOffset (int offset) |
int | offset () const |
int | endOffset () const |
Protected Member Functions | |
virtual void | drawContents (QPainter *) |
virtual void | virtual_hook (int id, void *data) |
Properties | |
int | minValue |
int | maxValue |
int | value |
bool | showTinyMarks |
bool | showLittleMarks |
bool | showMediumMarks |
bool | showBigMarks |
bool | showPointer |
bool | showEndLabel |
int | tinyMarkDistance |
int | littleMarkDistance |
int | mediumMarkDistance |
int | bigMarkDistance |
double | pixelPerMark |
bool | lengthFixed |
Detailed Description
A ruler widget. A ruler widget.The vertical ruler looks similar to this:
meters inches ------ <--- end mark ---> ------ -- - -- <---little mark---> -- -- - -- --- --- <---medium mark - -- -- -- tiny mark----> - -- ---- -- - ---- <-----big mark -- -- - |>-- <--ruler pointer--> |>--
There are tiny marks, little marks, medium marks, and big marks along the ruler.
To receive mouse clicks or mouse moves, the class has to be overloaded.
For performance reasons, the public methods don't call QWidget::repaint(). (Slots do, see documentation below.) All the changed settings will be painted once after leaving to the main event loop. For performance painting the slot methods should be used, they do a fast QWidget::repaint() call after changing the values. For setting multiple values like minValue(), maxValue(), offset() etc. using the public methods is recommended so the widget will be painted only once when entering the main event loop.
- Author:
- Jörg Habenicht
Definition at line 71 of file kruler.h.
Member Enumeration Documentation
|
The types of units used.
|
Constructor & Destructor Documentation
|
Constructs a horizontal ruler.
Definition at line 94 of file kruler.cpp. References KRuler(). Referenced by KRuler(). |
|
Constructs a ruler with orientation
Definition at line 104 of file kruler.cpp. References KRuler(). |
|
Constructs a ruler with orientation
The width sets the fixed width of the widget. This is useful if you want to draw the ruler bigger or smaller than the default size. Note: The size of the marks doesn't change.
Definition at line 118 of file kruler.cpp. References KRuler(). |
|
Destructor.
Definition at line 157 of file kruler.cpp. |
Member Function Documentation
|
Sets the minimal value of the ruler pointer (default is 0). This method calls update() so that the widget is painted after leaving to the main event loop. Definition at line 163 of file kruler.cpp. References QFrame::contentsRect(), QRangeControl::maxValue(), QRangeControl::minValue(), setMinValue(), and QRangeControl::setRange(). Referenced by setMinValue(). |
|
Returns the minimal value of the ruler pointer.
|
|
Sets the maximum value of the ruler pointer (default is 100). This method calls update() so that the widget is painted after leaving to the main event loop. Definition at line 172 of file kruler.cpp. References QFrame::contentsRect(), QRangeControl::maxValue(), QRangeControl::minValue(), setMaxValue(), and QRangeControl::setRange(). Referenced by setMaxValue(). |
|
Returns the maximal value of the ruler pointer.
|
|
Sets minimum and maximum values of the ruler pointer. This method calls update() so that the widget is painted after leaving to the main event loop. Definition at line 181 of file kruler.cpp. References QFrame::contentsRect(), QRangeControl::maxValue(), QRangeControl::minValue(), QRangeControl::setRange(), and setRange(). Referenced by setRange(). |
|
Sets the value of the ruler pointer. The value is indicated by painting the ruler pointer at the corresponding position. This method calls update() so that the widget is painted after leaving to the main event loop. Definition at line 190 of file kruler.cpp. References QFrame::contentsRect(), QRangeControl::setValue(), and setValue(). Referenced by setValue(). |
|
Sets the distance between tiny marks. This is mostly used in the English system (inches) with distance of 1. Definition at line 197 of file kruler.cpp. References QFrame::contentsRect(), and setTinyMarkDistance(). Referenced by setRulerMetricStyle(), and setTinyMarkDistance(). |
|
Returns the distance between tiny marks.
|
|
Sets the distance between little marks. The default value is 1 in the metric system and 2 in the English (inches) system. Definition at line 206 of file kruler.cpp. References QFrame::contentsRect(), and setLittleMarkDistance(). Referenced by setLittleMarkDistance(), and setRulerMetricStyle(). |
|
Returns the distance between little marks.
|
|
Sets the distance between medium marks. For English (inches) styles it defaults to twice the little mark distance. For metric styles it defaults to five times the little mark distance. Definition at line 215 of file kruler.cpp. References QFrame::contentsRect(), and setMediumMarkDistance(). Referenced by setMediumMarkDistance(), and setRulerMetricStyle(). |
|
Sets distance between big marks. For English (inches) or metric styles it is twice the medium mark distance. Definition at line 224 of file kruler.cpp. References QFrame::contentsRect(), and setBigMarkDistance(). Referenced by setBigMarkDistance(), and setRulerMetricStyle(). |
|
Returns the distance between big marks.
|
|
Shows/hides tiny marks.
Definition at line 233 of file kruler.cpp. References QFrame::contentsRect(), and setShowTinyMarks(). Referenced by setRulerMetricStyle(), and setShowTinyMarks(). |
|
Shows/hides little marks.
Definition at line 248 of file kruler.cpp. References QFrame::contentsRect(), and setShowLittleMarks(). Referenced by setRulerMetricStyle(), and setShowLittleMarks(). |
|
Shows/hides medium marks.
Definition at line 263 of file kruler.cpp. References QFrame::contentsRect(), and setShowMediumMarks(). Referenced by setRulerMetricStyle(), and setShowMediumMarks(). |
|
Shows/hides big marks.
Definition at line 278 of file kruler.cpp. References QFrame::contentsRect(), and setShowBigMarks(). Referenced by setRulerMetricStyle(), and setShowBigMarks(). |
|
Shows/hides end marks.
Definition at line 294 of file kruler.cpp. References QFrame::contentsRect(), and setShowEndMarks(). Referenced by setRulerMetricStyle(), and setShowEndMarks(). |
|
Shows/hides the pointer.
Definition at line 309 of file kruler.cpp. References QFrame::contentsRect(), and setShowPointer(). Referenced by setShowPointer(). |
|
Definition at line 325 of file kruler.cpp. References QFrame::contentsRect(), and setValuePerLittleMark(). Referenced by setValuePerLittleMark(). |
|
Definition at line 331 of file kruler.cpp. References QFrame::contentsRect(), and setValuePerMediumMark(). Referenced by setValuePerMediumMark(). |
|
Definition at line 337 of file kruler.cpp. References QFrame::contentsRect(), and setValuePerBigMark(). Referenced by setValuePerBigMark(). |
|
Show/hide number values of the end marks.
Default is Definition at line 343 of file kruler.cpp. References QFrame::contentsRect(), and setShowEndLabel(). Referenced by setShowEndLabel(). |
|
Sets the label this is drawn at the beginning of the visible part of the ruler to
Definition at line 360 of file kruler.cpp. References QFrame::contentsRect(), setEndLabel(), QFont::setPointSize(), and QFontMetrics::width(). Referenced by setEndLabel(), and setRulerMetricStyle(). |
|
Sets up the necessary tasks for the provided styles. A convenience method. Definition at line 380 of file kruler.cpp. References QFrame::contentsRect(), setBigMarkDistance(), setEndLabel(), setLittleMarkDistance(), setMediumMarkDistance(), setPixelPerMark(), setRulerMetricStyle(), setShowBigMarks(), setShowEndMarks(), setShowLittleMarks(), setShowMediumMarks(), setShowTinyMarks(), and setTinyMarkDistance(). Referenced by setRulerMetricStyle(). |
|
Sets the number of pixels between two base marks. Calling this method stretches or shrinks your ruler.
For pixel display ( MetricStyle) the value is 10.0 marks per pixel ;-) For English (inches) it is 9.0, and for centimetres ~2.835 -> 3.0 . If you want to magnify your part of display, you have to adjust the mark distance Definition at line 457 of file kruler.cpp. References QFrame::contentsRect(), and setPixelPerMark(). Referenced by setPixelPerMark(), and setRulerMetricStyle(). |
|
Returns the number of pixels between two base marks.
|
|
Sets the length of the ruler, i.e. the difference between the begin mark and the end mark of the ruler. Same as (width() - offset()) when the length is not locked, it gets adjusted with the length of the widget. Definition at line 465 of file kruler.cpp. References QFrame::contentsRect(), and setLength(). Referenced by setLength(). |
|
Locks the length of the ruler, i.e. the difference between the two end marks doesn't change when the widget is resized.
Definition at line 491 of file kruler.cpp. References setLengthFixed(). Referenced by setLengthFixed(). |
|
Sets the number of pixels by which the ruler may slide up or left. The number of pixels moved is realive to the previous position. The Method makes sense for updating a ruler, which is working with a scrollbar. This doesn't affect the position of the ruler pointer. Only the visible part of the ruler is moved.
Definition at line 522 of file kruler.cpp. References QFrame::contentsRect(), and slideUp(). Referenced by slideUp(). |
|
Sets the number of pixels by which the ruler may slide down or right. The number of pixels moved is realive to the previous position. The Method makes sense for updating a ruler, which is working with a scrollbar. This doesn't affect the position of the ruler pointer. Only the visible part of the ruler is moved.
Definition at line 531 of file kruler.cpp. References QFrame::contentsRect(), and slideDown(). Referenced by slideDown(). |
|
Sets the ruler slide offset. This is like slideup() or slidedown() with an absolute offset from the start of the ruler.
Definition at line 503 of file kruler.cpp. References QFrame::contentsRect(), and setOffset(). Referenced by setOffset(). |
|
Returns the current ruler offset.
|
|
Sets the pointer to a new position. The offset is NOT updated. QWidget::repaint() is called afterwards. Definition at line 541 of file kruler.cpp. References QRangeControl::setValue(), slotNewValue(), QRect::unite(), and QRangeControl::value(). Referenced by slotNewValue(). |
|
Sets the ruler marks to a new position. The pointer is NOT updated. QWidget::repaint() is called afterwards. Definition at line 567 of file kruler.cpp. References QFrame::contentsRect(), and slotNewOffset(). Referenced by slotNewOffset(). |
The documentation for this class was generated from the following files: