| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qbuttongroup.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | - | |||||||||||||
| 8 | void QButtonGroupPrivate::detectCheckedButton() | - | ||||||||||||
| 9 | { | - | ||||||||||||
| 10 | QAbstractButton *previous = checkedButton; | - | ||||||||||||
| 11 | checkedButton = 0; | - | ||||||||||||
| 12 | if (exclusive
| 0 | ||||||||||||
| 13 | return; never executed: return; | 0 | ||||||||||||
| 14 | for (int i = 0; i < buttonList.count()
| 0 | ||||||||||||
| 15 | if (buttonList.at(i) != previous
| 0 | ||||||||||||
| 16 | checkedButton = buttonList.at(i); | - | ||||||||||||
| 17 | return; never executed: return; | 0 | ||||||||||||
| 18 | } | - | ||||||||||||
| 19 | } never executed: end of block | 0 | ||||||||||||
| 20 | } never executed: end of block | 0 | ||||||||||||
| 21 | QButtonGroup::QButtonGroup(QObject *parent) | - | ||||||||||||
| 22 | : QObject(*new QButtonGroupPrivate, parent) | - | ||||||||||||
| 23 | { | - | ||||||||||||
| 24 | } never executed: end of block | 0 | ||||||||||||
| 25 | - | |||||||||||||
| 26 | - | |||||||||||||
| 27 | - | |||||||||||||
| 28 | - | |||||||||||||
| 29 | QButtonGroup::~QButtonGroup() | - | ||||||||||||
| 30 | { | - | ||||||||||||
| 31 | QButtonGroupPrivate * const d = d_func(); | - | ||||||||||||
| 32 | for (int i = 0; i < d->buttonList.count()
| 0 | ||||||||||||
| 33 | d->buttonList.at(i)->d_func()->group = 0; never executed: d->buttonList.at(i)->d_func()->group = 0; | 0 | ||||||||||||
| 34 | } never executed: end of block | 0 | ||||||||||||
| 35 | bool QButtonGroup::exclusive() const | - | ||||||||||||
| 36 | { | - | ||||||||||||
| 37 | const QButtonGroupPrivate * const d = d_func(); | - | ||||||||||||
| 38 | return never executed: d->exclusive;return d->exclusive;never executed: return d->exclusive; | 0 | ||||||||||||
| 39 | } | - | ||||||||||||
| 40 | - | |||||||||||||
| 41 | void QButtonGroup::setExclusive(bool exclusive) | - | ||||||||||||
| 42 | { | - | ||||||||||||
| 43 | QButtonGroupPrivate * const d = d_func(); | - | ||||||||||||
| 44 | d->exclusive = exclusive; | - | ||||||||||||
| 45 | } never executed: end of block | 0 | ||||||||||||
| 46 | void QButtonGroup::addButton(QAbstractButton *button, int id) | - | ||||||||||||
| 47 | { | - | ||||||||||||
| 48 | QButtonGroupPrivate * const d = d_func(); | - | ||||||||||||
| 49 | if (QButtonGroup *previous = button->d_func()->group
| 0 | ||||||||||||
| 50 | previous->removeButton(button); never executed: previous->removeButton(button); | 0 | ||||||||||||
| 51 | button->d_func()->group = this; | - | ||||||||||||
| 52 | d->buttonList.append(button); | - | ||||||||||||
| 53 | if (id == -1
| 0 | ||||||||||||
| 54 | const QHash<QAbstractButton*, int>::const_iterator it | - | ||||||||||||
| 55 | = std::min_element(d->mapping.cbegin(), d->mapping.cend()); | - | ||||||||||||
| 56 | if (it == d->mapping.cend()
| 0 | ||||||||||||
| 57 | d->mapping[button] = -2; never executed: d->mapping[button] = -2; | 0 | ||||||||||||
| 58 | else | - | ||||||||||||
| 59 | d->mapping[button] = *it - 1; never executed: d->mapping[button] = *it - 1; | 0 | ||||||||||||
| 60 | } else { | - | ||||||||||||
| 61 | d->mapping[button] = id; | - | ||||||||||||
| 62 | } never executed: end of block | 0 | ||||||||||||
| 63 | - | |||||||||||||
| 64 | if (d->exclusive
| 0 | ||||||||||||
| 65 | button->d_func()->notifyChecked(); never executed: button->d_func()->notifyChecked(); | 0 | ||||||||||||
| 66 | } never executed: end of block | 0 | ||||||||||||
| 67 | - | |||||||||||||
| 68 | - | |||||||||||||
| 69 | - | |||||||||||||
| 70 | - | |||||||||||||
| 71 | - | |||||||||||||
| 72 | - | |||||||||||||
| 73 | void QButtonGroup::removeButton(QAbstractButton *button) | - | ||||||||||||
| 74 | { | - | ||||||||||||
| 75 | QButtonGroupPrivate * const d = d_func(); | - | ||||||||||||
| 76 | if (d->checkedButton == button
| 0 | ||||||||||||
| 77 | d->detectCheckedButton(); | - | ||||||||||||
| 78 | } never executed: end of block | 0 | ||||||||||||
| 79 | if (button->d_func()->group == this
| 0 | ||||||||||||
| 80 | button->d_func()->group = 0; | - | ||||||||||||
| 81 | d->buttonList.removeAll(button); | - | ||||||||||||
| 82 | d->mapping.remove(button); | - | ||||||||||||
| 83 | } never executed: end of block | 0 | ||||||||||||
| 84 | } never executed: end of block | 0 | ||||||||||||
| 85 | - | |||||||||||||
| 86 | - | |||||||||||||
| 87 | - | |||||||||||||
| 88 | - | |||||||||||||
| 89 | - | |||||||||||||
| 90 | - | |||||||||||||
| 91 | QList<QAbstractButton*> QButtonGroup::buttons() const | - | ||||||||||||
| 92 | { | - | ||||||||||||
| 93 | const QButtonGroupPrivate * const d = d_func(); | - | ||||||||||||
| 94 | return never executed: d->buttonList;return d->buttonList;never executed: return d->buttonList; | 0 | ||||||||||||
| 95 | } | - | ||||||||||||
| 96 | - | |||||||||||||
| 97 | - | |||||||||||||
| 98 | - | |||||||||||||
| 99 | - | |||||||||||||
| 100 | - | |||||||||||||
| 101 | - | |||||||||||||
| 102 | - | |||||||||||||
| 103 | QAbstractButton *QButtonGroup::checkedButton() const | - | ||||||||||||
| 104 | { | - | ||||||||||||
| 105 | const QButtonGroupPrivate * const d = d_func(); | - | ||||||||||||
| 106 | return never executed: d->checkedButton;return d->checkedButton;never executed: return d->checkedButton; | 0 | ||||||||||||
| 107 | } | - | ||||||||||||
| 108 | - | |||||||||||||
| 109 | - | |||||||||||||
| 110 | - | |||||||||||||
| 111 | - | |||||||||||||
| 112 | - | |||||||||||||
| 113 | - | |||||||||||||
| 114 | - | |||||||||||||
| 115 | QAbstractButton *QButtonGroup::button(int id) const | - | ||||||||||||
| 116 | { | - | ||||||||||||
| 117 | const QButtonGroupPrivate * const d = d_func(); | - | ||||||||||||
| 118 | return never executed: d->mapping.key(id);return d->mapping.key(id);never executed: return d->mapping.key(id); | 0 | ||||||||||||
| 119 | } | - | ||||||||||||
| 120 | void QButtonGroup::setId(QAbstractButton *button, int id) | - | ||||||||||||
| 121 | { | - | ||||||||||||
| 122 | QButtonGroupPrivate * const d = d_func(); | - | ||||||||||||
| 123 | if (button
| 0 | ||||||||||||
| 124 | d->mapping[button] = id; never executed: d->mapping[button] = id; | 0 | ||||||||||||
| 125 | } never executed: end of block | 0 | ||||||||||||
| 126 | int QButtonGroup::id(QAbstractButton *button) const | - | ||||||||||||
| 127 | { | - | ||||||||||||
| 128 | const QButtonGroupPrivate * const d = d_func(); | - | ||||||||||||
| 129 | return never executed: d->mapping.value(button, -1);return d->mapping.value(button, -1);never executed: return d->mapping.value(button, -1); | 0 | ||||||||||||
| 130 | } | - | ||||||||||||
| 131 | int QButtonGroup::checkedId() const | - | ||||||||||||
| 132 | { | - | ||||||||||||
| 133 | const QButtonGroupPrivate * const d = d_func(); | - | ||||||||||||
| 134 | return never executed: d->mapping.value(d->checkedButton, -1);return d->mapping.value(d->checkedButton, -1);never executed: return d->mapping.value(d->checkedButton, -1); | 0 | ||||||||||||
| 135 | } | - | ||||||||||||
| 136 | - | |||||||||||||
| 137 | - | |||||||||||||
| 138 | - | |||||||||||||
| Switch to Source code | Preprocessed file |