diff options
Diffstat (limited to 'src/widgets/widgets/qcheckbox.cpp')
-rw-r--r-- | src/widgets/widgets/qcheckbox.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/widgets/widgets/qcheckbox.cpp b/src/widgets/widgets/qcheckbox.cpp index cc013c8c7e..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,30 +84,31 @@ 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 */ -#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) /*! \fn void QCheckBox::stateChanged(int 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. */ -#else + /*! - \fn void QCheckBox::stateChanged(Qt::CheckState state) + \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. \a state contains the checkbox's new Qt::CheckState. */ -#endif /*! \property QCheckBox::tristate @@ -237,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) @@ -332,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 } } |