KRuler
#include <KRuler>
Public Types | |
enum | MetricStyle { Custom = 0 , Pixel , Inch , Millimetres , Centimetres , Metres } |
Public Types inherited from QAbstractSlider | |
enum | SliderAction |
enum | SliderChange |
Public Types inherited from QWidget | |
enum | RenderFlag |
Public Types inherited from QPaintDevice | |
enum | PaintDeviceMetric |
Public Slots | |
void | slotEndOffset (int) |
void | slotNewOffset (int) |
void | slotNewValue (int) |
Detailed Description
A ruler widget.
The vertical ruler looks similar to this:
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.
A ruler widget.
Member Enumeration Documentation
◆ MetricStyle
Property Documentation
◆ bigMarkDistance
◆ endLabel
◆ endOffset
◆ length
◆ lengthFixed
◆ littleMarkDistance
◆ mediumMarkDistance
◆ offset
◆ pixelPerMark
◆ showBigMarks
◆ showEndLabel
◆ showLittleMarks
◆ showMediumMarks
◆ showPointer
◆ showTinyMarks
◆ tinyMarkDistance
Constructor & Destructor Documentation
◆ KRuler() [1/3]
Constructs a horizontal ruler.
Definition at line 98 of file kruler.cpp.
◆ KRuler() [2/3]
|
explicit |
Constructs a ruler with orientation orient
.
parent
and f
are passed to QFrame. The default look is a raised widget but may be changed with the inherited QFrame methods.
- Parameters
-
orient Orientation of the ruler. parent Will be handed over to QFrame. f Will be handed over to QFrame.
Definition at line 109 of file kruler.cpp.
◆ KRuler() [3/3]
KRuler::KRuler | ( | Qt::Orientation | orient, |
int | widgetWidth, | ||
QWidget * | parent = nullptr, | ||
Qt::WindowFlags | f = Qt::WindowFlags() ) |
Constructs a ruler with orientation orient
and initial width widgetWidth
.
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.
parent
andf
are passed to QFrame.
- Parameters
-
orient Orientation of the ruler. widgetWidth Fixed width of the widget. parent Will be handed over to QFrame. f Will be handed over to QFrame.
Definition at line 125 of file kruler.cpp.
◆ ~KRuler()
|
overridedefault |
Destructor.
Member Function Documentation
◆ bigMarkDistance()
int KRuler::bigMarkDistance | ( | ) | const |
Returns the distance between big marks.
Definition at line 211 of file kruler.cpp.
◆ endLabel()
QString KRuler::endLabel | ( | ) | const |
Definition at line 321 of file kruler.cpp.
◆ endOffset()
int KRuler::endOffset | ( | ) | const |
Definition at line 460 of file kruler.cpp.
◆ length()
int KRuler::length | ( | ) | const |
Definition at line 428 of file kruler.cpp.
◆ lengthFixed()
bool KRuler::lengthFixed | ( | ) | const |
Definition at line 441 of file kruler.cpp.
◆ littleMarkDistance()
int KRuler::littleMarkDistance | ( | ) | const |
Returns the distance between little marks.
Definition at line 185 of file kruler.cpp.
◆ mediumMarkDistance()
int KRuler::mediumMarkDistance | ( | ) | const |
Definition at line 198 of file kruler.cpp.
◆ offset()
int KRuler::offset | ( | ) | const |
Returns the current ruler offset.
Definition at line 455 of file kruler.cpp.
◆ paintEvent()
|
overrideprotectedvirtual |
Reimplemented from QWidget.
Definition at line 531 of file kruler.cpp.
◆ pixelPerMark()
double KRuler::pixelPerMark | ( | ) | const |
Returns the number of pixels between two base marks.
Definition at line 409 of file kruler.cpp.
◆ setBigMarkDistance()
void KRuler::setBigMarkDistance | ( | int | dist | ) |
Sets distance between big marks.
For English (inches) or metric styles it is twice the medium mark distance.
Definition at line 203 of file kruler.cpp.
◆ setEndLabel()
Sets the label this is drawn at the beginning of the visible part of the ruler to label
.
Definition at line 307 of file kruler.cpp.
◆ setLength()
void KRuler::setLength | ( | int | length | ) |
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 414 of file kruler.cpp.
◆ setLengthFixed()
void KRuler::setLengthFixed | ( | bool | fix | ) |
Locks the length of the ruler, i.e.
the difference between the two end marks doesn't change when the widget is resized.
- Parameters
-
fix fixes the length, if true
Definition at line 436 of file kruler.cpp.
◆ setLittleMarkDistance()
void KRuler::setLittleMarkDistance | ( | int | dist | ) |
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 177 of file kruler.cpp.
◆ setMediumMarkDistance()
void KRuler::setMediumMarkDistance | ( | int | dist | ) |
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 190 of file kruler.cpp.
◆ setOffset()
void KRuler::setOffset | ( | int | offset | ) |
Sets the ruler slide offset.
This is like slideup() or slidedown() with an absolute offset from the start of the ruler.
- Parameters
-
offset Number of pixel to move the ruler up or left from the beginning
Definition at line 446 of file kruler.cpp.
◆ setPixelPerMark()
void KRuler::setPixelPerMark | ( | double | rate | ) |
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 here
. Notice: The double type is only supported to give the possibility of having some double 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
Definition at line 402 of file kruler.cpp.
◆ setRulerMetricStyle()
void KRuler::setRulerMetricStyle | ( | KRuler::MetricStyle | style | ) |
Sets up the necessary tasks for the provided styles.
A convenience method.
Definition at line 326 of file kruler.cpp.
◆ setShowBigMarks()
void KRuler::setShowBigMarks | ( | bool | show | ) |
Shows/hides big marks.
Definition at line 255 of file kruler.cpp.
◆ setShowEndLabel()
void KRuler::setShowEndLabel | ( | bool | show | ) |
Show/hide number values of the end marks.
Default is false
.
Definition at line 294 of file kruler.cpp.
◆ setShowEndMarks()
void KRuler::setShowEndMarks | ( | bool | show | ) |
Shows/hides end marks.
Definition at line 268 of file kruler.cpp.
◆ setShowLittleMarks()
void KRuler::setShowLittleMarks | ( | bool | show | ) |
Shows/hides little marks.
Definition at line 229 of file kruler.cpp.
◆ setShowMediumMarks()
void KRuler::setShowMediumMarks | ( | bool | show | ) |
Shows/hides medium marks.
Definition at line 242 of file kruler.cpp.
◆ setShowPointer()
void KRuler::setShowPointer | ( | bool | show | ) |
Shows/hides the pointer.
Definition at line 281 of file kruler.cpp.
◆ setShowTinyMarks()
void KRuler::setShowTinyMarks | ( | bool | show | ) |
Shows/hides tiny marks.
Definition at line 216 of file kruler.cpp.
◆ setTinyMarkDistance()
void KRuler::setTinyMarkDistance | ( | int | dist | ) |
Sets the distance between tiny marks.
This is mostly used in the English system (inches) with distance of 1.
Definition at line 164 of file kruler.cpp.
◆ showBigMarks()
bool KRuler::showBigMarks | ( | ) | const |
Definition at line 263 of file kruler.cpp.
◆ showEndLabel()
bool KRuler::showEndLabel | ( | ) | const |
Definition at line 302 of file kruler.cpp.
◆ showEndMarks()
bool KRuler::showEndMarks | ( | ) | const |
Definition at line 276 of file kruler.cpp.
◆ showLittleMarks()
bool KRuler::showLittleMarks | ( | ) | const |
Definition at line 237 of file kruler.cpp.
◆ showMediumMarks()
bool KRuler::showMediumMarks | ( | ) | const |
Definition at line 250 of file kruler.cpp.
◆ showPointer()
bool KRuler::showPointer | ( | ) | const |
Definition at line 289 of file kruler.cpp.
◆ showTinyMarks()
bool KRuler::showTinyMarks | ( | ) | const |
Definition at line 224 of file kruler.cpp.
◆ slideDown()
void KRuler::slideDown | ( | int | count = 1 | ) |
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.
- Parameters
-
count Number of pixel moving up or left relative to the previous position
Definition at line 476 of file kruler.cpp.
◆ slideUp()
void KRuler::slideUp | ( | int | count = 1 | ) |
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.
- Parameters
-
count Number of pixel moving up or left relative to the previous position
Definition at line 468 of file kruler.cpp.
◆ slotEndOffset
|
slot |
Definition at line 517 of file kruler.cpp.
◆ slotNewOffset
|
slot |
Sets the ruler marks to a new position.
The pointer is NOT updated. QWidget::repaint() is called afterwards.
Definition at line 508 of file kruler.cpp.
◆ slotNewValue
|
slot |
Sets the pointer to a new position.
The offset is NOT updated. QWidget::repaint() is called afterwards.
Definition at line 484 of file kruler.cpp.
◆ tinyMarkDistance()
int KRuler::tinyMarkDistance | ( | ) | const |
Returns the distance between tiny marks.
Definition at line 172 of file kruler.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:43 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.