dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
longlongspinbox.h
Go to the documentation of this file.
1 
12 /*
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 3 of the License, or
16  * (at your option) any later version approved by the KDE Free Qt Foundation.
17  *
18  * This program is distributed in the hope that it will be useful, but
19  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  * for more details.
22  *
23  * You should have received a copy of the GNU General Public License along
24  * with this program; if not, see <http://www.gnu.org/licenses/>
25  *
26  * Additional note on redistribution: The copyright and license notices above
27  * must be maintained in each individual source file that is a derivative work
28  * of this source file; otherwise redistribution is prohibited.
29  */
30 
31 #ifndef LONGLONGSPINBOX_H
32 #define LONGLONGSPINBOX_H
33 
34 #include <QAbstractSpinBox>
35 #include "utils_global.h"
36 
37 
38 class QTCREATOR_UTILS_EXPORT LongLongSpinBox : public QAbstractSpinBox
39 {
40  Q_OBJECT
41 
42 public:
43  explicit LongLongSpinBox(QWidget *parent = nullptr);
44  ~LongLongSpinBox();
45 
46  qint64 value() const;
47 
48  QString prefix() const;
49  void setPrefix(const QString &prefix);
50 
51  QString suffix() const;
52  void setSuffix(const QString &suffix);
53 
54  QString cleanText() const;
55 
56  qint64 singleStep() const;
57  void setSingleStep(qint64 val);
58 
59  qint64 minimum() const;
60  void setMinimum(qint64 min);
61 
62  qint64 maximum() const;
63  void setMaximum(qint64 max);
64 
65  void setRange(qint64 min, qint64 max);
66 
67  int displayIntegerBase() const;
68  void setDisplayIntegerBase(int base);
69 
70  virtual QSize minimumSizeHint() const override;
71 
72  virtual bool event(QEvent *event) override;
73 
74 protected:
75  QValidator::State validate(QString &input, int &pos) const override;
76  virtual qint64 valueFromText(const QString &text);
77  virtual QString textFromValue(qint64 val) const;
78  void fixup(QString &str) const override;
79  void updateEdit();
80  QString stripped(const QString &text, int *pos = nullptr) const;
81  qint64 validateAndInterpret(QString &input, int &pos, QValidator::State &state) const;
82  virtual StepEnabled stepEnabled() const override;
83  virtual void stepBy(int steps) override;
84  virtual void setLineEdit(QLineEdit *edit);
85 
86 
87 public Q_SLOTS:
88  void setValue(qint64 val);
89 
90 protected Q_SLOTS:
91  void lineEditChanged(const QString &t);
92 
93 Q_SIGNALS:
94  void valueChanged(qint64 val);
95  void valueChanged(const QString &val);
96 
97 private:
98  qint64 m_value, m_singleStep, m_min, m_max;
99  QString m_prefix, m_suffix;
100  int m_displayBase;
101  bool m_showGroupSeparator;
102  mutable QSize m_cachedMinSize;
103 
104  Q_DISABLE_COPY(LongLongSpinBox)
105 };
106 
107 #endif // LONGLONGSPINBOX_H
108 
const char t[]
Definition: coreconstants.h:40