Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 09:23:45

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 // Qt-Security score:significant reason:default
0004 
0005 #ifndef QSPINBOX_H
0006 #define QSPINBOX_H
0007 
0008 #include <QtWidgets/qtwidgetsglobal.h>
0009 #include <QtWidgets/qabstractspinbox.h>
0010 
0011 QT_REQUIRE_CONFIG(spinbox);
0012 
0013 QT_BEGIN_NAMESPACE
0014 
0015 class QSpinBoxPrivate;
0016 class Q_WIDGETS_EXPORT QSpinBox : public QAbstractSpinBox
0017 {
0018     Q_OBJECT
0019 
0020     Q_PROPERTY(QString suffix READ suffix WRITE setSuffix)
0021     Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
0022     Q_PROPERTY(QString cleanText READ cleanText)
0023     Q_PROPERTY(int minimum READ minimum WRITE setMinimum)
0024     Q_PROPERTY(int maximum READ maximum WRITE setMaximum)
0025     Q_PROPERTY(int singleStep READ singleStep WRITE setSingleStep)
0026     Q_PROPERTY(StepType stepType READ stepType WRITE setStepType)
0027     Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged USER true)
0028     Q_PROPERTY(int displayIntegerBase READ displayIntegerBase WRITE setDisplayIntegerBase)
0029 
0030 public:
0031     explicit QSpinBox(QWidget *parent = nullptr);
0032     ~QSpinBox();
0033 
0034     int value() const;
0035 
0036     QString prefix() const;
0037     void setPrefix(const QString &prefix);
0038 
0039     QString suffix() const;
0040     void setSuffix(const QString &suffix);
0041 
0042     QString cleanText() const;
0043 
0044     int singleStep() const;
0045     void setSingleStep(int val);
0046 
0047     int minimum() const;
0048     void setMinimum(int min);
0049 
0050     int maximum() const;
0051     void setMaximum(int max);
0052 
0053     void setRange(int min, int max);
0054 
0055     StepType stepType() const;
0056     void setStepType(StepType stepType);
0057 
0058     int displayIntegerBase() const;
0059     void setDisplayIntegerBase(int base);
0060 
0061 protected:
0062     bool event(QEvent *event) override;
0063     QValidator::State validate(QString &input, int &pos) const override;
0064     virtual int valueFromText(const QString &text) const;
0065     virtual QString textFromValue(int val) const;
0066     void fixup(QString &str) const override;
0067 
0068 
0069 public Q_SLOTS:
0070     void setValue(int val);
0071 
0072 Q_SIGNALS:
0073     void valueChanged(int);
0074     void textChanged(const QString &);
0075 
0076 private:
0077     Q_DISABLE_COPY(QSpinBox)
0078     Q_DECLARE_PRIVATE(QSpinBox)
0079 };
0080 
0081 class QDoubleSpinBoxPrivate;
0082 class Q_WIDGETS_EXPORT QDoubleSpinBox : public QAbstractSpinBox
0083 {
0084     Q_OBJECT
0085 
0086     Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
0087     Q_PROPERTY(QString suffix READ suffix WRITE setSuffix)
0088     Q_PROPERTY(QString cleanText READ cleanText)
0089     Q_PROPERTY(int decimals READ decimals WRITE setDecimals)
0090     Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
0091     Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
0092     Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep)
0093     Q_PROPERTY(StepType stepType READ stepType WRITE setStepType)
0094     Q_PROPERTY(double value READ value WRITE setValue NOTIFY valueChanged USER true)
0095 public:
0096     explicit QDoubleSpinBox(QWidget *parent = nullptr);
0097     ~QDoubleSpinBox();
0098 
0099     double value() const;
0100 
0101     QString prefix() const;
0102     void setPrefix(const QString &prefix);
0103 
0104     QString suffix() const;
0105     void setSuffix(const QString &suffix);
0106 
0107     QString cleanText() const;
0108 
0109     double singleStep() const;
0110     void setSingleStep(double val);
0111 
0112     double minimum() const;
0113     void setMinimum(double min);
0114 
0115     double maximum() const;
0116     void setMaximum(double max);
0117 
0118     void setRange(double min, double max);
0119 
0120     StepType stepType() const;
0121     void setStepType(StepType stepType);
0122 
0123     int decimals() const;
0124     void setDecimals(int prec);
0125 
0126     QValidator::State validate(QString &input, int &pos) const override;
0127     virtual double valueFromText(const QString &text) const;
0128     virtual QString textFromValue(double val) const;
0129     void fixup(QString &str) const override;
0130 
0131 public Q_SLOTS:
0132     void setValue(double val);
0133 
0134 Q_SIGNALS:
0135     void valueChanged(double);
0136     void textChanged(const QString &);
0137 
0138 private:
0139     Q_DISABLE_COPY(QDoubleSpinBox)
0140     Q_DECLARE_PRIVATE(QDoubleSpinBox)
0141 };
0142 
0143 QT_END_NAMESPACE
0144 
0145 #endif // QSPINBOX_H