diff options
author | Thorbjørn Martsum <tmartsum@gmail.com> | 2013-08-26 08:57:21 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-28 12:15:43 +0200 |
commit | fd871694e74debc1bde5a7a19c6a5b94f3069bb2 (patch) | |
tree | d5430d2c50432adea3629cae7ca61df967351461 /src/widgets/widgets/qabstractbutton.cpp | |
parent | ea94afca565eb2e9586134c9921af23d1e478bb9 (diff) |
QButtonGroup - add buttonToggled signals
QButtonGroup emits signals on clicked, pressed and released for
buttons in the group, but for some (insuffienct) reason it did
not emit anything for toggle (the only signal that it didn't emit
anything for).
This patch changes that, by adding handling of that signal to
QButtonGroup.
Task-number: QTBUG-14857
Change-Id: I88bcd7b060b78c7ff05ea1adf7baaddfe6d463be
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/widgets/widgets/qabstractbutton.cpp')
-rw-r--r-- | src/widgets/widgets/qabstractbutton.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index 3f9b28a883..be712f0747 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -575,6 +575,20 @@ void QAbstractButtonPrivate::emitReleased() #endif } +void QAbstractButtonPrivate::emitToggled(bool checked) +{ + Q_Q(QAbstractButton); + QPointer<QAbstractButton> guard(q); + emit q->toggled(checked); +#ifndef QT_NO_BUTTONGROUP + if (guard && group) { + emit group->buttonToggled(group->id(q), checked); + if (guard && group) + emit group->buttonToggled(q, checked); + } +#endif +} + /*! Constructs an abstract button with a \a parent. */ @@ -758,7 +772,7 @@ void QAbstractButton::setChecked(bool checked) if (guard && checked) d->notifyChecked(); if (guard) - emit toggled(checked); + d->emitToggled(checked); #ifndef QT_NO_ACCESSIBILITY |