|
Krita Source Code Documentation
|
#include <KoRuler.h>
Inheritance diagram for KoRuler:Classes | |
| struct | Tab |
| For paragraphs each tab definition is represented by this struct. More... | |
Public Slots | |
| void | clearHotSpots () |
| void | createGuideToolConnection (KoCanvasBase *canvas) |
| bool | removeHotSpot (int id) |
| void | setActiveRange (qreal start, qreal end) |
| void | setEndIndent (qreal indent) |
| void | setFirstLineIndent (qreal indent) |
| void | setHotSpot (qreal position, int id=-1) |
| void | setOffset (int offset) |
| void | setOverrideActiveRange (qreal start, qreal end) |
| void | setParagraphIndent (qreal indent) |
| void | setRelativeTabs (bool relative) |
| void | setRightToLeft (bool isRightToLeft) |
| void | setRulerLength (qreal length) |
Sets the length of the ruler to length in points (pt) | |
| void | setShowIndents (bool show) |
| void | setShowMousePosition (bool show) |
| void | setShowSelectionBorders (bool show) |
| void | setShowTabs (bool show) |
| void | setUnit (const KoUnit &unit) |
| Set the unit of the ruler. | |
| void | setUnitPixelMultiple2 (bool enabled) |
| bool | showMousePosition () const |
| QList< Tab > | tabs () const |
| void | updateMouseCoordinate (int coordinate) |
| void | updateSelectionBorders (qreal first, qreal second) |
| void | updateTabs (const QList< Tab > &tabs, qreal tabDistance) |
Signals | |
| void | aboutToChange () |
| emitted when there the user is about to change a tab or hotspot | |
| void | guideCreationFinished (Qt::Orientation orientation, const QPoint &globalPos) |
| void | guideCreationInProgress (Qt::Orientation orientation, const QPoint &globalPos) |
| void | guideLineCreated (Qt::Orientation orientation, qreal viewPosition) |
| emitted when the mouse is drag+released outside the ruler | |
| void | hotSpotChanged (int id, qreal newPosition) |
| void | indentsChanged (bool final) |
| void | tabChanged (int originalTabIndex, KoRuler::Tab *tab) |
Public Member Functions | |
| qreal | endIndent () const |
| The end indent of all lines. | |
| qreal | firstLineIndent () const |
| The start indent of the first line. | |
| KoRuler (QWidget *parent, Qt::Orientation orientation, const KoViewConverter *viewConverter) | |
| QSize | minimumSizeHint () const override |
| reimplemented | |
| Qt::Orientation | orientation () const |
| The orientation of the ruler. | |
| qreal | paragraphIndent () const |
| The start indent of the rest of the lines. | |
| QList< QAction * > | popupActionList () const |
| qreal | rulerLength () const |
| The length of the ruler in points (pt) | |
| void | setPopupActionList (const QList< QAction * > &popupActionList) |
| QSize | sizeHint () const override |
| reimplemented | |
| QWidget * | tabChooser () |
| KoUnit | unit () const |
| The ruler's unit. | |
| ~KoRuler () override | |
Protected Member Functions | |
| void | mouseMoveEvent (QMouseEvent *ev) override |
| reimplemented | |
| void | mousePressEvent (QMouseEvent *ev) override |
| reimplemented | |
| void | mouseReleaseEvent (QMouseEvent *ev) override |
| reimplemented | |
| void | paintEvent (QPaintEvent *event) override |
| reimplemented | |
Private Attributes | |
| KoRulerPrivate *const | d |
Friends | |
| class | KoRulerPrivate |
| KoRuler::KoRuler | ( | QWidget * | parent, |
| Qt::Orientation | orientation, | ||
| const KoViewConverter * | viewConverter ) |
Creates a ruler with the orientation orientation
| parent | parent widget |
| orientation | the orientation of the ruler |
| viewConverter | the view converter used to convert from point to pixel |
Definition at line 826 of file KoRuler.cpp.
|
override |
|
signal |
emitted when there the user is about to change a tab or hotspot
|
slot |
Clear all previously set hotspots. A hotspot is a position on the ruler that the user can manipulate by dragging.
Definition at line 1320 of file KoRuler.cpp.
References d, and KoRulerPrivate::hotspots.
|
slot |
Connect the ruler to a guides tool This allows the user to drag a guide out of the ruler and get in one smooth operation the guide tool to draw and position the guide line.
| canvas | the canvas that has had the KoToolManager create the tool for previously. |
Definition at line 1359 of file KoRuler.cpp.
References connect(), guideLineCreated(), KoToolManager::instance(), and KoToolManager::toolById().
| qreal KoRuler::endIndent | ( | ) | const |
The end indent of all lines.
Definition at line 986 of file KoRuler.cpp.
References d, and KoRulerPrivate::endIndent.
| qreal KoRuler::firstLineIndent | ( | ) | const |
The start indent of the first line.
Definition at line 976 of file KoRuler.cpp.
References d, and KoRulerPrivate::firstLineIndent.
|
signal |
|
signal |
|
signal |
emitted when the mouse is drag+released outside the ruler
|
signal |
|
signal |
emitted when any of the indents is moved by the user.
| final | false until the user releases the mouse. So you can implement live update. |
|
override |
reimplemented
Definition at line 897 of file KoRuler.cpp.
References d, KoRulerPrivate::paintingStrategy, and PaintingStrategy::sizeHint().
|
overrideprotected |
reimplemented
Definition at line 1175 of file KoRuler.cpp.
References KoRulerPrivate::currentIndex, d, KoRulerPrivate::deletedTab, KoRulerPrivate::distancesPaintingStrategy, KoRulerPrivate::doSnapping(), KoRulerPrivate::effectiveActiveRangeEnd(), KoRulerPrivate::effectiveActiveRangeStart(), KoRulerPrivate::emitTabChanged(), KoRulerPrivate::endIndent, KoRulerPrivate::EndIndent, KoRulerPrivate::firstLineIndent, KoRulerPrivate::FirstLineIndent, guideCreationInProgress(), KoRulerPrivate::guideCreationStarted, guideLineCreated(), KoRulerPrivate::HotSpot, hotSpotChanged(), KoRulerPrivate::hotSpotIndex(), KoRulerPrivate::hotspots, indentsChanged(), KoRulerPrivate::mouseCoordinate, KoRulerPrivate::None, KoRulerPrivate::normalPaintingStrategy, KoRulerPrivate::offset, KoRulerPrivate::orientation, KoRulerPrivate::originalIndex, OutsideRulerThreshold, KoRulerPrivate::paintingStrategy, KoRulerPrivate::paragraphIndent, KoRulerPrivate::ParagraphIndent, KoRulerPrivate::rightToLeft, KoRulerPrivate::selected, KoRulerPrivate::selectionAtPosition(), KoRulerPrivate::selectOffset, KoRulerPrivate::Tab, KoRulerPrivate::tabMoved, KoRulerPrivate::tabs, KoRulerPrivate::viewConverter, KoViewConverter::viewToDocumentX(), and KoViewConverter::viewToDocumentY().
|
overrideprotected |
reimplemented
HACK ALERT: We don't need all that indentation stuff in Krita. Just ensure the rulers are created correctly.
Definition at line 1064 of file KoRuler.cpp.
References aboutToChange(), KoRulerPrivate::currentIndex, d, KoRulerPrivate::distancesPaintingStrategy, KoViewConverter::documentToViewX(), KoRulerPrivate::effectiveActiveRangeEnd(), KoRulerPrivate::effectiveActiveRangeStart(), KoRulerPrivate::EndIndent, KoRulerPrivate::FirstLineIndent, KoRulerPrivate::guideCreationStarted, KoRulerPrivate::HotSpot, KoRulerPrivate::hotSpotIndex(), KoRulerPrivate::None, KoRulerPrivate::offset, KoRulerPrivate::orientation, KoRulerPrivate::originalIndex, KoRulerPrivate::paintingStrategy, KoRulerPrivate::paragraphIndent, KoRulerPrivate::ParagraphIndent, KoRulerPrivate::popupActions, KoRuler::Tab::position, KoRulerPrivate::relativeTabs, KoRulerPrivate::rightToLeft, KoRulerPrivate::selected, KoRulerPrivate::selectionAtPosition(), KoRulerPrivate::selectOffset, KoRulerPrivate::showTabs, KoRulerPrivate::Tab, KoRulerPrivate::tabChooser, KoRulerPrivate::tabMoved, KoRulerPrivate::tabs, RulerTabChooser::type(), KoRulerPrivate::viewConverter, and KoViewConverter::viewToDocumentX().
|
overrideprotected |
reimplemented
Definition at line 1149 of file KoRuler.cpp.
References KoRulerPrivate::currentIndex, d, KoRulerPrivate::emitTabChanged(), guideCreationFinished(), KoRulerPrivate::guideCreationStarted, indentsChanged(), KoRulerPrivate::None, KoRulerPrivate::normalPaintingStrategy, KoRulerPrivate::orientation, KoRulerPrivate::originalIndex, KoRulerPrivate::paintingStrategy, KoRulerPrivate::selected, KoRulerPrivate::Tab, KoRulerPrivate::tabMoved, and KoRulerPrivate::tabs.
| Qt::Orientation KoRuler::orientation | ( | ) | const |
The orientation of the ruler.
Definition at line 854 of file KoRuler.cpp.
References d, and KoRulerPrivate::orientation.
|
overrideprotected |
reimplemented
Definition at line 871 of file KoRuler.cpp.
References d, PaintingStrategy::drawBackground(), PaintingStrategy::drawIndents(), PaintingStrategy::drawMeasurements(), PaintingStrategy::drawTabs(), KoRulerPrivate::paintingStrategy, and KoRulerPrivate::showIndents.
| qreal KoRuler::paragraphIndent | ( | ) | const |
The start indent of the rest of the lines.
Definition at line 981 of file KoRuler.cpp.
References d, and KoRulerPrivate::paragraphIndent.
| QList< QAction * > KoRuler::popupActionList | ( | ) | const |
Return the actions list.
Definition at line 1059 of file KoRuler.cpp.
References d, and KoRulerPrivate::popupActions.
|
slot |
Remove a previously set hotspot, returning true if one is actually returned.
| id | the unique id for the hotspot. A hotspot is a position on the ruler that the user can manipulate by dragging. |
Definition at line 1346 of file KoRuler.cpp.
References d, and KoRulerPrivate::hotspots.
| qreal KoRuler::rulerLength | ( | ) | const |
The length of the ruler in points (pt)
Definition at line 849 of file KoRuler.cpp.
References d, and KoRulerPrivate::rulerLength.
|
slot |
Set the active range, ie the part of the ruler that is most likely used. set to 0, 0 when there is no longer any active range
| start | the start of the range in pt |
| end | the end of the range in pt |
Definition at line 907 of file KoRuler.cpp.
References KoRulerPrivate::activeRangeEnd, KoRulerPrivate::activeRangeStart, and d.
|
slot |
Set the position of the end indent relative to the active range. If Right To left is set the indent is relative to the left side of the active range .
| indent | the value relative to the active range. |
Definition at line 968 of file KoRuler.cpp.
References d, KoRulerPrivate::endIndent, and KoRulerPrivate::showIndents.
|
slot |
Set the position of the first line start indent relative to the active range. If Right To left is set the indent is relative to the right side of the active range .
| indent | the value relative to the active range. |
Definition at line 952 of file KoRuler.cpp.
References d, KoRulerPrivate::firstLineIndent, and KoRulerPrivate::showIndents.
|
slot |
Add or set a hotspot. A hotspot is a position on the ruler that the user can manipulate by dragging.
| position | the new position of the hotspot. |
| id | the unique id for the hotspot. If the id has not been set before, it will be added. |
Definition at line 1328 of file KoRuler.cpp.
References d, KoRulerPrivate::hotspots, KoRulerPrivate::HotSpotData::id, and KoRulerPrivate::HotSpotData::position.
|
slot |
Set the offset. Use this function to sync the ruler with the canvas' position on screen
| offset | The offset in pixels |
Definition at line 859 of file KoRuler.cpp.
References d, and KoRulerPrivate::offset.
|
slot |
Set the override active range, ie the part of the ruler that is most likely used. set to 0, 0 when there is no longer any active range The override, means that if set it takes precedence over the normal active range.
| start | the start of the range in pt |
| end | the end of the range in pt |
Definition at line 914 of file KoRuler.cpp.
References KoRulerPrivate::activeOverrideRangeEnd, KoRulerPrivate::activeOverrideRangeStart, and d.
|
slot |
Set the position of the rest of the lines start indent relative to the active range. If Right To left is set the indent is relative to the right side of the active range .
| indent | the value relative to the active range. |
Definition at line 960 of file KoRuler.cpp.
References d, KoRulerPrivate::paragraphIndent, and KoRulerPrivate::showIndents.
set a list of actions that will be shown in a popup should the user right click on this ruler.
| popupActionList | the list of actions |
Definition at line 1054 of file KoRuler.cpp.
References d, popupActionList(), and KoRulerPrivate::popupActions.
|
slot |
Set whether the tabs is relative to the paragraph indent
| relative | tabs are relative to paragraph indent if true, default is false. |
Definition at line 1029 of file KoRuler.cpp.
References d, KoRulerPrivate::relativeTabs, and KoRulerPrivate::showTabs.
|
slot |
Set the state of the ruler so that it shows everything in right to left mode.
| isRightToLeft | state of right to left mode. Default is false. |
Definition at line 940 of file KoRuler.cpp.
References d, and KoRulerPrivate::rightToLeft.
|
slot |
Sets the length of the ruler to length in points (pt)
Definition at line 865 of file KoRuler.cpp.
References d, length(), and KoRulerPrivate::rulerLength.
|
slot |
Set if the ruler should show indents as used in text editors. Set the indents with setFirstLineIndent(), setParagraphIndent(), setEndIndent() .
| show | show indents if true. Default is false. |
Definition at line 946 of file KoRuler.cpp.
References d, and KoRulerPrivate::showIndents.
|
slot |
Set whether the ruler should show the current mouse position. Update the position with updateMouseCoordinate().
| show | show mouse position if true. Default is false. |
Definition at line 929 of file KoRuler.cpp.
References d, and KoRulerPrivate::showMousePosition.
|
slot |
Set whether the ruler should show the selection borders
| show | show selection borders if true, default is false. |
Definition at line 1001 of file KoRuler.cpp.
References d, and KoRulerPrivate::showSelectionBorders.
|
slot |
Set whether the ruler should show tabs
| show | show selection borders if true, default is false. |
Definition at line 1016 of file KoRuler.cpp.
References d, RulerTabChooser::setShowTabs(), KoRulerPrivate::showTabs, and KoRulerPrivate::tabChooser.
Set the unit of the ruler.
Definition at line 843 of file KoRuler.cpp.
References d, unit(), and KoRulerPrivate::unit.
|
slot |
Definition at line 1368 of file KoRuler.cpp.
References d, and KoRulerPrivate::pixelStep.
|
slot |
Definition at line 935 of file KoRuler.cpp.
References d, and KoRulerPrivate::showMousePosition.
|
override |
reimplemented
Definition at line 902 of file KoRuler.cpp.
References d, KoRulerPrivate::paintingStrategy, and PaintingStrategy::sizeHint().
|
signal |
Emitted when any of the tabs are moved, deleted or inserted by the user.
| originalTabIndex | the index in the list of tabs before the user interaction started, or -1 if this is a new tab |
| tab | the new tab, or zero when the tab has been removed. |
| QWidget * KoRuler::tabChooser | ( | ) |
The tab chooser widget, which you must put into a layout along with the ruler. Returns 0 for vertical rulers,
Definition at line 991 of file KoRuler.cpp.
References d, KoRulerPrivate::orientation, RulerTabChooser::setShowTabs(), KoRulerPrivate::showTabs, and KoRulerPrivate::tabChooser.
|
slot |
Definition at line 1046 of file KoRuler.cpp.
References compareTabs, d, and KoRulerPrivate::tabs.
| KoUnit KoRuler::unit | ( | ) | const |
The ruler's unit.
Definition at line 838 of file KoRuler.cpp.
References d, and KoRulerPrivate::unit.
|
slot |
Update the current position of the mouse pointer, repainting if changed. The ruler offset will be applied before painting.
| coordinate | Either the x or y coordinate of the mouse depending of the orientation of the ruler. |
Definition at line 921 of file KoRuler.cpp.
References d, and KoRulerPrivate::mouseCoordinate.
|
slot |
Update the selection borders
| first | the first selection border in points |
| second | the other selection border in points |
Definition at line 1007 of file KoRuler.cpp.
References d, KoRulerPrivate::firstSelectionBorder, KoRulerPrivate::secondSelectionBorder, and KoRulerPrivate::showSelectionBorders.
Update the tabs
| tabs | a list of tabs that is shown on the ruler |
| tabDistance | the distance between regular interval tabs |
Definition at line 1037 of file KoRuler.cpp.
References d, KoRulerPrivate::showTabs, KoRulerPrivate::tabDistance, tabs(), and KoRulerPrivate::tabs.
|
friend |
|
private |