digiKam
dnuminput.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2008-08-16
7  * Description : Integer and double num input widget
8  * re-implemented with a reset button to switch to
9  * a default value
10  *
11  * Copyright (C) 2008-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option)
17  * any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_DNUM_INPUT_H
27 #define DIGIKAM_DNUM_INPUT_H
28 
29 // Qt includes
30 
31 #include <QWidget>
32 
33 // Local includes
34 
35 #include "digikam_export.h"
36 
37 namespace Digikam
38 {
39 
40 class DIGIKAM_EXPORT DIntNumInput : public QWidget
41 {
42  Q_OBJECT
43 
44 public:
45 
46  explicit DIntNumInput(QWidget* const parent = nullptr);
47  ~DIntNumInput() override;
48 
49  void setRange(int min, int max, int step);
50 
51  void setDefaultValue(int d);
52  int defaultValue() const;
53  int value() const;
54 
55  void setSuffix(const QString& suffix);
56 
57 Q_SIGNALS:
58 
59  void reset();
60  void valueChanged(int);
61 
62 public Q_SLOTS:
63 
64  void setValue(int d);
65  void slotReset();
66 
67 private Q_SLOTS:
68 
69  void slotValueChanged(int);
70 
71 private:
72 
73  class Private;
74  Private* const d;
75 };
76 
77 // ---------------------------------------------------------
78 
79 class DIGIKAM_EXPORT DDoubleNumInput : public QWidget
80 {
81  Q_OBJECT
82 
83 public:
84 
85  explicit DDoubleNumInput(QWidget* const parent = nullptr);
86  ~DDoubleNumInput() override;
87 
88  void setDecimals(int p);
89  void setRange(double min, double max, double step);
90 
91  void setDefaultValue(double d);
92  double defaultValue() const;
93  double value() const;
94 
95  void setSuffix(const QString& suffix);
96 
97 Q_SIGNALS:
98 
99  void reset();
100  void valueChanged(double);
101 
102 public Q_SLOTS:
103 
104  void setValue(double d);
105  void slotReset();
106 
107 private Q_SLOTS:
108 
109  void slotValueChanged(double);
110 
111 private:
112 
113  class Private;
114  Private* const d;
115 };
116 
117 } // namespace Digikam
118 
119 #endif // DIGIKAM_DNUM_INPUT_H
Definition: dnuminput.h:80
Definition: dnuminput.h:41
QStringView suffix
Definition: itemviewutilities.cpp:594
qulonglong value
Definition: itemviewutilities.cpp:592
Definition: datefolderview.cpp:43