Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:09:32

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