CopperSpice API  1.7.2
QAbstractSpinBox Class Reference

The QAbstractSpinBox class provides a spinbox and a line edit to display values. More...

Inheritance diagram for QAbstractSpinBox:
QWidget QObject QPaintDevice QDateTimeEdit QDoubleSpinBox QSpinBox QDateEdit QTimeEdit

Public Typedefs

using StepEnabled = QFlags< StepEnabledFlag >
 

Public Types

enum  ButtonSymbols
 
enum  CorrectionMode
 
enum  StepEnabledFlag
 
- Public Types inherited from QWidget
enum  RenderFlag
 
- Public Types inherited from QPaintDevice
enum  PaintDeviceMetric
 

Public Signals

void editingFinished ()
 
- Public Signals inherited from QWidget
void customContextMenuRequested (const QPoint &pos)
 
void windowIconChanged (const QIcon &icon)
 
void windowIconTextChanged (const QString &iconText)
 
void windowTitleChanged (const QString &title)
 
- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 

Public Slots

virtual void clear ()
 
void selectAll ()
 
void stepDown ()
 
void stepUp ()
 
- Public Slots inherited from QWidget
bool close ()
 
void hide ()
 
void lower ()
 
void raise ()
 
void repaint ()
 
void setDisabled (bool disable)
 
void setEnabled (bool enable)
 
void setFocus ()
 
void setHidden (bool hidden)
 
void setStyleSheet (const QString &styleSheet)
 
virtual void setVisible (bool visible)
 
void setWindowModified (bool modified)
 
void setWindowTitle (const QString &title)
 
void show ()
 
void showFullScreen ()
 
void showMaximized ()
 
void showMinimized ()
 
void showNormal ()
 
void update ()
 
- Public Slots inherited from QObject
void deleteLater ()
 

Public Methods

 QAbstractSpinBox (QWidget *parent=nullptr)
 
 ~QAbstractSpinBox ()
 
Qt::Alignment alignment () const
 
ButtonSymbols buttonSymbols () const
 
CorrectionMode correctionMode () const
 
virtual void fixup (QString &input) const
 
bool hasAcceptableInput () const
 
bool hasFrame () const
 
QVariant inputMethodQuery (Qt::InputMethodQuery) const override
 
void interpretText ()
 
bool isAccelerated () const
 
bool isGroupSeparatorShown () const
 
bool isReadOnly () const
 
bool keyboardTracking () const
 
QSize minimumSizeHint () const override
 
void setAccelerated (bool on)
 
void setAlignment (Qt::Alignment flag)
 
void setButtonSymbols (ButtonSymbols symbols)
 
void setCorrectionMode (CorrectionMode cm)
 
void setFrame (bool enable)
 
void setGroupSeparatorShown (bool shown)
 
void setKeyboardTracking (bool enable)
 
void setReadOnly (bool enable)
 
void setSpecialValueText (const QString &txt)
 
void setWrapping (bool wrapping)
 
QSize sizeHint () const override
 
QString specialValueText () const
 
virtual void stepBy (int steps)
 
QString text () const
 
virtual QValidator::State validate (QString &input, int &pos) const
 
bool wrapping () const
 
- Public Methods inherited from QWidget
 QWidget (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
 ~QWidget ()
 
bool acceptDrops () const
 
QString accessibleDescription () const
 
QString accessibleName () const
 
QList< QAction * > actions () const
 
void activateWindow ()
 
void addAction (QAction *action)
 
void addActions (const QList< QAction * > &actions)
 
void adjustSize ()
 
bool autoFillBackground () const
 
QPalette::ColorRole backgroundRole () const
 
QBackingStorebackingStore () const
 
QSize baseSize () const
 
QWidget * childAt (const QPoint &position) const
 
QWidget * childAt (int x, int y) const
 
QRect childrenRect () const
 
QRegion childrenRegion () const
 
void clearFocus ()
 
void clearMask ()
 
QMargins contentsMargins () const
 
QRect contentsRect () const
 
Qt::ContextMenuPolicy contextMenuPolicy () const
 
QCursor cursor () const
 
WId effectiveWinId () const
 
void ensurePolished () const
 
Qt::FocusPolicy focusPolicy () const
 
QWidget * focusProxy () const
 
QWidget * focusWidget () const
 
const QFontfont () const
 
QFontInfo fontInfo () const
 
QFontMetrics fontMetrics () const
 
QPalette::ColorRole foregroundRole () const
 
QRect frameGeometry () const
 
QSize frameSize () const
 
const QRectgeometry () const
 
void getContentsMargins (int *left, int *top, int *right, int *bottom) const
 
QPixmap grab (const QRect &rectangle=QRect (QPoint (0, 0), QSize (-1,-1)))
 
void grabGesture (Qt::GestureType gestureType, Qt::GestureFlags flags=Qt::GestureFlags ())
 
void grabKeyboard ()
 
void grabMouse ()
 
void grabMouse (const QCursor &cursor)
 
int grabShortcut (const QKeySequence &key, Qt::ShortcutContext context=Qt::WindowShortcut)
 
QGraphicsEffectgraphicsEffect () const
 
QGraphicsProxyWidgetgraphicsProxyWidget () const
 
bool hasEditFocus () const
 
bool hasFocus () const
 
virtual bool hasHeightForWidth () const
 
bool hasMouseTracking () const
 
int height () const
 
virtual int heightForWidth (int width) const
 
Qt::InputMethodHints inputMethodHints () const
 
void insertAction (QAction *before, QAction *action)
 
void insertActions (QAction *before, QList< QAction * > actions)
 
bool isActiveWindow () const
 
bool isAncestorOf (const QWidget *child) const
 
bool isEnabled () const
 
bool isEnabledTo (const QWidget *parent) const
 
bool isEnabledToTLW () const
 
bool isFullScreen () const
 
bool isHidden () const
 
bool isMaximized () const
 
bool isMinimized () const
 
bool isModal () const
 
bool isTopLevel () const
 
bool isVisible () const
 
bool isVisibleTo (const QWidget *parent) const
 
bool isWindow () const
 
bool isWindowModified () const
 
QLayoutlayout () const
 
Qt::LayoutDirection layoutDirection () const
 
QLocale locale () const
 
QPoint mapFrom (const QWidget *parent, const QPoint &pos) const
 
QPoint mapFromGlobal (const QPoint &pos) const
 
QPoint mapFromParent (const QPoint &pos) const
 
QPoint mapTo (const QWidget *parent, const QPoint &pos) const
 
QPoint mapToGlobal (const QPoint &pos) const
 
QPoint mapToParent (const QPoint &pos) const
 
QRegion mask () const
 
int maximumHeight () const
 
QSize maximumSize () const
 
int maximumWidth () const
 
int minimumHeight () const
 
QSize minimumSize () const
 
int minimumWidth () const
 
void move (const QPoint &point)
 
void move (int x, int y)
 
QWidget * nativeParentWidget () const
 
QWidget * nextInFocusChain () const
 
QRect normalGeometry () const
 
void overrideWindowFlags (Qt::WindowFlags flags)
 
QPaintEnginepaintEngine () const override
 
const QPalettepalette () const
 
QWidget * parentWidget () const
 
QPoint pos () const
 
QWidget * previousInFocusChain () const
 
QRect rect () const
 
void releaseKeyboard ()
 
void releaseMouse ()
 
void releaseShortcut (int id)
 
void removeAction (QAction *action)
 
void render (QPaintDevice *target, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren))
 
void render (QPainter *painter, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren))
 
void repaint (const QRect &rect)
 
void repaint (const QRegion &region)
 
void repaint (int x, int y, int w, int h)
 
void resize (const QSize &size)
 
void resize (int w, int h)
 
bool restoreGeometry (const QByteArray &geometry)
 
QByteArray saveGeometry () const
 
void scroll (int dx, int dy)
 
void scroll (int dx, int dy, const QRect &rect)
 
void setAcceptDrops (bool on)
 
void setAccessibleDescription (const QString &description)
 
void setAccessibleName (const QString &name)
 
void setAttribute (Qt::WidgetAttribute attribute, bool enable=true)
 
void setAutoFillBackground (bool enable)
 
void setBackgroundRole (QPalette::ColorRole role)
 
void setBaseSize (const QSize &size)
 
void setBaseSize (int basew, int baseh)
 
void setContentsMargins (const QMargins &margins)
 
void setContentsMargins (int left, int top, int right, int bottom)
 
void setContextMenuPolicy (Qt::ContextMenuPolicy policy)
 
void setCursor (const QCursor &cursor)
 
void setEditFocus (bool enable)
 
void setFixedHeight (int h)
 
void setFixedSize (const QSize &size)
 
void setFixedSize (int w, int h)
 
void setFixedWidth (int w)
 
void setFocus (Qt::FocusReason reason)
 
void setFocusPolicy (Qt::FocusPolicy policy)
 
void setFocusProxy (QWidget *widget)
 
void setFont (const QFont &font)
 
void setForegroundRole (QPalette::ColorRole role)
 
void setGeometry (const QRect &rect)
 
void setGeometry (int x, int y, int w, int h)
 
void setGraphicsEffect (QGraphicsEffect *effect)
 
void setInputMethodHints (Qt::InputMethodHints hints)
 
void setLayout (QLayout *layout)
 
void setLayoutDirection (Qt::LayoutDirection direction)
 
void setLocale (const QLocale &locale)
 
void setMask (const QBitmap &bitmap)
 
void setMask (const QRegion &region)
 
void setMaximumHeight (int maxh)
 
void setMaximumSize (const QSize &size)
 
void setMaximumSize (int maxw, int maxh)
 
void setMaximumWidth (int maxw)
 
void setMinimumHeight (int minh)
 
void setMinimumSize (const QSize &size)
 
void setMinimumSize (int minw, int minh)
 
void setMinimumWidth (int minw)
 
void setMouseTracking (bool enable)
 
void setPalette (const QPalette &palette)
 
void setParent (QWidget *parent)
 
void setParent (QWidget *parent, Qt::WindowFlags flags)
 
void setShortcutAutoRepeat (int id, bool enable=true)
 
void setShortcutEnabled (int id, bool enable=true)
 
void setSizeIncrement (const QSize &size)
 
void setSizeIncrement (int w, int h)
 
void setSizePolicy (QSizePolicy policy)
 
void setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical)
 
void setStatusTip (const QString &data)
 
void setStyle (QStyle *style)
 
void setToolTip (const QString &data)
 
void setToolTipDuration (int msec)
 
void setUpdatesEnabled (bool enable)
 
void setWhatsThis (const QString &str)
 
void setWindowFilePath (const QString &filePath)
 
void setWindowFlags (Qt::WindowFlags flags)
 
void setWindowIcon (const QIcon &icon)
 
void setWindowModality (Qt::WindowModality windowModality)
 
void setWindowOpacity (qreal level)
 
void setWindowRole (const QString &role)
 
void setWindowState (Qt::WindowStates windowState)
 
QSize size () const
 
QSize sizeIncrement () const
 
QSizePolicy sizePolicy () const
 
void stackUnder (QWidget *widget)
 
QString statusTip () const
 
QStylestyle () const
 
QString styleSheet () const
 
bool testAttribute (Qt::WidgetAttribute attribute) const
 
QString toolTip () const
 
int toolTipDuration () const
 
QWidget * topLevelWidget () const
 
bool underMouse () const
 
void ungrabGesture (Qt::GestureType gestureType)
 
void unsetCursor ()
 
void unsetLayoutDirection ()
 
void unsetLocale ()
 
void update (const QRect &rect)
 
void update (const QRegion &region)
 
void update (int x, int y, int w, int h)
 
void updateGeometry ()
 
bool updatesEnabled () const
 
QRegion visibleRegion () const
 
QString whatsThis () const
 
int width () const
 
QWidget * window () const
 
QString windowFilePath () const
 
Qt::WindowFlags windowFlags () const
 
QWindowwindowHandle () const
 
QIcon windowIcon () const
 
Qt::WindowModality windowModality () const
 
qreal windowOpacity () const
 
QString windowRole () const
 
Qt::WindowStates windowState () const
 
QString windowTitle () const
 
Qt::WindowType windowType () const
 
WId winId () const
 
int x () const
 
int y () const
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &objName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 
- Public Methods inherited from QPaintDevice
virtual ~QPaintDevice ()
 
int colorCount () const
 
int depth () const
 
int devicePixelRatio () const
 
qreal devicePixelRatioF () const
 
int height () const
 
int heightMM () const
 
int logicalDpiX () const
 
int logicalDpiY () const
 
bool paintingActive () const
 
int physicalDpiX () const
 
int physicalDpiY () const
 
int width () const
 
int widthMM () const
 

Protected Methods

void changeEvent (QEvent *event) override
 
void closeEvent (QCloseEvent *event) override
 
void contextMenuEvent (QContextMenuEvent *event) override
 
void focusInEvent (QFocusEvent *event) override
 
void focusOutEvent (QFocusEvent *event) override
 
void hideEvent (QHideEvent *event) override
 
void initStyleOption (QStyleOptionSpinBox *option) const
 
void keyPressEvent (QKeyEvent *event) override
 
void keyReleaseEvent (QKeyEvent *event) override
 
QLineEditlineEdit () const
 
void mouseMoveEvent (QMouseEvent *event) override
 
void mousePressEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
void paintEvent (QPaintEvent *event) override
 
void resizeEvent (QResizeEvent *event) override
 
void setLineEdit (QLineEdit *lineEdit)
 
void showEvent (QShowEvent *event) override
 
virtual StepEnabled stepEnabled () const
 
void wheelEvent (QWheelEvent *event) override
 
- Protected Methods inherited from QWidget
virtual void actionEvent (QActionEvent *event)
 
void create (WId window=0, bool initializeWindow=true, bool destroyOldWindow=true)
 
void destroy (bool destroyWindow=true, bool destroySubWindows=true)
 
virtual void dragEnterEvent (QDragEnterEvent *event)
 
virtual void dragLeaveEvent (QDragLeaveEvent *event)
 
virtual void dragMoveEvent (QDragMoveEvent *event)
 
virtual void dropEvent (QDropEvent *event)
 
virtual void enterEvent (QEvent *event)
 
bool event (QEvent *event) override
 
bool focusNextChild ()
 
virtual bool focusNextPrevChild (bool next)
 
bool focusPreviousChild ()
 
void initPainter (QPainter *painter) const override
 
virtual void inputMethodEvent (QInputMethodEvent *event)
 
virtual void leaveEvent (QEvent *event)
 
int metric (PaintDeviceMetric metric) const override
 
virtual void mouseDoubleClickEvent (QMouseEvent *event)
 
virtual void moveEvent (QMoveEvent *event)
 
virtual bool nativeEvent (const QByteArray &eventType, void *message, long *result)
 
virtual void tabletEvent (QTabletEvent *event)
 
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Protected Methods inherited from QPaintDevice
 QPaintDevice ()
 

Properties

 accelerated
 
 acceptableInput
 
 alignment
 
 buttonSymbols
 
 correctionMode
 
 frame
 
 keyboardTracking
 
 readOnly
 
 specialValueText
 
 text
 
 wrapping
 
- Properties inherited from QWidget
 acceptDrops
 
 accessibleDescription
 
 accessibleName
 
 autoFillBackground
 
 baseSize
 
 childrenRect
 
 childrenRegion
 
 contextMenuPolicy
 
 cursor
 
 enabled
 
 focus
 
 focusPolicy
 
 font
 
 frameGeometry
 
 frameSize
 
 fullScreen
 
 geometry
 
 height
 
 inputMethodHints
 
 isActiveWindow
 
 layoutDirection
 
 locale
 
 maximized
 
 maximumHeight
 
 maximumSize
 
 maximumWidth
 
 minimized
 
 minimumHeight
 
 minimumSize
 
 minimumSizeHint
 
 minimumWidth
 
 modal
 
 mouseTracking
 
 normalGeometry
 
 palette
 
 pos
 
 rect
 
 size
 
 sizeHint
 
 sizeIncrement
 
 sizePolicy
 
 statusTip
 
 styleSheet
 
 toolTip
 
 updatesEnabled
 
 visible
 
 whatsThis
 
 width
 
 windowFilePath
 
 windowFlags
 
 windowIcon
 
 windowIconText
 
 windowModality
 
 windowModified
 
 windowOpacity
 
 windowTitle
 
 x
 
 y
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- Static Public Methods inherited from QWidget
static QWidget * createWindowContainer (QWindow *window, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
static QWidget * find (WId id)
 
static QWidget * keyboardGrabber ()
 
static QWidget * mouseGrabber ()
 
static void setTabOrder (QWidget *firstWidget, QWidget *secondWidget)
 
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 
- Protected Slots inherited from QWidget
void updateMicroFocus ()
 

Detailed Description

The QAbstractSpinBox class provides a spinbox and a line edit to display values. The class is designed as a common super class for widgets like QSpinBox, QDoubleSpinBox and QDateTimeEdit.

The following are the main properties of the class.

text
The text that is displayed in the QAbstractSpinBox
alignment
The alignment of the text in the QAbstractSpinBox.
wrapping
Whether the QAbstractSpinBox wraps from the minimum value to the maximum value and vice versa.

QAbstractSpinBox provides a virtual stepBy() method that is called whenever the user triggers a step. This method takes an integer value to signify how many steps were taken. For example, pressing Qt::Key_Down will trigger a call to stepBy(-1).

QAbstractSpinBox also provide a virtual method stepEnabled() to determine whether stepping up/down is allowed at any point. This method returns a bitset of StepEnabled.

See also
QAbstractSlider, QSpinBox, QDoubleSpinBox, QDateTimeEdit

Member Typedef Documentation

Member Enumeration Documentation

This enum type describes the symbols that can be displayed on the buttons in a spin box.

ConstantValueDescription
QAbstractSpinBox::UpDownArrows0 Little arrows in the classic style.
QAbstractSpinBox::PlusMinus1 + and - symbols.
QAbstractSpinBox::NoButtons2 Do not display buttons.

See also
QAbstractSpinBox::buttonSymbols

This enum type describes the mode the spinbox will use to correct an Intermediate value if editing finishes.

ConstantValueDescription
QAbstractSpinBox::CorrectToPreviousValue 0The spinbox will revert to the last valid value.
QAbstractSpinBox::CorrectToNearestValue 1The spinbox will revert to the nearest valid value.
See also
correctionMode

This enum type describes the behavior of the step buttons.

ConstantValue
QAbstractSpinBox::StepNone0x00
QAbstractSpinBox::StepUpEnabled0x01
QAbstractSpinBox::StepDownEnabled0x02

Constructor & Destructor Documentation

QAbstractSpinBox::QAbstractSpinBox ( QWidget parent = nullptr)
explicit

Constructs an abstract spinbox with the given parent with default wrapping, and alignment properties.

QAbstractSpinBox::~QAbstractSpinBox ( )

Destroys this QAbstractSpinBox object.

Method Documentation

Qt::Alignment QAbstractSpinBox::alignment ( ) const

Property documentation pending.

ButtonSymbols QAbstractSpinBox::buttonSymbols ( ) const

Documentation pending.

void QAbstractSpinBox::changeEvent ( QEvent event)
overrideprotectedvirtual

This event handler can be reimplemented to handle state changes. The state being changed in this event can be retrieved through the event supplied.

Reimplemented from QWidget.

void QAbstractSpinBox::clear ( )
slot

Clears the lineedit of all text but prefix and suffix.

void QAbstractSpinBox::closeEvent ( QCloseEvent event)
overrideprotectedvirtual

This event handler is called with the given event when CopperSpice receives a window close request for a top-level widget from the window system.

By default, the event is accepted and the widget is closed. You can reimplement this method to change the way the widget responds to window close requests. For example, you can prevent the window from closing by calling ignore() on all events.

Main window applications typically use reimplementations of this method to check whether the user's work has been saved and ask for permission before closing.

See also
event(), hide(), close(), QCloseEvent

Reimplemented from QWidget.

void QAbstractSpinBox::contextMenuEvent ( QContextMenuEvent event)
overrideprotectedvirtual

This event handler, for event event, can be reimplemented in a subclass to receive widget context menu events. The handler is called when the widget's contextMenuPolicy is Qt::DefaultContextMenu.

The default implementation ignores the context event.

See also
event(), customContextMenuRequested(), QContextMenuEvent

Reimplemented from QWidget.

CorrectionMode QAbstractSpinBox::correctionMode ( ) const

Documentation pending.

void QAbstractSpinBox::editingFinished ( )
signal

This signal is emitted editing is finished. This happens when the spinbox loses focus and when enter is pressed.

void QAbstractSpinBox::fixup ( QString input) const
virtual

This virtual method is called by the QAbstractSpinBox if the input is not validated to QValidator::Acceptable when Return is pressed or interpretText() is called. It will try to change the text so it is valid. Reimplemented in the various subclasses.

Reimplemented in QSpinBox, QDateTimeEdit, and QDoubleSpinBox.

void QAbstractSpinBox::focusInEvent ( QFocusEvent event)
overrideprotectedvirtual

This event handler can be reimplemented in a subclass to receive keyboard focus events for the widget. The default implementation updates the widget if a focusPolicy() is specified. The event is passed in the event parameter.

A widget normally must the setFocusPolicy() to something other than Qt::NoFocus in order to receive focus events.

See also
focusOutEvent(), setFocusPolicy(), keyPressEvent(), keyReleaseEvent(), event(), QFocusEvent

Reimplemented from QWidget.

Reimplemented in QDateTimeEdit.

void QAbstractSpinBox::focusOutEvent ( QFocusEvent event)
overrideprotectedvirtual

This event handler can be reimplemented in a subclass to receive keyboard focus events for the widget. The default implementation updates the widget if a focusPolicy() is specified. The events is passed in the event parameter.

A widget normally must setFocusPolicy() to something other than Qt::NoFocus in order to receive focus events.

See also
focusInEvent(), setFocusPolicy(), keyPressEvent(), keyReleaseEvent(), event(), QFocusEvent

Reimplemented from QWidget.

bool QAbstractSpinBox::hasAcceptableInput ( ) const

Property documentation pending.

bool QAbstractSpinBox::hasFrame ( ) const

Property documentation pending.

void QAbstractSpinBox::hideEvent ( QHideEvent event)
overrideprotectedvirtual

This event handler can be reimplemented in a subclass to receive widget hide events. The event is passed in the event parameter. Hide events are sent to widgets immediately after they have been hidden.

Note: A widget receives spontaneous show and hide events when its mapping status is changed by the window system, e.g. a spontaneous hide event when the user minimizes the window, and a spontaneous show event when the window is restored again. After receiving a spontaneous hide event, a widget is still considered visible in the sense of isVisible().

See also
visible, event(), QHideEvent

Reimplemented from QWidget.

void QAbstractSpinBox::initStyleOption ( QStyleOptionSpinBox option) const
protected

Initialize option with the values from this QSpinBox. This method is useful for subclasses when they need a QStyleOptionSpinBox, but do not want to fill in all the information themselves.

See also
QStyleOption::initFrom()
QVariant QAbstractSpinBox::inputMethodQuery ( Qt::InputMethodQuery  query) const
overridevirtual

This method is only relevant for input widgets. It is used by the input method to query a set of properties of the widget to be able to support complex input method operations as support for surrounding text and reconversions.

The given query specifies which property is queried.

See also
inputMethodEvent(), QInputMethodEvent, inputMethodHints

Reimplemented from QWidget.

void QAbstractSpinBox::interpretText ( )

This method interprets the text of the spin box. If the value has changed since last interpretation it will emit signals.

bool QAbstractSpinBox::isAccelerated ( ) const

Property documentation pending.

bool QAbstractSpinBox::isGroupSeparatorShown ( ) const

Property documentation pending.

bool QAbstractSpinBox::isReadOnly ( ) const

Property documentation pending.

bool QAbstractSpinBox::keyboardTracking ( ) const

Property documentation pending.

void QAbstractSpinBox::keyPressEvent ( QKeyEvent event)
overrideprotectedvirtual

his method handles keyboard input. The following keys are handled specifically.

KeyDescription
Enter/Return This will reinterpret the text and emit a signal even if the value has not changed since last time a signal was emitted.
Up This will invoke stepBy(1)
Down This will invoke stepBy(-1)
Page up This will invoke stepBy(10)
Page down This will invoke stepBy(-10)

Reimplemented from QWidget.

Reimplemented in QDateTimeEdit.

void QAbstractSpinBox::keyReleaseEvent ( QKeyEvent event)
overrideprotectedvirtual

The event handler for event event can be reimplemented in a subclass to receive key release events for the widget. A widget must call setFocusPolicy() to accept focus initially and have focus in order to receive a key release event.

If you reimplement this handler it is very important to call the base class implementation if you do not act upon the key. A QKeyEvent starts with isAccepted() set to true so you do not need to call QKeyEvent::accept(). Do not call the base class implementation if you consume the key event.

The default implementation closes popup widgets if the user presses Esc. Otherwise the event is ignored and the widget's parent can react to it.

See also
keyPressEvent(), QKeyEvent::ignore(), setFocusPolicy(), focusInEvent(), focusOutEvent(), event(), QKeyEvent

Reimplemented from QWidget.

QLineEdit * QAbstractSpinBox::lineEdit ( ) const
protected

This method returns a pointer to the line edit of the spin box.

See also
setLineEdit()
QSize QAbstractSpinBox::minimumSizeHint ( ) const
overridevirtual

Returns the value of the minimumSizeHint property.

Reimplemented from QWidget.

void QAbstractSpinBox::mouseMoveEvent ( QMouseEvent event)
overrideprotectedvirtual

This event handler, for event event, can be reimplemented in a subclass to receive mouse move events for the widget.

If mouse tracking is switched off, mouse move events only occur if a mouse button is pressed while the mouse is being moved. If mouse tracking is switched on, mouse move events occur even if no mouse button is pressed.

QMouseEvent::pos() reports the position of the mouse cursor, relative to this widget. For press and release events, the position is usually the same as the position of the last mouse move event, but it might be different if the user's hand shakes. This is a feature of the underlying window system, not CopperSpice.

If you want to show a tooltip immediately, while the mouse is moving (e.g., to get the mouse coordinates with QMouseEvent::pos() and show them as a tooltip), you must first enable mouse tracking as described above. Then, to ensure that the tooltip is updated immediately, you must call QToolTip::showText() instead of setToolTip() in your implementation of mouseMoveEvent().

See also
setMouseTracking(), mousePressEvent(), mouseReleaseEvent(), mouseDoubleClickEvent(), event(), QMouseEvent

Reimplemented from QWidget.

void QAbstractSpinBox::mousePressEvent ( QMouseEvent event)
overrideprotectedvirtual

This event handler, for event event, can be reimplemented in a subclass to receive mouse press events for the widget.

If you create new widgets in the mousePressEvent() the mouseReleaseEvent() may not end up where you expect, depending on the underlying window system (or X11 window manager), the widgets' location and maybe more.

The default implementation implements the closing of popup widgets when you click outside the window. For other widget types it does nothing.

See also
mouseReleaseEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), event(), QMouseEvent

Reimplemented from QWidget.

Reimplemented in QDateTimeEdit.

void QAbstractSpinBox::mouseReleaseEvent ( QMouseEvent event)
overrideprotectedvirtual

This event handler, for event event, can be reimplemented in a subclass to receive mouse release events for the widget.

See also
mousePressEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), event(), QMouseEvent

Reimplemented from QWidget.

void QAbstractSpinBox::paintEvent ( QPaintEvent event)
overrideprotectedvirtual

This event handler can be reimplemented in a subclass to receive paint events passed in event. A paint event is a request to repaint all or part of a widget. It can happen for one of the following reasons.

  • repaint() or update() was invoked
  • widget was obscured and has now been uncovered
  • some other reason

Many widgets can simply repaint their entire surface when asked to, but some slow widgets need to optimize by painting only the requested region: QPaintEvent::region(). This speed optimization does not change the result, as painting is clipped to that region during event processing. QListView and QTableView do this, for example.

CopperSpice also tries to speed up painting by merging multiple paint events into one. When update() is called several times or the window system sends several paint events, CopperSpice merges these events into one event with a larger region (see QRegion::united()). The repaint() function does not permit this optimization, so we suggest using update() whenever possible.

When the paint event occurs, the update region has normally been erased, so you are painting on the widget's background. The background can be set using setBackgroundRole() and setPalette().

QWidget automatically double-buffers its painting, so there is no need to write double-buffering code in paintEvent() to avoid flicker.

For the X11 platform it is possible to toggle global double buffering by calling qt_x11_set_global_double_buffer().

extern void qt_x11_set_global_double_buffer(bool);
qt_x11_set_global_double_buffer(false);

Generally you should refrain from calling update() or repaint() inside a paintEvent(). For example, calling update() or repaint() on children inside a paintevent() results in undefined behavior; the child may or may not get a paint event.

Warning
If you are using a custom paint engine without the CopperSpice backingstore, Qt::WA_PaintOnScreen must be set. Otherwise, QWidget::paintEngine() will never be called; the backingstore will be used instead.
See also
event(), repaint(), update(), QPainter, QPixmap, QPaintEvent

Reimplemented from QWidget.

Reimplemented in QDateTimeEdit.

void QAbstractSpinBox::resizeEvent ( QResizeEvent event)
overrideprotectedvirtual

This event handler can be reimplemented in a subclass to receive widget resize events which are passed in the event parameter. When resizeEvent() is called, the widget already has its new geometry. The old size is accessible through QResizeEvent::oldSize().

The widget will be erased and receive a paint event immediately after processing the resize event. No drawing need be (or should be) done inside this handler.

See also
moveEvent(), event(), resize(), QResizeEvent, paintEvent()

Reimplemented from QWidget.

void QAbstractSpinBox::selectAll ( )
slot

Selects all the text in the spinbox except the prefix and suffix.

void QAbstractSpinBox::setAccelerated ( bool  on)

Sets the value for the accelerated property using on.

void QAbstractSpinBox::setAlignment ( Qt::Alignment  flag)

Sets the value for the alignment property using flag.

void QAbstractSpinBox::setButtonSymbols ( ButtonSymbols  symbols)

Sets the value for the button symbols property using symbols.

void QAbstractSpinBox::setCorrectionMode ( CorrectionMode  cm)

Sets the value for the correction mode property using cm.

void QAbstractSpinBox::setFrame ( bool  enable)

Sets the value for the frame property using enable.

void QAbstractSpinBox::setGroupSeparatorShown ( bool  shown)

Property documentation pending.

void QAbstractSpinBox::setKeyboardTracking ( bool  enable)

Sets the value for the keyboard tracking property using enable.

void QAbstractSpinBox::setLineEdit ( QLineEdit lineEdit)
protected

Sets the line edit of the spinbox to be lineEdit instead of the current line edit widget. The given lineEdit can not be a nullptr. If QLineEdit::validator() for the lineEdit returns a nullptr, the internal validator of the spinbox will be set on the line edit.

QAbstractSpinBox takes ownership of the new lineEdit.

See also
lineEdit()
void QAbstractSpinBox::setReadOnly ( bool  enable)

Sets the value for the read only property using enable.

void QAbstractSpinBox::setSpecialValueText ( const QString txt)

Sets the value for the special value property using txt.

void QAbstractSpinBox::setWrapping ( bool  wrapping)

Sets the value for the special-value property using wrapping.

void QAbstractSpinBox::showEvent ( QShowEvent event)
overrideprotectedvirtual

This event handler can be reimplemented in a subclass to receive widget show events which are passed in the event parameter. Non-spontaneous show events are sent to widgets immediately before they are shown. The spontaneous show events of windows are delivered afterwards.

A widget receives spontaneous show and hide events when its mapping status is changed by the window system, e.g. a spontaneous hide event when the user minimizes the window, and a spontaneous show event when the window is restored again. After receiving a spontaneous hide event, a widget is still considered visible in the sense of isVisible().

See also
visible, event(), QShowEvent

Reimplemented from QWidget.

QSize QAbstractSpinBox::sizeHint ( ) const
overridevirtual

Returns the value of the sizeHint property.

Reimplemented from QWidget.

Reimplemented in QDateTimeEdit.

QString QAbstractSpinBox::specialValueText ( ) const

Property documentation pending.

void QAbstractSpinBox::stepBy ( int  steps)
virtual

Virtual method that is called whenever the user triggers a step. The steps parameter indicates how many steps were taken, e.g. Pressing Qt::Key_Down will trigger a call to stepBy(-1), whereas pressing Qt::Key_Prior will trigger a call to stepBy(10).

If you subclass QAbstractSpinBox you must reimplement this method. Note that this method is called even if the resulting value will be outside the bounds of minimum and maximum. It is this method's job to handle these situations.

Reimplemented in QDateTimeEdit.

void QAbstractSpinBox::stepDown ( )
slot

Steps down by one linestep Calling this slot is analogous to calling stepBy(-1);

See also
stepBy(), stepUp()
StepEnabled QAbstractSpinBox::stepEnabled ( ) const
protectedvirtual

Determines whether stepping up and down is legal at any given time.

If wrapping is enabled, this method will return (StepUpEnabled | StepDownEnabled).

If wrapping is disabled and the value of the spin box is equal to the minimum value, this method will return StepUpEnabled. If wrapping is disabled and the value of the spin box is equal to the maximum value, this method will return StepDownEnabled.

If you subclass QAbstractSpinBox you will need to reimplement this method.

See also
QSpinBox::minimum(), QSpinBox::maximum(), wrapping()

Reimplemented in QDateTimeEdit.

void QAbstractSpinBox::stepUp ( )
slot

Steps up by one linestep. Calling this slot is analogous to calling stepBy(1).

See also
stepBy(), stepDown()
QString QAbstractSpinBox::text ( ) const

Property documentation pending.

QValidator::State QAbstractSpinBox::validate ( QString input,
int &  pos 
) const
virtual

This virtual method is called by the QAbstractSpinBox to determine whether input is valid. The pos parameter indicates the position in the string. Reimplemented in the various subclasses.

Reimplemented in QDateTimeEdit, QDoubleSpinBox, and QSpinBox.

void QAbstractSpinBox::wheelEvent ( QWheelEvent event)
overrideprotectedvirtual

This event handler, for event event, can be reimplemented in a subclass to receive wheel events for the widget. If you reimplement this handler, it is very important that you ignore() the event if you do not handle it, so that the widget's parent can interpret it.

The default implementation ignores the event.

See also
QWheelEvent::ignore(), QWheelEvent::accept(), event(), QWheelEvent

Reimplemented from QWidget.

Reimplemented in QDateTimeEdit.

bool QAbstractSpinBox::wrapping ( ) const

Property documentation pending.

Property Documentation

QAbstractSpinBox::accelerated

This property holds whether the spin box will accelerate the frequency of the steps when pressing the step Up/Down buttons.

If enabled the spin box will increase/decrease the value faster the longer you hold the button down.

PropertiesClass Methods
read isAccelerated
write setAccelerated
QAbstractSpinBox::acceptableInput

This property holds whether the input satisfies the current validation.

See also
validate(), fixup(), correctionMode
PropertiesClass Methods
read hasAcceptableInput
QAbstractSpinBox::alignment

This property holds the alignment of the spin box.

Possible Values are Qt::AlignLeft, Qt::AlignRight, and Qt::AlignHCenter. By default, the alignment is Qt::AlignLeft.

Attempting to set the alignment to an illegal flag combination does nothing.

See also
Qt::Alignment
PropertiesClass Methods
read alignment
write setAlignment
QAbstractSpinBox::buttonSymbols

This property holds the current button symbol mode.

The possible values can be either UpDownArrows or PlusMinus. The default is UpDownArrows.

Note that some styles might render PlusMinus and UpDownArrows identically.

See also
ButtonSymbols
PropertiesClass Methods
read buttonSymbols
write setButtonSymbols
QAbstractSpinBox::correctionMode

This property holds the mode to correct an Intermediate value if editing finishes.

The default mode is QAbstractSpinBox::CorrectToPreviousValue.

See also
acceptableInput, validate(), fixup()
PropertiesClass Methods
read correctionMode
write setCorrectionMode
QAbstractSpinBox::frame

This property holds whether the spin box draws itself with a frame. If enabled (the default) the spin box draws itself inside a frame, otherwise the spin box draws itself without any frame.

PropertiesClass Methods
read hasFrame
write setFrame
QAbstractSpinBox::keyboardTracking

This property holds whether keyboard tracking is enabled for the current spinbox. If keyboard tracking is enabled (the default) the spinbox emits the valueChanged() signal while the new value is being entered from the keyboard. For example, when the user enters the value 600 by typing 6, 0, and 0, the spinbox emits 3 signals with the values 6, 60, and 600 respectively.

If keyboard tracking is disabled, the spinbox does not emit the valueChanged() signal while the user is typing. In this case the signal will be emitted later when the return key is pressed, keyboard focus is lost, or when some other other spinbox input occurs.

PropertiesClass Methods
read keyboardTracking
write setKeyboardTracking
QAbstractSpinBox::readOnly

This property holds whether the spin box is read only. In read only mode, the user can still copy the text to the clipboard, or drag and drop the text; but can not edit it.

The QLineEdit in the QAbstractSpinBox does not show a cursor in read-only mode.

See also
QLineEdit::readOnly
PropertiesClass Methods
read isReadOnly
write setReadOnly
QAbstractSpinBox::specialValueText

This property holds the special-value text.

If set, the spin box will display this text instead of a numeric value whenever the current value is equal to minimum(). Typical use is to indicate that this choice has a special (default) meaning. For example, if your spin box allows the user to choose a scale factor (or zoom level) for displaying an image, and your application is able to automatically choose one that will enable the image to fit completely within the display window, you can set up the spin box like this:

QSpinBox *zoomSpinBox = new QSpinBox;
zoomSpinBox->setRange(0, 1000);
zoomSpinBox->setSingleStep(10);
zoomSpinBox->setSuffix("%");
zoomSpinBox->setSpecialValueText(tr("Automatic"));
zoomSpinBox->setValue(100);

The user will then be able to choose a scale from 1% to 1000% or select "Auto" to leave it up to the application to choose. Your code must then interpret the spin box value of 0 as a request from the user to scale the image to fit inside the window.

All values are displayed with the prefix and suffix (if set), except for the special value, which only shows the special value text. This special text is passed in the QSpinBox::valueChanged() signal that passes a QString.

To turn off the special-value text display, call this method with an empty string. The default is no special-value text, i.e. the numeric value is shown as usual.

If no special-value text is set specialValueText() returns an empty string.

PropertiesClass Methods
read specialValueText
write setSpecialValueText
QAbstractSpinBox::text

This property holds the spin box's text, including any prefix and suffix.

There is no default text.

PropertiesClass Methods
read text
QAbstractSpinBox::wrapping

This property holds whether the spin box is circular. If wrapping is true stepping up from maximum() value will take you to the minimum() value and vice versa. Wrapping only make sense if you have minimum() and maximum() values set.

QSpinBox *spinBox = new QSpinBox(this);
spinBox->setRange(0, 100);
spinBox->setWrapping(true);
spinBox->setValue(100);
spinBox->stepBy(1); // value is 0
See also
QSpinBox::minimum(), QSpinBox::maximum()
PropertiesClass Methods
read wrapping
write setWrapping