diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2023-03-19 20:35:37 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2023-03-21 20:33:10 +0100 |
commit | 37b47ebf946ef1a37573107375fbe5fc0eb1e6d2 (patch) | |
tree | 536e090391cbe07d7c49ab69483e8af0d838eafe /src/widgets | |
parent | 9020034b3b6a3a8118e5959beed699bb8aaa3f95 (diff) |
Widgets/QCheckBox: change signature of stateChanged() for Qt7
Change the signature of stateChanged(int) to emit Qt::CheckState
instead. This was forgotten during Qt6 porting so we have to wait for
Qt7.
Task-number: QTBUG-104688
Change-Id: Ica2504e5b9ae68612de81524faed0f31c9b10402
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/widgets/qcheckbox.cpp | 17 | ||||
-rw-r--r-- | src/widgets/widgets/qcheckbox.h | 4 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/widgets/widgets/qcheckbox.cpp b/src/widgets/widgets/qcheckbox.cpp index 151c8b1e94..cc013c8c7e 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; - uint publishedState : 2; + Qt::CheckState publishedState : 2; void init(); }; @@ -89,6 +89,7 @@ public: \sa QAbstractButton, QRadioButton */ +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) /*! \fn void QCheckBox::stateChanged(int state) @@ -97,6 +98,16 @@ public: \a state contains the checkbox's new Qt::CheckState. */ +#else +/*! + \fn void QCheckBox::stateChanged(Qt::CheckState state) + + 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 @@ -224,7 +235,7 @@ void QCheckBox::setCheckState(Qt::CheckState state) setChecked(state != Qt::Unchecked); d->blockRefresh = false; d->refresh(); - if ((uint)state != d->publishedState) { + if (state != d->publishedState) { d->publishedState = state; emit stateChanged(state); } @@ -319,7 +330,7 @@ void QCheckBox::checkStateSet() Q_D(QCheckBox); d->noChange = false; Qt::CheckState state = checkState(); - if ((uint)state != d->publishedState) { + if (state != d->publishedState) { d->publishedState = state; emit stateChanged(state); } diff --git a/src/widgets/widgets/qcheckbox.h b/src/widgets/widgets/qcheckbox.h index ab240b5500..e385dadbb8 100644 --- a/src/widgets/widgets/qcheckbox.h +++ b/src/widgets/widgets/qcheckbox.h @@ -36,7 +36,11 @@ public: void setCheckState(Qt::CheckState state); Q_SIGNALS: +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) void stateChanged(int); +#else + void stateChanged(Qt::CheckState); +#endif protected: bool event(QEvent *e) override; |