diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-05-13 13:22:21 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-05-13 13:22:21 (GMT) |
commit | f15352c51625688ec445c73125a2e25327377d49 (patch) | |
tree | 0d7d82d8ea8ffeff5cf042cd70af3200ec6f1925 /src/gui/widgets/qabstractbutton.cpp | |
parent | c8c5becc81679eb8a9a0f8baa454bc43fd3cccf9 (diff) | |
parent | 0a74bc2ce91e8c7a10ae54fd0f80814902fa5de9 (diff) | |
download | Qt-f15352c51625688ec445c73125a2e25327377d49.zip Qt-f15352c51625688ec445c73125a2e25327377d49.tar.gz Qt-f15352c51625688ec445c73125a2e25327377d49.tar.bz2 |
Merge commit 'qt/master'
Diffstat (limited to 'src/gui/widgets/qabstractbutton.cpp')
-rw-r--r-- | src/gui/widgets/qabstractbutton.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/gui/widgets/qabstractbutton.cpp b/src/gui/widgets/qabstractbutton.cpp index f2a9ceb..1900016 100644 --- a/src/gui/widgets/qabstractbutton.cpp +++ b/src/gui/widgets/qabstractbutton.cpp @@ -215,11 +215,8 @@ void QButtonGroup::setExclusive(bool exclusive) d->exclusive = exclusive; } -/*! - Adds the given \a button to the end of the group's internal list of buttons. - \sa removeButton() -*/ +// TODO: Qt 5: Merge with addButton(QAbstractButton *button, int id) void QButtonGroup::addButton(QAbstractButton *button) { addButton(button, -1); @@ -232,8 +229,18 @@ void QButtonGroup::addButton(QAbstractButton *button, int id) previous->removeButton(button); button->d_func()->group = this; d->buttonList.append(button); - if (id != -1) + if (id == -1) { + QList<int> ids = d->mapping.values(); + if (ids.isEmpty()) + d->mapping[button] = -2; + else { + qSort(ids); + d->mapping[button] = ids.first()-1; + } + } else { d->mapping[button] = id; + } + if (d->exclusive && button->isChecked()) button->d_func()->notifyChecked(); } |