diff options
Diffstat (limited to 'src/widgets/widgets/qabstractbutton.cpp')
-rw-r--r-- | src/widgets/widgets/qabstractbutton.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index 3f9b28a883..cdadde5cc1 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -52,6 +52,8 @@ #include "qaccessible.h" #endif +#include <algorithm> + QT_BEGIN_NAMESPACE #define AUTO_REPEAT_DELAY 300 @@ -231,7 +233,7 @@ void QButtonGroup::addButton(QAbstractButton *button, int id) if (ids.isEmpty()) d->mapping[button] = -2; else { - qSort(ids); + std::sort(ids.begin(), ids.end()); d->mapping[button] = ids.first()-1; } } else { @@ -575,6 +577,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 +774,7 @@ void QAbstractButton::setChecked(bool checked) if (guard && checked) d->notifyChecked(); if (guard) - emit toggled(checked); + d->emitToggled(checked); #ifndef QT_NO_ACCESSIBILITY |