Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-14 08:45:38

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 QABSTRACTSPINBOX_H
0006 #define QABSTRACTSPINBOX_H
0007 
0008 #include <QtWidgets/qtwidgetsglobal.h>
0009 #include <QtWidgets/qwidget.h>
0010 #include <QtGui/qvalidator.h>
0011 
0012 QT_REQUIRE_CONFIG(spinbox);
0013 
0014 QT_BEGIN_NAMESPACE
0015 
0016 class QLineEdit;
0017 
0018 class QAbstractSpinBoxPrivate;
0019 class QStyleOptionSpinBox;
0020 
0021 class Q_WIDGETS_EXPORT QAbstractSpinBox : public QWidget
0022 {
0023     Q_OBJECT
0024 
0025     Q_PROPERTY(bool wrapping READ wrapping WRITE setWrapping)
0026     Q_PROPERTY(bool frame READ hasFrame WRITE setFrame)
0027     Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
0028     Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
0029     Q_PROPERTY(ButtonSymbols buttonSymbols READ buttonSymbols WRITE setButtonSymbols)
0030     Q_PROPERTY(QString specialValueText READ specialValueText WRITE setSpecialValueText)
0031     Q_PROPERTY(QString text READ text)
0032     Q_PROPERTY(bool accelerated READ isAccelerated WRITE setAccelerated)
0033     Q_PROPERTY(CorrectionMode correctionMode READ correctionMode WRITE setCorrectionMode)
0034     Q_PROPERTY(bool acceptableInput READ hasAcceptableInput)
0035     Q_PROPERTY(bool keyboardTracking READ keyboardTracking WRITE setKeyboardTracking)
0036     Q_PROPERTY(bool showGroupSeparator READ isGroupSeparatorShown WRITE setGroupSeparatorShown)
0037 public:
0038     explicit QAbstractSpinBox(QWidget *parent = nullptr);
0039     ~QAbstractSpinBox();
0040 
0041     enum StepEnabledFlag { StepNone = 0x00, StepUpEnabled = 0x01,
0042                            StepDownEnabled = 0x02 };
0043     Q_DECLARE_FLAGS(StepEnabled, StepEnabledFlag)
0044 
0045     enum ButtonSymbols { UpDownArrows, PlusMinus, NoButtons };
0046     Q_ENUM(ButtonSymbols)
0047 
0048     ButtonSymbols buttonSymbols() const;
0049     void setButtonSymbols(ButtonSymbols bs);
0050 
0051     enum CorrectionMode  { CorrectToPreviousValue, CorrectToNearestValue };
0052     Q_ENUM(CorrectionMode)
0053 
0054     void setCorrectionMode(CorrectionMode cm);
0055     CorrectionMode correctionMode() const;
0056 
0057     bool hasAcceptableInput() const;
0058     QString text() const;
0059 
0060     QString specialValueText() const;
0061     void setSpecialValueText(const QString &txt);
0062 
0063     bool wrapping() const;
0064     void setWrapping(bool w);
0065 
0066     void setReadOnly(bool r);
0067     bool isReadOnly() const;
0068 
0069     void setKeyboardTracking(bool kt);
0070     bool keyboardTracking() const;
0071 
0072     void setAlignment(Qt::Alignment flag);
0073     Qt::Alignment alignment() const;
0074 
0075     void setFrame(bool);
0076     bool hasFrame() const;
0077 
0078     void setAccelerated(bool on);
0079     bool isAccelerated() const;
0080 
0081     void setGroupSeparatorShown(bool shown);
0082     bool isGroupSeparatorShown() const;
0083 
0084     QSize sizeHint() const override;
0085     QSize minimumSizeHint() const override;
0086     void interpretText();
0087     bool event(QEvent *event) override;
0088 
0089     QVariant inputMethodQuery(Qt::InputMethodQuery) const override;
0090 
0091     virtual QValidator::State validate(QString &input, int &pos) const;
0092     virtual void fixup(QString &input) const;
0093 
0094     virtual void stepBy(int steps);
0095 
0096     enum StepType {
0097         DefaultStepType,
0098         AdaptiveDecimalStepType
0099     };
0100     Q_ENUM(StepType)
0101 
0102 public Q_SLOTS:
0103     void stepUp();
0104     void stepDown();
0105     void selectAll();
0106     virtual void clear();
0107 protected:
0108     void resizeEvent(QResizeEvent *event) override;
0109     void keyPressEvent(QKeyEvent *event) override;
0110     void keyReleaseEvent(QKeyEvent *event) override;
0111 #if QT_CONFIG(wheelevent)
0112     void wheelEvent(QWheelEvent *event) override;
0113 #endif
0114     void focusInEvent(QFocusEvent *event) override;
0115     void focusOutEvent(QFocusEvent *event) override;
0116 #if QT_CONFIG(contextmenu)
0117     void contextMenuEvent(QContextMenuEvent *event) override;
0118 #endif
0119     void changeEvent(QEvent *event) override;
0120     void closeEvent(QCloseEvent *event) override;
0121     void hideEvent(QHideEvent *event) override;
0122     void mousePressEvent(QMouseEvent *event) override;
0123     void mouseReleaseEvent(QMouseEvent *event) override;
0124     void mouseMoveEvent(QMouseEvent *event) override;
0125     void timerEvent(QTimerEvent *event) override;
0126     void paintEvent(QPaintEvent *event) override;
0127     void showEvent(QShowEvent *event) override;
0128     virtual void initStyleOption(QStyleOptionSpinBox *option) const;
0129 
0130     QLineEdit *lineEdit() const;
0131     void setLineEdit(QLineEdit *edit);
0132 
0133     virtual StepEnabled stepEnabled() const;
0134 Q_SIGNALS:
0135     void editingFinished();
0136     void returnPressed();
0137 protected:
0138     QAbstractSpinBox(QAbstractSpinBoxPrivate &dd, QWidget *parent = nullptr);
0139 
0140 private:
0141     Q_DECLARE_PRIVATE(QAbstractSpinBox)
0142     Q_DISABLE_COPY(QAbstractSpinBox)
0143     friend class QAccessibleAbstractSpinBox;
0144 };
0145 Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractSpinBox::StepEnabled)
0146 
0147 QT_END_NAMESPACE
0148 
0149 #endif // QABSTRACTSPINBOX_H