• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • krita API Reference
  • KDE Home
  • Contact Us
 

KritaWidgets

  • sources
  • kfour-appscomplete
  • krita
  • libs
  • widgets
KoRuler.h
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  SPDX-FileCopyrightText: 1998, 1999 Reginald Stadlbauer <[email protected]>
3  SPDX-FileCopyrightText: 2006 Peter Simonsson <[email protected]>
4  SPDX-FileCopyrightText: 2007 C. Boemann <[email protected]>
5  SPDX-FileCopyrightText: 2007 Thomas Zander <[email protected]>
6 
7  SPDX-License-Identifier: LGPL-2.0-or-later
8 */
9 
10 #ifndef koRuler_h
11 #define koRuler_h
12 
13 
14 #include "kritawidgets_export.h"
15 
16 #include <QWidget>
17 #include <QTextOption>
18 
19 class QPaintEvent;
20 
21 class KoViewConverter;
22 class KoCanvasBase;
23 class KoRulerPrivate;
24 class KoUnit;
25 
29 class KRITAWIDGETS_EXPORT KoRuler : public QWidget
30 {
31 Q_OBJECT
32 public:
39  KoRuler(QWidget* parent, Qt::Orientation orientation, const KoViewConverter* viewConverter);
40  ~KoRuler() override;
41 
43  struct Tab {
44  qreal position;
45  QTextOption::TabType type;
46  };
47 
49  KoUnit unit() const;
50 
52  qreal rulerLength() const;
53 
55  Qt::Orientation orientation() const;
56 
58  qreal firstLineIndent() const;
59 
61  qreal paragraphIndent() const;
62 
64  qreal endIndent() const;
65 
68  QWidget *tabChooser();
69 
75  void setPopupActionList(const QList<QAction*> &popupActionList);
80  QList<QAction*> popupActionList() const;
81 
83  QSize minimumSizeHint() const override;
84 
86  QSize sizeHint() const override;
87 
88 public Q_SLOTS:
90  void setUnit(const KoUnit &unit);
91 
96  void setOffset(int offset);
97 
99  void setRulerLength(qreal length);
100 
106  void setActiveRange(qreal start, qreal end);
107 
114  void setOverrideActiveRange(qreal start, qreal end);
115 
119  void setRightToLeft(bool isRightToLeft);
120 
125  void setShowIndents(bool show);
126 
131  void setFirstLineIndent(qreal indent);
132 
137  void setParagraphIndent(qreal indent);
138 
143  void setEndIndent(qreal indent);
144 
149  void setShowMousePosition(bool show);
150 
154  bool showMousePosition() const;
155 
161  void updateMouseCoordinate(int coordinate);
162 
167  void setShowSelectionBorders(bool show);
168 
174  void updateSelectionBorders(qreal first, qreal second);
175 
180  void setShowTabs(bool show);
181 
186  void setRelativeTabs(bool relative);
187 
193  void updateTabs(const QList<Tab> &tabs, qreal tabDistance);
194 
195  /***
196  * Return the list of tabs set on this ruler.
197  */
198  QList<Tab> tabs() const;
199 
204  void clearHotSpots();
205 
212  void setHotSpot(qreal position, int id = -1);
213 
219  bool removeHotSpot(int id);
220 
227  void createGuideToolConnection(KoCanvasBase *canvas);
228 
229  void setUnitPixelMultiple2(bool enabled);
230 
231 Q_SIGNALS:
236  void indentsChanged(bool final);
237 
244  void tabChanged(int originalTabIndex, KoRuler::Tab *tab);
245 
247  void aboutToChange();
248 
249  void hotSpotChanged(int id, qreal newPosition);
250 
252  void guideLineCreated(Qt::Orientation orientation, qreal viewPosition);
253 
254  void guideCreationInProgress(Qt::Orientation orientation, const QPoint &globalPos);
255  void guideCreationFinished(Qt::Orientation orientation, const QPoint &globalPos);
256 
257 protected:
259  void paintEvent(QPaintEvent* event) override;
261  void mousePressEvent(QMouseEvent *ev) override;
263  void mouseReleaseEvent(QMouseEvent *ev) override;
265  void mouseMoveEvent(QMouseEvent *ev) override;
266 
267 private:
268  KoRulerPrivate * const d;
269  friend class KoRulerPrivate;
270 };
271 
272 #endif
KoRulerPrivate
Definition: KoRuler_p.h:112
QWidget::paintEvent
virtual void paintEvent(QPaintEvent *event)
QWidget
KoViewConverter
QSize
QList< QAction * >
QMouseEvent
KoRuler::Tab::position
qreal position
distance in point from the start of the text-shape
Definition: KoRuler.h:44
KoRuler
Decorator widget to draw a single ruler around a canvas.
Definition: KoRuler.h:29
KoRuler::Tab::type
QTextOption::TabType type
Determine which type is used.
Definition: KoRuler.h:45
QWidget::minimumSizeHint
virtual QSize minimumSizeHint() const
QWidget::mouseReleaseEvent
virtual void mouseReleaseEvent(QMouseEvent *event)
KoRuler::Tab
For paragraphs each tab definition is represented by this struct.
Definition: KoRuler.h:43
QPaintEvent
QWidget::sizeHint
virtual QSize sizeHint() const
QWidget::mouseMoveEvent
virtual void mouseMoveEvent(QMouseEvent *event)
QPoint
QWidget::mousePressEvent
virtual void mousePressEvent(QMouseEvent *event)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Jan 23 2021 11:48:23 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KritaWidgets

Skip menu "KritaWidgets"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

krita API Reference

Skip menu "krita API Reference"
  • libs
  •   KritaBasicFlakes
  •   brush
  •   KritaUndo2
  •   KritaFlake
  •   image
  •   KritaPlugin
  •   Krita
  •   KritaPigment
  •   KritaResources
  •   KritaStore
  •   ui
  •   KritaWidgets
  •   KritaWidgetUtils
  • plugins
  •   Assitants
  •   Extensions
  •   Filters
  •   Generators
  •   Formats
  •           src
  •   PaintOps
  •     libpaintop

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal