KRuler Class Reference

[kdeui Index] [kdeui Hierarchy] [Headers]


A ruler widget More...

#include <kruler.h>

Inherits: QFrame (qt)

Public Members

Public Slots

Protected Members

Private Members


Detailed Description

The vertical ruler looks similar to this:

    meters                       inches

------ <----end mark-----> ------ -- - -- <---little mark---> -- -- - -- --- --- <---medium mark - -- -- -- tiny mark----> - -- ---- -- - ---- <-----big mark -- -- - |>-- <--ruler pointer--> |>--

To receive mouse clicks or mouse moves, the class has to be overloaded.

For performance reasons, the public methods doesn't call repaint(), than update except the public slot methods as described. so 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 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.


enum direction ( horizontal, vertical ) [public]

direction of the ruler. Has to be defined when constructing the widget. see KRuler();

void setMinValue(int) [public]

minimum value reachable, default: 0calls update(), so the widget is painted after leaving the main event loop

inline int getMinValue() const [public]

returns the minimal value of the ruler pointer

void setMaxValue(int) [public]

maximum value of the ruler pointer, default: 100 .calls update(), so the widget is painted after leaving the main event loop

inline int getMaxValue() const [public]

returns the maximal value of the ruler pointer.

void setRange(int min, int max) [public]

sets minimal and maxmal values of the ruler pointer.calls update(), so the widget is painted after leaving to the main event loop.

void setValue(int) [public]

set the value of the ruler pointer,the value is shown with ruler pointer painted. calls update(), the widget is painted after leaving to the main event loop.

void setTinyMarkDistance(int) [public]

distance of tiny marks.mostly used in inch system with distance of 1.

void setLittleMarkDistance(int) [public]

set the paint distance of the little marks.value is 1 in metric system and 2 in inch system.

void setMediumMarkDistance(int) [public]

set the paint distance of the medium marks.for inch styles it is twice the little mark distance, for metric styles it is five times.

void setBigMarkDistance(int) [public]

set the paint distance of the big marks.for inch or metric styles it is twice the medium mark distance.

void setValuePerLittleMark(int) [public]

sets the value that is shown per little mark.for metric systems this is 1 per mark. Note: If you set the value for little marks the values for medium and big marks are updated accordingly in respect to

void setValuePerMediumMark(int) [public]

sets the value that is shown per little mark.for metric systems this is 5 display of little marks is disabled,

void setValuePerBigMark(int) [public]

sets the value that is shown per little mark.for metric systems this is 1 display of little and medium marks marks is disabled,

void showLittleMarkLabel(bool) [public]

paint number values of the little marks.

void showMediumMarkLabel(bool) [public]

paint number values of the medium marks.

void showBigMarkLabel(bool) [public]

paint number values of the big marks.

void showEndLabel(bool) [public]

paint number values of the little marks.

void setEndLabel(const char *) [public]

label which is drawn at the beginning of the visible part

void setRulerStyle(metric_style) [public]

convenience method:

void setRulerStyle(paint_style) [public]

currently not implemented

inline paint_style getPaintRulerStyle() const [public]

currently not implemented

void setTickStyle(paint_style) [public]

currently not implemented

inline paint_style getTickStyle() const [public]

currently not implemented

void setPixelPerMark(double) [public]

Set the amount of pixel between two base marks.Calling this method your are able to stretch or shrink your ruler.

For pixel display the value is 10.0 marks per pixel ;-) for inches it is 9.0, and for centimetres ~2,835 -> 3.0 . If you like to magnify your part of display, you have to adjust HERE your markdistance. Notice: the floatingpoint type is only supported to give the possibility of having some floatingpoint values. It should be used with care, using values below 10.0 shows visible jumps of markpositions (e.g. 2.345). Using whole numbers is highly recommended. To use int values use setPixelPerMark((int)your_int_value); default: 1 mark per 10 pixels

void slideup(int count = 1) [public]

the ruler may slide up and down "count" pixelsthis doesn't affect the position of the ruler pointer,

void setOffset(int) [public]

set ruler slide to "offset" from beginning.

void slotNewValue(int) [public slot]

sets the pointer to a new position.the offset is NOT updated.

void slotNewOffset(int) [public slot]

sets the ruler marks to a new position.the pointer is NOT updated.


  • Author: Jörg Habenicht
  • Documentation generated by root@darkstar.lst.de on Wed Sep 8 17:38:27 CEST 1999
Kdoc