KWidgetsAddons

kruler.h
1 /* -*- c++ -*- */
2 /*
3  This file is part of the KDE libraries
4  SPDX-FileCopyrightText: 1998 Jörg Habenicht <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #ifndef KRULER_H
10 #define KRULER_H
11 
12 #include <kwidgetsaddons_export.h>
13 
14 #include <QAbstractSlider>
15 
52 class KWIDGETSADDONS_EXPORT KRuler : public QAbstractSlider
53 {
54  Q_OBJECT
55  Q_PROPERTY(bool showTinyMarks READ showTinyMarks WRITE setShowTinyMarks)
56  Q_PROPERTY(bool showLittleMarks READ showLittleMarks WRITE setShowLittleMarks)
57  Q_PROPERTY(bool showMediumMarks READ showMediumMarks WRITE setShowMediumMarks)
58  Q_PROPERTY(bool showBigMarks READ showBigMarks WRITE setShowBigMarks)
59  Q_PROPERTY(bool showPointer READ showPointer WRITE setShowPointer)
60  Q_PROPERTY(bool showEndLabel READ showEndLabel WRITE setShowEndLabel)
61  Q_PROPERTY(int tinyMarkDistance READ tinyMarkDistance WRITE setTinyMarkDistance)
62  Q_PROPERTY(int littleMarkDistance READ littleMarkDistance WRITE setLittleMarkDistance)
63  Q_PROPERTY(int mediumMarkDistance READ mediumMarkDistance WRITE setBigMarkDistance)
64  Q_PROPERTY(int bigMarkDistance READ bigMarkDistance WRITE setBigMarkDistance)
65  Q_PROPERTY(double pixelPerMark READ pixelPerMark WRITE setPixelPerMark)
66  Q_PROPERTY(bool lengthFixed READ lengthFixed WRITE setLengthFixed)
67  Q_PROPERTY(QString endLabel READ endLabel WRITE setEndLabel)
68  Q_PROPERTY(int length READ length WRITE setLength)
69  Q_PROPERTY(int offset READ offset)
70  Q_PROPERTY(int endOffset READ endOffset)
71 
72 public:
76  enum MetricStyle { Custom = 0, Pixel, Inch, Millimetres, Centimetres, Metres };
78 
79 
82  explicit KRuler(QWidget *parent = nullptr);
95  explicit KRuler(Qt::Orientation orient, QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
96 
111  KRuler(Qt::Orientation orient, int widgetWidth, QWidget *parent = nullptr,
113 
117  ~KRuler();
118 
119 #if KWIDGETSADDONS_ENABLE_DEPRECATED_SINCE(5, 0)
120 
128  KWIDGETSADDONS_DEPRECATED_VERSION(5, 0, "Use KRuler::setMinimum(int)")
129  void setMinValue(int);
130 #endif
131 
132 #if KWIDGETSADDONS_ENABLE_DEPRECATED_SINCE(5, 0)
133 
138  KWIDGETSADDONS_DEPRECATED_VERSION(5, 0, "Use KRuler::minimum()")
139  int minValue() const;
140 #endif
141 
142 #if KWIDGETSADDONS_ENABLE_DEPRECATED_SINCE(5, 0)
143 
151  KWIDGETSADDONS_DEPRECATED_VERSION(5, 0, "Use KRuler::setMaximum(int)")
152  void setMaxValue(int);
153 #endif
154 
155 #if KWIDGETSADDONS_ENABLE_DEPRECATED_SINCE(5, 0)
156 
161  KWIDGETSADDONS_DEPRECATED_VERSION(5, 0, "Use KRuler::maximum()")
162  int maxValue() const;
163 #endif
164 
170  void setTinyMarkDistance(int);
174  int tinyMarkDistance() const;
175 
181  void setLittleMarkDistance(int);
182 
186  int littleMarkDistance() const;
187 
194  void setMediumMarkDistance(int);
195  int mediumMarkDistance() const;
196 
202  void setBigMarkDistance(int);
206  int bigMarkDistance() const;
207 
211  void setShowTinyMarks(bool);
212  bool showTinyMarks() const;
216  void setShowLittleMarks(bool);
217  bool showLittleMarks() const;
221  void setShowMediumMarks(bool);
222  bool showMediumMarks() const;
226  void setShowBigMarks(bool);
227  bool showBigMarks() const;
231  void setShowEndMarks(bool);
232  bool showEndMarks() const;
236  void setShowPointer(bool);
237  bool showPointer() const;
238 
239 #if KWIDGETSADDONS_ENABLE_DEPRECATED_SINCE(5, 0)
240 
244  KWIDGETSADDONS_DEPRECATED_VERSION(5, 0, "No longer a feature")
245  void setFrameStyle(int);
246 #endif
247 
253  void setShowEndLabel(bool);
254  bool showEndLabel() const;
255 
260  void setEndLabel(const QString &);
261  QString endLabel() const;
262 
268  void setRulerMetricStyle(KRuler::MetricStyle);
269 
288  void setPixelPerMark(double rate);
289 
293  double pixelPerMark() const;
294 
304  void setLength(int);
305  int length() const;
306 
313  void setLengthFixed(bool fix);
314  bool lengthFixed() const;
315 
327  void slideUp(int count = 1);
328 
340  void slideDown(int count = 1);
341 
350  void setOffset(int offset);
351 
355  int offset() const;
356 
357  int endOffset() const;
358 
359 public Q_SLOTS:
360 
367  void slotNewValue(int);
368 
375  void slotNewOffset(int);
376 
377  void slotEndOffset(int);
378 
379 protected:
380  void paintEvent(QPaintEvent *) override;
381 
382 private:
383  void initWidget(Qt::Orientation orientation);
384 
385 private:
386  class KRulerPrivate;
387  KRulerPrivate *const d;
388 };
389 
390 #endif
Q_ENUM(...)
virtual void paintEvent(QPaintEvent *event)
A ruler widget.
Definition: kruler.h:52
Q_PROPERTY(...)
Orientation
typedef WindowFlags
MetricStyle
The types of units used.
Definition: kruler.h:76
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Sep 17 2020 22:44:10 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.