diff options
Diffstat (limited to 'src/widgets/widgets/qcheckbox.cpp')
-rw-r--r-- | src/widgets/widgets/qcheckbox.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/widgets/widgets/qcheckbox.cpp b/src/widgets/widgets/qcheckbox.cpp index 5b44271d48..3c03e9efa5 100644 --- a/src/widgets/widgets/qcheckbox.cpp +++ b/src/widgets/widgets/qcheckbox.cpp @@ -28,7 +28,7 @@ public: uint tristate : 1; uint noChange : 1; uint hovering : 1; - Qt::CheckState publishedState : 2; + Qt::CheckState publishedState : 3; void init(); }; @@ -59,7 +59,7 @@ public: \endtable Whenever a checkbox is checked or cleared, it emits the signal - stateChanged(). Connect to this signal if you want to trigger an action + checkStateChanged(). Connect to this signal if you want to trigger an action each time the checkbox changes state. You can use isChecked() to query whether or not a checkbox is checked. @@ -84,14 +84,25 @@ public: setPixmap(), accel(), setAccel(), isToggleButton(), setDown(), isDown(), isOn(), checkState(), autoRepeat(), isExclusiveToggle(), group(), setAutoRepeat(), toggle(), pressed(), released(), clicked(), toggled(), - checkState(), and stateChanged(). + checkState(), and checkStateChanged(). \sa QAbstractButton, QRadioButton */ /*! \fn void QCheckBox::stateChanged(int state) - //! Qt 7: \fn void QCheckBox::stateChanged(Qt::CheckState state) + + \deprecated [6.9] Use checkStateChanged(Qt::CheckState) instead. + + This signal is emitted whenever the checkbox's state changes, i.e., + whenever the user checks or unchecks it. + + \a state contains the checkbox's new Qt::CheckState. +*/ + +/*! + \fn void QCheckBox::checkStateChanged(Qt::CheckState state) + \since 6.7 This signal is emitted whenever the checkbox's state changes, i.e., whenever the user checks or unchecks it. @@ -227,7 +238,12 @@ void QCheckBox::setCheckState(Qt::CheckState state) d->refresh(); if (state != d->publishedState) { d->publishedState = state; + emit checkStateChanged(state); +#if QT_DEPRECATED_SINCE(6, 9) + QT_IGNORE_DEPRECATIONS( emit stateChanged(state); + ) +#endif } #if QT_CONFIG(accessibility) @@ -322,7 +338,12 @@ void QCheckBox::checkStateSet() Qt::CheckState state = checkState(); if (state != d->publishedState) { d->publishedState = state; + emit checkStateChanged(state); +#if QT_DEPRECATED_SINCE(6, 9) + QT_IGNORE_DEPRECATIONS( emit stateChanged(state); + ) +#endif } } |