| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | __attribute__((visibility("default"))) extern bool qt_tab_all_widgets(); | - |
| 10 | QAbstractButtonPrivate::QAbstractButtonPrivate(QSizePolicy::ControlType type) | - |
| 11 | : | - |
| 12 | | - |
| 13 | shortcutId(0), | - |
| 14 | | - |
| 15 | checkable(false), checked(false), autoRepeat(false), autoExclusive(false), | - |
| 16 | down(false), blockRefresh(false), pressed(false), | - |
| 17 | | - |
| 18 | group(0), | - |
| 19 | | - |
| 20 | autoRepeatDelay(300), | - |
| 21 | autoRepeatInterval(100), | - |
| 22 | controlType(type) | - |
| 23 | {} executed: }Execution Count:3970 | 3970 |
| 24 | | - |
| 25 | | - |
| 26 | | - |
| 27 | class QButtonGroupPrivate: public QObjectPrivate | - |
| 28 | { | - |
| 29 | inline QButtonGroup* q_func() { return static_cast<QButtonGroup *>(q_ptr); } inline const QButtonGroup* q_func() const { return static_cast<const QButtonGroup *>(q_ptr); } friend class QButtonGroup; | - |
| 30 | | - |
| 31 | public: | - |
| 32 | QButtonGroupPrivate():exclusive(true){} executed: }Execution Count:9 | 9 |
| 33 | QList<QAbstractButton *> buttonList; | - |
| 34 | QPointer<QAbstractButton> checkedButton; | - |
| 35 | void detectCheckedButton(); | - |
| 36 | void notifyChecked(QAbstractButton *button); | - |
| 37 | bool exclusive; | - |
| 38 | QHash<QAbstractButton*, int> mapping; | - |
| 39 | }; | - |
| 40 | | - |
| 41 | QButtonGroup::QButtonGroup(QObject *parent) | - |
| 42 | : QObject(*new QButtonGroupPrivate, parent) | - |
| 43 | { | - |
| 44 | } executed: }Execution Count:9 | 9 |
| 45 | | - |
| 46 | QButtonGroup::~QButtonGroup() | - |
| 47 | { | - |
| 48 | QButtonGroupPrivate * const d = d_func(); | - |
| 49 | for (int i = 0; i < d->buttonList.count(); ++i) evaluated: i < d->buttonList.count()| yes Evaluation Count:10 | yes Evaluation Count:9 |
| 9-10 |
| 50 | d->buttonList.at(i)->d_func()->group = 0; executed: d->buttonList.at(i)->d_func()->group = 0;Execution Count:10 | 10 |
| 51 | } executed: }Execution Count:9 | 9 |
| 52 | | - |
| 53 | | - |
| 54 | bool QButtonGroup::exclusive() const | - |
| 55 | { | - |
| 56 | const QButtonGroupPrivate * const d = d_func(); | - |
| 57 | return d->exclusive; never executed: return d->exclusive; | 0 |
| 58 | } | - |
| 59 | | - |
| 60 | void QButtonGroup::setExclusive(bool exclusive) | - |
| 61 | { | - |
| 62 | QButtonGroupPrivate * const d = d_func(); | - |
| 63 | d->exclusive = exclusive; | - |
| 64 | } executed: }Execution Count:4 | 4 |
| 65 | | - |
| 66 | | - |
| 67 | void QButtonGroup::addButton(QAbstractButton *button, int id) | - |
| 68 | { | - |
| 69 | QButtonGroupPrivate * const d = d_func(); | - |
| 70 | if (QButtonGroup *previous = button->d_func()->group) partially evaluated: QButtonGroup *previous = button->d_func()->group| no Evaluation Count:0 | yes Evaluation Count:22 |
| 0-22 |
| 71 | previous->removeButton(button); never executed: previous->removeButton(button); | 0 |
| 72 | button->d_func()->group = this; | - |
| 73 | d->buttonList.append(button); | - |
| 74 | if (id == -1) { evaluated: id == -1| yes Evaluation Count:11 | yes Evaluation Count:11 |
| 11 |
| 75 | QList<int> ids = d->mapping.values(); | - |
| 76 | if (ids.isEmpty()) evaluated: ids.isEmpty()| yes Evaluation Count:6 | yes Evaluation Count:5 |
| 5-6 |
| 77 | d->mapping[button] = -2; executed: d->mapping[button] = -2;Execution Count:6 | 6 |
| 78 | else { | - |
| 79 | qSort(ids); | - |
| 80 | d->mapping[button] = ids.first()-1; | - |
| 81 | } executed: }Execution Count:5 | 5 |
| 82 | } else { | - |
| 83 | d->mapping[button] = id; | - |
| 84 | } executed: }Execution Count:11 | 11 |
| 85 | | - |
| 86 | if (d->exclusive && button->isChecked()) evaluated: d->exclusive| yes Evaluation Count:20 | yes Evaluation Count:2 |
partially evaluated: button->isChecked()| no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
| 87 | button->d_func()->notifyChecked(); never executed: button->d_func()->notifyChecked(); | 0 |
| 88 | } executed: }Execution Count:22 | 22 |
| 89 | | - |
| 90 | void QButtonGroup::removeButton(QAbstractButton *button) | - |
| 91 | { | - |
| 92 | QButtonGroupPrivate * const d = d_func(); | - |
| 93 | if (d->checkedButton == button) { evaluated: d->checkedButton == button| yes Evaluation Count:3 | yes Evaluation Count:9 |
| 3-9 |
| 94 | d->detectCheckedButton(); | - |
| 95 | } executed: }Execution Count:3 | 3 |
| 96 | if (button->d_func()->group == this) { partially evaluated: button->d_func()->group == this| yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
| 97 | button->d_func()->group = 0; | - |
| 98 | d->buttonList.removeAll(button); | - |
| 99 | d->mapping.remove(button); | - |
| 100 | } executed: }Execution Count:12 | 12 |
| 101 | } executed: }Execution Count:12 | 12 |
| 102 | | - |
| 103 | QList<QAbstractButton*> QButtonGroup::buttons() const | - |
| 104 | { | - |
| 105 | const QButtonGroupPrivate * const d = d_func(); | - |
| 106 | return d->buttonList; executed: return d->buttonList;Execution Count:1 | 1 |
| 107 | } | - |
| 108 | | - |
| 109 | QAbstractButton *QButtonGroup::checkedButton() const | - |
| 110 | { | - |
| 111 | const QButtonGroupPrivate * const d = d_func(); | - |
| 112 | return d->checkedButton; executed: return d->checkedButton;Execution Count:9 | 9 |
| 113 | } | - |
| 114 | | - |
| 115 | QAbstractButton *QButtonGroup::button(int id) const | - |
| 116 | { | - |
| 117 | const QButtonGroupPrivate * const d = d_func(); | - |
| 118 | return d->mapping.key(id); never executed: return d->mapping.key(id); | 0 |
| 119 | } | - |
| 120 | | - |
| 121 | void QButtonGroup::setId(QAbstractButton *button, int id) | - |
| 122 | { | - |
| 123 | QButtonGroupPrivate * const d = d_func(); | - |
| 124 | if (button && id != -1) never evaluated: id != -1 | 0 |
| 125 | d->mapping[button] = id; never executed: d->mapping[button] = id; | 0 |
| 126 | } | 0 |
| 127 | | - |
| 128 | int QButtonGroup::id(QAbstractButton *button) const | - |
| 129 | { | - |
| 130 | const QButtonGroupPrivate * const d = d_func(); | - |
| 131 | return d->mapping.value(button, -1); executed: return d->mapping.value(button, -1);Execution Count:45 | 45 |
| 132 | } | - |
| 133 | | - |
| 134 | int QButtonGroup::checkedId() const | - |
| 135 | { | - |
| 136 | const QButtonGroupPrivate * const d = d_func(); | - |
| 137 | return d->mapping.value(d->checkedButton, -1); never executed: return d->mapping.value(d->checkedButton, -1); | 0 |
| 138 | } | - |
| 139 | | - |
| 140 | | - |
| 141 | void QButtonGroupPrivate::detectCheckedButton() | - |
| 142 | { | - |
| 143 | QAbstractButton *previous = checkedButton; | - |
| 144 | checkedButton = 0; | - |
| 145 | if (exclusive) evaluated: exclusive| yes Evaluation Count:3 | yes Evaluation Count:2 |
| 2-3 |
| 146 | return; executed: return;Execution Count:3 | 3 |
| 147 | for (int i = 0; i < buttonList.count(); i++) { evaluated: i < buttonList.count()| yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
| 148 | if (buttonList.at(i) != previous && buttonList.at(i)->isChecked()) { evaluated: buttonList.at(i) != previous| yes Evaluation Count:2 | yes Evaluation Count:1 |
evaluated: buttonList.at(i)->isChecked()| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1-2 |
| 149 | checkedButton = buttonList.at(i); | - |
| 150 | return; executed: return;Execution Count:1 | 1 |
| 151 | } | - |
| 152 | } executed: }Execution Count:2 | 2 |
| 153 | } executed: }Execution Count:1 | 1 |
| 154 | | - |
| 155 | | - |
| 156 | | - |
| 157 | QList<QAbstractButton *>QAbstractButtonPrivate::queryButtonList() const | - |
| 158 | { | - |
| 159 | | - |
| 160 | if (group) evaluated: group| yes Evaluation Count:18 | yes Evaluation Count:38 |
| 18-38 |
| 161 | return group->d_func()->buttonList; executed: return group->d_func()->buttonList;Execution Count:18 | 18 |
| 162 | | - |
| 163 | | - |
| 164 | QList<QAbstractButton*>candidates = parent->findChildren<QAbstractButton *>(); | - |
| 165 | if (autoExclusive) { evaluated: autoExclusive| yes Evaluation Count:22 | yes Evaluation Count:16 |
| 16-22 |
| 166 | for (int i = candidates.count() - 1; i >= 0; --i) { evaluated: i >= 0| yes Evaluation Count:47 | yes Evaluation Count:22 |
| 22-47 |
| 167 | QAbstractButton *candidate = candidates.at(i); | - |
| 168 | if (!candidate->autoExclusive() evaluated: !candidate->autoExclusive()| yes Evaluation Count:10 | yes Evaluation Count:37 |
| 10-37 |
| 169 | | - |
| 170 | || candidate->group() partially evaluated: candidate->group()| no Evaluation Count:0 | yes Evaluation Count:37 |
| 0-37 |
| 171 | | - |
| 172 | ) | - |
| 173 | candidates.removeAt(i); executed: candidates.removeAt(i);Execution Count:10 | 10 |
| 174 | } executed: }Execution Count:47 | 47 |
| 175 | } executed: }Execution Count:22 | 22 |
| 176 | return candidates; executed: return candidates;Execution Count:38 | 38 |
| 177 | } | - |
| 178 | | - |
| 179 | QAbstractButton *QAbstractButtonPrivate::queryCheckedButton() const | - |
| 180 | { | - |
| 181 | | - |
| 182 | if (group) evaluated: group| yes Evaluation Count:12 | yes Evaluation Count:30 |
| 12-30 |
| 183 | return group->d_func()->checkedButton; executed: return group->d_func()->checkedButton;Execution Count:12 | 12 |
| 184 | | - |
| 185 | | - |
| 186 | const QAbstractButton * const q = q_func(); | - |
| 187 | QList<QAbstractButton *> buttonList = queryButtonList(); | - |
| 188 | if (!autoExclusive || buttonList.count() == 1) evaluated: !autoExclusive| yes Evaluation Count:16 | yes Evaluation Count:14 |
evaluated: buttonList.count() == 1| yes Evaluation Count:8 | yes Evaluation Count:6 |
| 6-16 |
| 189 | return 0; executed: return 0;Execution Count:24 | 24 |
| 190 | | - |
| 191 | for (int i = 0; i < buttonList.count(); ++i) { evaluated: i < buttonList.count()| yes Evaluation Count:12 | yes Evaluation Count:6 |
| 6-12 |
| 192 | QAbstractButton *b = buttonList.at(i); | - |
| 193 | if (b->d_func()->checked && b != q) evaluated: b->d_func()->checked| yes Evaluation Count:6 | yes Evaluation Count:6 |
partially evaluated: b != q| no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
| 194 | return b; never executed: return b; | 0 |
| 195 | } executed: }Execution Count:12 | 12 |
| 196 | return checked ? const_cast<QAbstractButton *>(q) : 0; executed: return checked ? const_cast<QAbstractButton *>(q) : 0;Execution Count:6 | 6 |
| 197 | } | - |
| 198 | | - |
| 199 | void QAbstractButtonPrivate::notifyChecked() | - |
| 200 | { | - |
| 201 | | - |
| 202 | QAbstractButton * const q = q_func(); | - |
| 203 | if (group) { evaluated: group| yes Evaluation Count:16 | yes Evaluation Count:27 |
| 16-27 |
| 204 | QAbstractButton *previous = group->d_func()->checkedButton; | - |
| 205 | group->d_func()->checkedButton = q; | - |
| 206 | if (group->d_func()->exclusive && previous && previous != q) evaluated: group->d_func()->exclusive| yes Evaluation Count:14 | yes Evaluation Count:2 |
evaluated: previous| yes Evaluation Count:9 | yes Evaluation Count:5 |
partially evaluated: previous != q| yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-14 |
| 207 | previous->nextCheckState(); executed: previous->nextCheckState();Execution Count:9 | 9 |
| 208 | } else executed: }Execution Count:16 | 16 |
| 209 | | - |
| 210 | if (autoExclusive) { evaluated: autoExclusive| yes Evaluation Count:11 | yes Evaluation Count:16 |
| 11-16 |
| 211 | if (QAbstractButton *b = queryCheckedButton()) evaluated: QAbstractButton *b = queryCheckedButton()| yes Evaluation Count:3 | yes Evaluation Count:8 |
| 3-8 |
| 212 | b->setChecked(false); executed: b->setChecked(false);Execution Count:3 | 3 |
| 213 | } executed: }Execution Count:11 | 11 |
| 214 | } | - |
| 215 | | - |
| 216 | void QAbstractButtonPrivate::moveFocus(int key) | - |
| 217 | { | - |
| 218 | QList<QAbstractButton *> buttonList = queryButtonList();; | - |
| 219 | | - |
| 220 | bool exclusive = group ? group->d_func()->exclusive : autoExclusive; evaluated: group| yes Evaluation Count:9 | yes Evaluation Count:4 |
| 4-9 |
| 221 | | - |
| 222 | | - |
| 223 | | - |
| 224 | QWidget *f = QApplication::focusWidget(); | - |
| 225 | QAbstractButton *fb = qobject_cast<QAbstractButton *>(f); | - |
| 226 | if (!fb || !buttonList.contains(fb)) partially evaluated: !fb| no Evaluation Count:0 | yes Evaluation Count:13 |
partially evaluated: !buttonList.contains(fb)| no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
| 227 | return; | 0 |
| 228 | | - |
| 229 | QAbstractButton *candidate = 0; | - |
| 230 | int bestScore = -1; | - |
| 231 | QRect target = f->rect().translated(f->mapToGlobal(QPoint(0,0))); | - |
| 232 | QPoint goal = target.center(); | - |
| 233 | uint focus_flag = qt_tab_all_widgets() ? Qt::TabFocus : Qt::StrongFocus; partially evaluated: qt_tab_all_widgets()| yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-13 |
| 234 | | - |
| 235 | for (int i = 0; i < buttonList.count(); ++i) { evaluated: i < buttonList.count()| yes Evaluation Count:35 | yes Evaluation Count:13 |
| 13-35 |
| 236 | QAbstractButton *button = buttonList.at(i); | - |
| 237 | if (button != f && button->window() == f->window() && button->isEnabled() && !button->isHidden() && evaluated: button != f| yes Evaluation Count:22 | yes Evaluation Count:13 |
partially evaluated: button->window() == f->window()| yes Evaluation Count:22 | no Evaluation Count:0 |
partially evaluated: button->isEnabled()| yes Evaluation Count:22 | no Evaluation Count:0 |
partially evaluated: !button->isHidden()| yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-22 |
| 238 | (autoExclusive || (button->focusPolicy() & focus_flag) == focus_flag)) { evaluated: autoExclusive| yes Evaluation Count:18 | yes Evaluation Count:4 |
partially evaluated: (button->focusPolicy() & focus_flag) == focus_flag| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-18 |
| 239 | QRect buttonRect = button->rect().translated(button->mapToGlobal(QPoint(0,0))); | - |
| 240 | QPoint p = buttonRect.center(); | - |
| 241 | | - |
| 242 | | - |
| 243 | | - |
| 244 | | - |
| 245 | int score; | - |
| 246 | if ((buttonRect.x() < target.right() && target.x() < buttonRect.right()) evaluated: buttonRect.x() < target.right()| yes Evaluation Count:18 | yes Evaluation Count:4 |
evaluated: target.x() < buttonRect.right()| yes Evaluation Count:12 | yes Evaluation Count:6 |
| 4-18 |
| 247 | && (key == Qt::Key_Up || key == Qt::Key_Down)) { evaluated: key == Qt::Key_Up| yes Evaluation Count:2 | yes Evaluation Count:10 |
partially evaluated: key == Qt::Key_Down| yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
| 248 | | - |
| 249 | score = (qAbs(p.y() - goal.y()) << 16) + qAbs(p.x() - goal.x()); | - |
| 250 | } else if ((buttonRect.y() < target.bottom() && target.y() < buttonRect.bottom()) partially evaluated: buttonRect.y() < target.bottom()| yes Evaluation Count:10 | no Evaluation Count:0 |
partially evaluated: target.y() < buttonRect.bottom()| yes Evaluation Count:10 | no Evaluation Count:0 |
executed: }Execution Count:12 | 0-12 |
| 251 | && (key == Qt::Key_Left || key == Qt::Key_Right) ) { evaluated: key == Qt::Key_Left| yes Evaluation Count:4 | yes Evaluation Count:6 |
partially evaluated: key == Qt::Key_Right| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 252 | | - |
| 253 | score = (qAbs(p.x() - goal.x()) << 16) + qAbs(p.y() - goal.y()); | - |
| 254 | } else { executed: }Execution Count:10 | 10 |
| 255 | score = (1 << 30) + (p.y() - goal.y()) * (p.y() - goal.y()) + (p.x() - goal.x()) * (p.x() - goal.x()); | - |
| 256 | } | 0 |
| 257 | | - |
| 258 | if (score > bestScore && candidate) evaluated: score > bestScore| yes Evaluation Count:21 | yes Evaluation Count:1 |
evaluated: candidate| yes Evaluation Count:4 | yes Evaluation Count:17 |
| 1-21 |
| 259 | continue; executed: continue;Execution Count:4 | 4 |
| 260 | | - |
| 261 | switch(key) { | - |
| 262 | case Qt::Key_Up: | - |
| 263 | if (p.y() < goal.y()) { evaluated: p.y() < goal.y()| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 264 | candidate = button; | - |
| 265 | bestScore = score; | - |
| 266 | } executed: }Execution Count:1 | 1 |
| 267 | break; executed: break;Execution Count:2 | 2 |
| 268 | case Qt::Key_Down: | - |
| 269 | if (p.y() > goal.y()) { evaluated: p.y() > goal.y()| yes Evaluation Count:5 | yes Evaluation Count:3 |
| 3-5 |
| 270 | candidate = button; | - |
| 271 | bestScore = score; | - |
| 272 | } executed: }Execution Count:5 | 5 |
| 273 | break; executed: break;Execution Count:8 | 8 |
| 274 | case Qt::Key_Left: | - |
| 275 | if (p.x() < goal.x()) { partially evaluated: p.x() < goal.x()| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
| 276 | candidate = button; | - |
| 277 | bestScore = score; | - |
| 278 | } executed: }Execution Count:3 | 3 |
| 279 | break; executed: break;Execution Count:3 | 3 |
| 280 | case Qt::Key_Right: | - |
| 281 | if (p.x() > goal.x()) { evaluated: p.x() > goal.x()| yes Evaluation Count:2 | yes Evaluation Count:3 |
| 2-3 |
| 282 | candidate = button; | - |
| 283 | bestScore = score; | - |
| 284 | } executed: }Execution Count:2 | 2 |
| 285 | break; executed: break;Execution Count:5 | 5 |
| 286 | } | - |
| 287 | } executed: }Execution Count:18 | 18 |
| 288 | } executed: }Execution Count:31 | 31 |
| 289 | | - |
| 290 | if (exclusive partially evaluated: exclusive| yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-13 |
| 291 | | - |
| 292 | | - |
| 293 | | - |
| 294 | && candidate evaluated: candidate| yes Evaluation Count:10 | yes Evaluation Count:3 |
| 3-10 |
| 295 | && fb->d_func()->checked evaluated: fb->d_func()->checked| yes Evaluation Count:2 | yes Evaluation Count:8 |
| 2-8 |
| 296 | && candidate->d_func()->checkable) partially evaluated: candidate->d_func()->checkable| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 297 | candidate->click(); executed: candidate->click();Execution Count:2 | 2 |
| 298 | | - |
| 299 | if (candidate) { evaluated: candidate| yes Evaluation Count:10 | yes Evaluation Count:3 |
| 3-10 |
| 300 | if (key == Qt::Key_Up || key == Qt::Key_Left) evaluated: key == Qt::Key_Up| yes Evaluation Count:1 | yes Evaluation Count:9 |
evaluated: key == Qt::Key_Left| yes Evaluation Count:2 | yes Evaluation Count:7 |
| 1-9 |
| 301 | candidate->setFocus(Qt::BacktabFocusReason); executed: candidate->setFocus(Qt::BacktabFocusReason);Execution Count:3 | 3 |
| 302 | else | - |
| 303 | candidate->setFocus(Qt::TabFocusReason); executed: candidate->setFocus(Qt::TabFocusReason);Execution Count:7 | 7 |
| 304 | } | - |
| 305 | } executed: }Execution Count:13 | 13 |
| 306 | | - |
| 307 | void QAbstractButtonPrivate::fixFocusPolicy() | - |
| 308 | { | - |
| 309 | QAbstractButton * const q = q_func(); | - |
| 310 | | - |
| 311 | if (!group && !autoExclusive) evaluated: !group| yes Evaluation Count:231 | yes Evaluation Count:9 |
evaluated: !autoExclusive| yes Evaluation Count:227 | yes Evaluation Count:4 |
| 4-231 |
| 312 | | - |
| 313 | | - |
| 314 | | - |
| 315 | return; executed: return;Execution Count:227 | 227 |
| 316 | | - |
| 317 | QList<QAbstractButton *> buttonList = queryButtonList(); | - |
| 318 | for (int i = 0; i < buttonList.count(); ++i) { evaluated: i < buttonList.count()| yes Evaluation Count:36 | yes Evaluation Count:13 |
| 13-36 |
| 319 | QAbstractButton *b = buttonList.at(i); | - |
| 320 | if (!b->isCheckable()) evaluated: !b->isCheckable()| yes Evaluation Count:7 | yes Evaluation Count:29 |
| 7-29 |
| 321 | continue; executed: continue;Execution Count:7 | 7 |
| 322 | b->setFocusPolicy((Qt::FocusPolicy) ((b == q || !q->isCheckable()) | - |
| 323 | ? (b->focusPolicy() | Qt::TabFocus) | - |
| 324 | : (b->focusPolicy() & ~Qt::TabFocus))); | - |
| 325 | } executed: }Execution Count:29 | 29 |
| 326 | } executed: }Execution Count:13 | 13 |
| 327 | | - |
| 328 | void QAbstractButtonPrivate::init() | - |
| 329 | { | - |
| 330 | QAbstractButton * const q = q_func(); | - |
| 331 | | - |
| 332 | q->setFocusPolicy(Qt::FocusPolicy(q->style()->styleHint(QStyle::SH_Button_FocusPolicy))); | - |
| 333 | q->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed, controlType)); | - |
| 334 | q->setAttribute(Qt::WA_WState_OwnSizePolicy, false); | - |
| 335 | q->setForegroundRole(QPalette::ButtonText); | - |
| 336 | q->setBackgroundRole(QPalette::Button); | - |
| 337 | } executed: }Execution Count:3970 | 3970 |
| 338 | | - |
| 339 | void QAbstractButtonPrivate::refresh() | - |
| 340 | { | - |
| 341 | QAbstractButton * const q = q_func(); | - |
| 342 | | - |
| 343 | if (blockRefresh) evaluated: blockRefresh| yes Evaluation Count:15 | yes Evaluation Count:534 |
| 15-534 |
| 344 | return; executed: return;Execution Count:15 | 15 |
| 345 | q->update(); | - |
| 346 | } executed: }Execution Count:534 | 534 |
| 347 | | - |
| 348 | void QAbstractButtonPrivate::click() | - |
| 349 | { | - |
| 350 | QAbstractButton * const q = q_func(); | - |
| 351 | | - |
| 352 | down = false; | - |
| 353 | blockRefresh = true; | - |
| 354 | bool changeState = true; | - |
| 355 | if (checked && queryCheckedButton() == q) { evaluated: checked| yes Evaluation Count:1 | yes Evaluation Count:125 |
partially evaluated: queryCheckedButton() == q| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-125 |
| 356 | | - |
| 357 | | - |
| 358 | if (group ? group->d_func()->exclusive : autoExclusive) | 0 |
| 359 | | - |
| 360 | | - |
| 361 | | - |
| 362 | changeState = false; never executed: changeState = false; | 0 |
| 363 | } | 0 |
| 364 | | - |
| 365 | QPointer<QAbstractButton> guard(q); | - |
| 366 | if (changeState) { partially evaluated: changeState| yes Evaluation Count:126 | no Evaluation Count:0 |
| 0-126 |
| 367 | q->nextCheckState(); | - |
| 368 | if (!guard) partially evaluated: !guard| no Evaluation Count:0 | yes Evaluation Count:126 |
| 0-126 |
| 369 | return; | 0 |
| 370 | } executed: }Execution Count:126 | 126 |
| 371 | blockRefresh = false; | - |
| 372 | refresh(); | - |
| 373 | q->repaint(); | - |
| 374 | QApplication::flush(); | - |
| 375 | if (guard) partially evaluated: guard| yes Evaluation Count:126 | no Evaluation Count:0 |
| 0-126 |
| 376 | emitReleased(); executed: emitReleased();Execution Count:126 | 126 |
| 377 | if (guard) partially evaluated: guard| yes Evaluation Count:126 | no Evaluation Count:0 |
| 0-126 |
| 378 | emitClicked(); executed: emitClicked();Execution Count:126 | 126 |
| 379 | } executed: }Execution Count:126 | 126 |
| 380 | | - |
| 381 | void QAbstractButtonPrivate::emitClicked() | - |
| 382 | { | - |
| 383 | QAbstractButton * const q = q_func(); | - |
| 384 | QPointer<QAbstractButton> guard(q); | - |
| 385 | q->clicked(checked); | - |
| 386 | | - |
| 387 | if (guard && group) { partially evaluated: guard| yes Evaluation Count:246 | no Evaluation Count:0 |
evaluated: group| yes Evaluation Count:14 | yes Evaluation Count:232 |
| 0-246 |
| 388 | group->buttonClicked(group->id(q)); | - |
| 389 | if (guard && group) partially evaluated: guard| yes Evaluation Count:14 | no Evaluation Count:0 |
evaluated: group| yes Evaluation Count:13 | yes Evaluation Count:1 |
| 0-14 |
| 390 | group->buttonClicked(q); executed: group->buttonClicked(q);Execution Count:13 | 13 |
| 391 | } executed: }Execution Count:14 | 14 |
| 392 | | - |
| 393 | } executed: }Execution Count:246 | 246 |
| 394 | | - |
| 395 | void QAbstractButtonPrivate::emitPressed() | - |
| 396 | { | - |
| 397 | QAbstractButton * const q = q_func(); | - |
| 398 | QPointer<QAbstractButton> guard(q); | - |
| 399 | q->pressed(); | - |
| 400 | | - |
| 401 | if (guard && group) { evaluated: guard| yes Evaluation Count:261 | yes Evaluation Count:2 |
evaluated: group| yes Evaluation Count:14 | yes Evaluation Count:247 |
| 2-261 |
| 402 | group->buttonPressed(group->id(q)); | - |
| 403 | if (guard && group) partially evaluated: guard| yes Evaluation Count:14 | no Evaluation Count:0 |
partially evaluated: group| yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
| 404 | group->buttonPressed(q); executed: group->buttonPressed(q);Execution Count:14 | 14 |
| 405 | } executed: }Execution Count:14 | 14 |
| 406 | | - |
| 407 | } executed: }Execution Count:263 | 263 |
| 408 | | - |
| 409 | void QAbstractButtonPrivate::emitReleased() | - |
| 410 | { | - |
| 411 | QAbstractButton * const q = q_func(); | - |
| 412 | QPointer<QAbstractButton> guard(q); | - |
| 413 | q->released(); | - |
| 414 | | - |
| 415 | if (guard && group) { partially evaluated: guard| yes Evaluation Count:249 | no Evaluation Count:0 |
evaluated: group| yes Evaluation Count:14 | yes Evaluation Count:235 |
| 0-249 |
| 416 | group->buttonReleased(group->id(q)); | - |
| 417 | if (guard && group) partially evaluated: guard| yes Evaluation Count:14 | no Evaluation Count:0 |
partially evaluated: group| yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
| 418 | group->buttonReleased(q); executed: group->buttonReleased(q);Execution Count:14 | 14 |
| 419 | } executed: }Execution Count:14 | 14 |
| 420 | | - |
| 421 | } executed: }Execution Count:249 | 249 |
| 422 | | - |
| 423 | | - |
| 424 | | - |
| 425 | | - |
| 426 | QAbstractButton::QAbstractButton(QWidget *parent) | - |
| 427 | : QWidget(*new QAbstractButtonPrivate, parent, 0) | - |
| 428 | { | - |
| 429 | QAbstractButtonPrivate * const d = d_func(); | - |
| 430 | d->init(); | - |
| 431 | } executed: }Execution Count:563 | 563 |
| 432 | | - |
| 433 | | - |
| 434 | | - |
| 435 | | - |
| 436 | QAbstractButton::~QAbstractButton() | - |
| 437 | { | - |
| 438 | | - |
| 439 | QAbstractButtonPrivate * const d = d_func(); | - |
| 440 | if (d->group) evaluated: d->group| yes Evaluation Count:11 | yes Evaluation Count:3841 |
| 11-3841 |
| 441 | d->group->removeButton(this); executed: d->group->removeButton(this);Execution Count:11 | 11 |
| 442 | | - |
| 443 | } executed: }Execution Count:3852 | 3852 |
| 444 | | - |
| 445 | | - |
| 446 | | - |
| 447 | | - |
| 448 | QAbstractButton::QAbstractButton(QAbstractButtonPrivate &dd, QWidget *parent) | - |
| 449 | : QWidget(dd, parent, 0) | - |
| 450 | { | - |
| 451 | QAbstractButtonPrivate * const d = d_func(); | - |
| 452 | d->init(); | - |
| 453 | } executed: }Execution Count:3407 | 3407 |
| 454 | void QAbstractButton::setText(const QString &text) | - |
| 455 | { | - |
| 456 | QAbstractButtonPrivate * const d = d_func(); | - |
| 457 | if (d->text == text) evaluated: d->text == text| yes Evaluation Count:2931 | yes Evaluation Count:2660 |
| 2660-2931 |
| 458 | return; executed: return;Execution Count:2931 | 2931 |
| 459 | d->text = text; | - |
| 460 | | - |
| 461 | QKeySequence newMnemonic = QKeySequence::mnemonic(text); | - |
| 462 | setShortcut(newMnemonic); | - |
| 463 | | - |
| 464 | d->sizeHint = QSize(); | - |
| 465 | update(); | - |
| 466 | updateGeometry(); | - |
| 467 | | - |
| 468 | QAccessibleEvent event(this, QAccessible::NameChanged); | - |
| 469 | QAccessible::updateAccessibility(&event); | - |
| 470 | | - |
| 471 | } executed: }Execution Count:2660 | 2660 |
| 472 | | - |
| 473 | QString QAbstractButton::text() const | - |
| 474 | { | - |
| 475 | const QAbstractButtonPrivate * const d = d_func(); | - |
| 476 | return d->text; executed: return d->text;Execution Count:1417 | 1417 |
| 477 | } | - |
| 478 | void QAbstractButton::setIcon(const QIcon &icon) | - |
| 479 | { | - |
| 480 | QAbstractButtonPrivate * const d = d_func(); | - |
| 481 | d->icon = icon; | - |
| 482 | d->sizeHint = QSize(); | - |
| 483 | update(); | - |
| 484 | updateGeometry(); | - |
| 485 | } executed: }Execution Count:1462 | 1462 |
| 486 | | - |
| 487 | QIcon QAbstractButton::icon() const | - |
| 488 | { | - |
| 489 | const QAbstractButtonPrivate * const d = d_func(); | - |
| 490 | return d->icon; executed: return d->icon;Execution Count:10731 | 10731 |
| 491 | } | - |
| 492 | | - |
| 493 | | - |
| 494 | | - |
| 495 | | - |
| 496 | | - |
| 497 | | - |
| 498 | | - |
| 499 | void QAbstractButton::setShortcut(const QKeySequence &key) | - |
| 500 | { | - |
| 501 | QAbstractButtonPrivate * const d = d_func(); | - |
| 502 | if (d->shortcutId != 0) evaluated: d->shortcutId != 0| yes Evaluation Count:51 | yes Evaluation Count:2666 |
| 51-2666 |
| 503 | releaseShortcut(d->shortcutId); executed: releaseShortcut(d->shortcutId);Execution Count:51 | 51 |
| 504 | d->shortcut = key; | - |
| 505 | d->shortcutId = grabShortcut(key); | - |
| 506 | } executed: }Execution Count:2717 | 2717 |
| 507 | | - |
| 508 | QKeySequence QAbstractButton::shortcut() const | - |
| 509 | { | - |
| 510 | const QAbstractButtonPrivate * const d = d_func(); | - |
| 511 | return d->shortcut; executed: return d->shortcut;Execution Count:54 | 54 |
| 512 | } | - |
| 513 | void QAbstractButton::setCheckable(bool checkable) | - |
| 514 | { | - |
| 515 | QAbstractButtonPrivate * const d = d_func(); | - |
| 516 | if (d->checkable == checkable) evaluated: d->checkable == checkable| yes Evaluation Count:15 | yes Evaluation Count:109 |
| 15-109 |
| 517 | return; executed: return;Execution Count:15 | 15 |
| 518 | | - |
| 519 | d->checkable = checkable; | - |
| 520 | d->checked = false; | - |
| 521 | } executed: }Execution Count:109 | 109 |
| 522 | | - |
| 523 | bool QAbstractButton::isCheckable() const | - |
| 524 | { | - |
| 525 | const QAbstractButtonPrivate * const d = d_func(); | - |
| 526 | return d->checkable; executed: return d->checkable;Execution Count:344 | 344 |
| 527 | } | - |
| 528 | void QAbstractButton::setChecked(bool checked) | - |
| 529 | { | - |
| 530 | QAbstractButtonPrivate * const d = d_func(); | - |
| 531 | if (!d->checkable || d->checked == checked) { evaluated: !d->checkable| yes Evaluation Count:18 | yes Evaluation Count:114 |
evaluated: d->checked == checked| yes Evaluation Count:41 | yes Evaluation Count:73 |
| 18-114 |
| 532 | if (!d->blockRefresh) evaluated: !d->blockRefresh| yes Evaluation Count:57 | yes Evaluation Count:2 |
| 2-57 |
| 533 | checkStateSet(); executed: checkStateSet();Execution Count:57 | 57 |
| 534 | return; executed: return;Execution Count:59 | 59 |
| 535 | } | - |
| 536 | | - |
| 537 | if (!checked && d->queryCheckedButton() == this) { evaluated: !checked| yes Evaluation Count:30 | yes Evaluation Count:43 |
evaluated: d->queryCheckedButton() == this| yes Evaluation Count:6 | yes Evaluation Count:24 |
| 6-43 |
| 538 | | - |
| 539 | | - |
| 540 | if (d->group ? d->group->d_func()->exclusive : d->autoExclusive) evaluated: d->group| yes Evaluation Count:3 | yes Evaluation Count:3 |
| 3 |
| 541 | return; executed: return;Execution Count:4 | 4 |
| 542 | if (d->group) partially evaluated: d->group| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 543 | d->group->d_func()->detectCheckedButton(); executed: d->group->d_func()->detectCheckedButton();Execution Count:2 | 2 |
| 544 | | - |
| 545 | | - |
| 546 | | - |
| 547 | | - |
| 548 | } executed: }Execution Count:2 | 2 |
| 549 | | - |
| 550 | QPointer<QAbstractButton> guard(this); | - |
| 551 | | - |
| 552 | d->checked = checked; | - |
| 553 | if (!d->blockRefresh) evaluated: !d->blockRefresh| yes Evaluation Count:54 | yes Evaluation Count:15 |
| 15-54 |
| 554 | checkStateSet(); executed: checkStateSet();Execution Count:54 | 54 |
| 555 | d->refresh(); | - |
| 556 | | - |
| 557 | if (guard && checked) partially evaluated: guard| yes Evaluation Count:69 | no Evaluation Count:0 |
evaluated: checked| yes Evaluation Count:43 | yes Evaluation Count:26 |
| 0-69 |
| 558 | d->notifyChecked(); executed: d->notifyChecked();Execution Count:43 | 43 |
| 559 | if (guard) partially evaluated: guard| yes Evaluation Count:69 | no Evaluation Count:0 |
| 0-69 |
| 560 | toggled(checked); executed: toggled(checked);Execution Count:69 | 69 |
| 561 | | - |
| 562 | | - |
| 563 | | - |
| 564 | QAccessible::State s; | - |
| 565 | s.checked = true; | - |
| 566 | QAccessibleStateChangeEvent event(this, s); | - |
| 567 | QAccessible::updateAccessibility(&event); | - |
| 568 | | - |
| 569 | } executed: }Execution Count:69 | 69 |
| 570 | | - |
| 571 | bool QAbstractButton::isChecked() const | - |
| 572 | { | - |
| 573 | const QAbstractButtonPrivate * const d = d_func(); | - |
| 574 | return d->checked; executed: return d->checked;Execution Count:1065 | 1065 |
| 575 | } | - |
| 576 | void QAbstractButton::setDown(bool down) | - |
| 577 | { | - |
| 578 | QAbstractButtonPrivate * const d = d_func(); | - |
| 579 | if (d->down == down) evaluated: d->down == down| yes Evaluation Count:2037 | yes Evaluation Count:347 |
| 347-2037 |
| 580 | return; executed: return;Execution Count:2037 | 2037 |
| 581 | d->down = down; | - |
| 582 | d->refresh(); | - |
| 583 | if (d->autoRepeat && d->down) evaluated: d->autoRepeat| yes Evaluation Count:22 | yes Evaluation Count:325 |
partially evaluated: d->down| yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-325 |
| 584 | d->repeatTimer.start(d->autoRepeatDelay, this); executed: d->repeatTimer.start(d->autoRepeatDelay, this);Execution Count:22 | 22 |
| 585 | else | - |
| 586 | d->repeatTimer.stop(); executed: d->repeatTimer.stop();Execution Count:325 | 325 |
| 587 | } | - |
| 588 | | - |
| 589 | bool QAbstractButton::isDown() const | - |
| 590 | { | - |
| 591 | const QAbstractButtonPrivate * const d = d_func(); | - |
| 592 | return d->down; executed: return d->down;Execution Count:418 | 418 |
| 593 | } | - |
| 594 | void QAbstractButton::setAutoRepeat(bool autoRepeat) | - |
| 595 | { | - |
| 596 | QAbstractButtonPrivate * const d = d_func(); | - |
| 597 | if (d->autoRepeat == autoRepeat) evaluated: d->autoRepeat == autoRepeat| yes Evaluation Count:68 | yes Evaluation Count:304 |
| 68-304 |
| 598 | return; executed: return;Execution Count:68 | 68 |
| 599 | d->autoRepeat = autoRepeat; | - |
| 600 | if (d->autoRepeat && d->down) evaluated: d->autoRepeat| yes Evaluation Count:295 | yes Evaluation Count:9 |
partially evaluated: d->down| no Evaluation Count:0 | yes Evaluation Count:295 |
| 0-295 |
| 601 | d->repeatTimer.start(d->autoRepeatDelay, this); never executed: d->repeatTimer.start(d->autoRepeatDelay, this); | 0 |
| 602 | else | - |
| 603 | d->repeatTimer.stop(); executed: d->repeatTimer.stop();Execution Count:304 | 304 |
| 604 | } | - |
| 605 | | - |
| 606 | bool QAbstractButton::autoRepeat() const | - |
| 607 | { | - |
| 608 | const QAbstractButtonPrivate * const d = d_func(); | - |
| 609 | return d->autoRepeat; executed: return d->autoRepeat;Execution Count:11 | 11 |
| 610 | } | - |
| 611 | void QAbstractButton::setAutoRepeatDelay(int autoRepeatDelay) | - |
| 612 | { | - |
| 613 | QAbstractButtonPrivate * const d = d_func(); | - |
| 614 | d->autoRepeatDelay = autoRepeatDelay; | - |
| 615 | } | 0 |
| 616 | | - |
| 617 | int QAbstractButton::autoRepeatDelay() const | - |
| 618 | { | - |
| 619 | const QAbstractButtonPrivate * const d = d_func(); | - |
| 620 | return d->autoRepeatDelay; executed: return d->autoRepeatDelay;Execution Count:1 | 1 |
| 621 | } | - |
| 622 | void QAbstractButton::setAutoRepeatInterval(int autoRepeatInterval) | - |
| 623 | { | - |
| 624 | QAbstractButtonPrivate * const d = d_func(); | - |
| 625 | d->autoRepeatInterval = autoRepeatInterval; | - |
| 626 | } | 0 |
| 627 | | - |
| 628 | int QAbstractButton::autoRepeatInterval() const | - |
| 629 | { | - |
| 630 | const QAbstractButtonPrivate * const d = d_func(); | - |
| 631 | return d->autoRepeatInterval; executed: return d->autoRepeatInterval;Execution Count:1 | 1 |
| 632 | } | - |
| 633 | void QAbstractButton::setAutoExclusive(bool autoExclusive) | - |
| 634 | { | - |
| 635 | QAbstractButtonPrivate * const d = d_func(); | - |
| 636 | d->autoExclusive = autoExclusive; | - |
| 637 | } executed: }Execution Count:51 | 51 |
| 638 | | - |
| 639 | bool QAbstractButton::autoExclusive() const | - |
| 640 | { | - |
| 641 | const QAbstractButtonPrivate * const d = d_func(); | - |
| 642 | return d->autoExclusive; executed: return d->autoExclusive;Execution Count:47 | 47 |
| 643 | } | - |
| 644 | QButtonGroup *QAbstractButton::group() const | - |
| 645 | { | - |
| 646 | const QAbstractButtonPrivate * const d = d_func(); | - |
| 647 | return d->group; executed: return d->group;Execution Count:37 | 37 |
| 648 | } | - |
| 649 | void QAbstractButton::animateClick(int msec) | - |
| 650 | { | - |
| 651 | if (!isEnabled()) partially evaluated: !isEnabled()| no Evaluation Count:0 | yes Evaluation Count:38 |
| 0-38 |
| 652 | return; | 0 |
| 653 | QAbstractButtonPrivate * const d = d_func(); | - |
| 654 | if (d->checkable && focusPolicy() & Qt::ClickFocus) evaluated: d->checkable| yes Evaluation Count:1 | yes Evaluation Count:37 |
partially evaluated: focusPolicy() & Qt::ClickFocus| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-37 |
| 655 | setFocus(); never executed: setFocus(); | 0 |
| 656 | setDown(true); | - |
| 657 | repaint(); | - |
| 658 | QApplication::flush(); | - |
| 659 | if (!d->animateTimer.isActive()) partially evaluated: !d->animateTimer.isActive()| yes Evaluation Count:38 | no Evaluation Count:0 |
| 0-38 |
| 660 | d->emitPressed(); executed: d->emitPressed();Execution Count:38 | 38 |
| 661 | d->animateTimer.start(msec, this); | - |
| 662 | } executed: }Execution Count:38 | 38 |
| 663 | void QAbstractButton::click() | - |
| 664 | { | - |
| 665 | if (!isEnabled()) evaluated: !isEnabled()| yes Evaluation Count:1 | yes Evaluation Count:59 |
| 1-59 |
| 666 | return; executed: return;Execution Count:1 | 1 |
| 667 | QAbstractButtonPrivate * const d = d_func(); | - |
| 668 | QPointer<QAbstractButton> guard(this); | - |
| 669 | d->down = true; | - |
| 670 | d->emitPressed(); | - |
| 671 | if (guard) { evaluated: guard| yes Evaluation Count:57 | yes Evaluation Count:2 |
| 2-57 |
| 672 | d->down = false; | - |
| 673 | nextCheckState(); | - |
| 674 | if (guard) partially evaluated: guard| yes Evaluation Count:57 | no Evaluation Count:0 |
| 0-57 |
| 675 | d->emitReleased(); executed: d->emitReleased();Execution Count:57 | 57 |
| 676 | if (guard) partially evaluated: guard| yes Evaluation Count:57 | no Evaluation Count:0 |
| 0-57 |
| 677 | d->emitClicked(); executed: d->emitClicked();Execution Count:57 | 57 |
| 678 | } executed: }Execution Count:57 | 57 |
| 679 | } executed: }Execution Count:59 | 59 |
| 680 | | - |
| 681 | | - |
| 682 | | - |
| 683 | | - |
| 684 | | - |
| 685 | | - |
| 686 | | - |
| 687 | void QAbstractButton::toggle() | - |
| 688 | { | - |
| 689 | QAbstractButtonPrivate * const d = d_func(); | - |
| 690 | setChecked(!d->checked); | - |
| 691 | } executed: }Execution Count:19 | 19 |
| 692 | void QAbstractButton::checkStateSet() | - |
| 693 | { | - |
| 694 | } | - |
| 695 | void QAbstractButton::nextCheckState() | - |
| 696 | { | - |
| 697 | if (isCheckable()) evaluated: isCheckable()| yes Evaluation Count:16 | yes Evaluation Count:203 |
| 16-203 |
| 698 | setChecked(!isChecked()); executed: setChecked(!isChecked());Execution Count:16 | 16 |
| 699 | } executed: }Execution Count:219 | 219 |
| 700 | bool QAbstractButton::hitButton(const QPoint &pos) const | - |
| 701 | { | - |
| 702 | return rect().contains(pos); executed: return rect().contains(pos);Execution Count:164 | 164 |
| 703 | } | - |
| 704 | | - |
| 705 | | - |
| 706 | bool QAbstractButton::event(QEvent *e) | - |
| 707 | { | - |
| 708 | | - |
| 709 | | - |
| 710 | if (!isEnabled()) { evaluated: !isEnabled()| yes Evaluation Count:5151 | yes Evaluation Count:34164 |
| 5151-34164 |
| 711 | switch(e->type()) { | - |
| 712 | case QEvent::TabletPress: | - |
| 713 | case QEvent::TabletRelease: | - |
| 714 | case QEvent::TabletMove: | - |
| 715 | case QEvent::MouseButtonPress: | - |
| 716 | case QEvent::MouseButtonRelease: | - |
| 717 | case QEvent::MouseButtonDblClick: | - |
| 718 | case QEvent::MouseMove: | - |
| 719 | case QEvent::HoverMove: | - |
| 720 | case QEvent::HoverEnter: | - |
| 721 | case QEvent::HoverLeave: | - |
| 722 | case QEvent::ContextMenu: | - |
| 723 | | - |
| 724 | case QEvent::Wheel: | - |
| 725 | | - |
| 726 | return true; executed: return true;Execution Count:8 | 8 |
| 727 | default: | - |
| 728 | break; executed: break;Execution Count:5143 | 5143 |
| 729 | } | - |
| 730 | } executed: }Execution Count:5143 | 5143 |
| 731 | | - |
| 732 | | - |
| 733 | if (e->type() == QEvent::Shortcut) { evaluated: e->type() == QEvent::Shortcut| yes Evaluation Count:15 | yes Evaluation Count:39292 |
| 15-39292 |
| 734 | QAbstractButtonPrivate * const d = d_func(); | - |
| 735 | QShortcutEvent *se = static_cast<QShortcutEvent *>(e); | - |
| 736 | if (d->shortcutId != se->shortcutId()) partially evaluated: d->shortcutId != se->shortcutId()| no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-15 |
| 737 | return false; never executed: return false; | 0 |
| 738 | if (!se->isAmbiguous()) { partially evaluated: !se->isAmbiguous()| yes Evaluation Count:15 | no Evaluation Count:0 |
| 0-15 |
| 739 | if (!d->animateTimer.isActive()) evaluated: !d->animateTimer.isActive()| yes Evaluation Count:14 | yes Evaluation Count:1 |
| 1-14 |
| 740 | animateClick(); executed: animateClick();Execution Count:14 | 14 |
| 741 | } else { executed: }Execution Count:15 | 15 |
| 742 | if (focusPolicy() != Qt::NoFocus) never evaluated: focusPolicy() != Qt::NoFocus | 0 |
| 743 | setFocus(Qt::ShortcutFocusReason); never executed: setFocus(Qt::ShortcutFocusReason); | 0 |
| 744 | window()->setAttribute(Qt::WA_KeyboardFocusChange); | - |
| 745 | } | 0 |
| 746 | return true; executed: return true;Execution Count:15 | 15 |
| 747 | } | - |
| 748 | | - |
| 749 | return QWidget::event(e); executed: return QWidget::event(e);Execution Count:39292 | 39292 |
| 750 | } | - |
| 751 | | - |
| 752 | | - |
| 753 | void QAbstractButton::mousePressEvent(QMouseEvent *e) | - |
| 754 | { | - |
| 755 | QAbstractButtonPrivate * const d = d_func(); | - |
| 756 | if (e->button() != Qt::LeftButton) { partially evaluated: e->button() != Qt::LeftButton| no Evaluation Count:0 | yes Evaluation Count:89 |
| 0-89 |
| 757 | e->ignore(); | - |
| 758 | return; | 0 |
| 759 | } | - |
| 760 | if (hitButton(e->pos())) { partially evaluated: hitButton(e->pos())| yes Evaluation Count:89 | no Evaluation Count:0 |
| 0-89 |
| 761 | setDown(true); | - |
| 762 | d->pressed = true; | - |
| 763 | repaint(); | - |
| 764 | QApplication::flush(); | - |
| 765 | d->emitPressed(); | - |
| 766 | e->accept(); | - |
| 767 | } else { executed: }Execution Count:89 | 89 |
| 768 | e->ignore(); | - |
| 769 | } | 0 |
| 770 | } | - |
| 771 | | - |
| 772 | | - |
| 773 | void QAbstractButton::mouseReleaseEvent(QMouseEvent *e) | - |
| 774 | { | - |
| 775 | QAbstractButtonPrivate * const d = d_func(); | - |
| 776 | d->pressed = false; | - |
| 777 | | - |
| 778 | if (e->button() != Qt::LeftButton) { partially evaluated: e->button() != Qt::LeftButton| no Evaluation Count:0 | yes Evaluation Count:77 |
| 0-77 |
| 779 | e->ignore(); | - |
| 780 | return; | 0 |
| 781 | } | - |
| 782 | | - |
| 783 | if (!d->down) { evaluated: !d->down| yes Evaluation Count:2 | yes Evaluation Count:75 |
| 2-75 |
| 784 | | - |
| 785 | d->refresh(); | - |
| 786 | e->ignore(); | - |
| 787 | return; executed: return;Execution Count:2 | 2 |
| 788 | } | - |
| 789 | | - |
| 790 | if (hitButton(e->pos())) { partially evaluated: hitButton(e->pos())| yes Evaluation Count:75 | no Evaluation Count:0 |
| 0-75 |
| 791 | d->repeatTimer.stop(); | - |
| 792 | d->click(); | - |
| 793 | e->accept(); | - |
| 794 | } else { executed: }Execution Count:75 | 75 |
| 795 | setDown(false); | - |
| 796 | e->ignore(); | - |
| 797 | } | 0 |
| 798 | } | - |
| 799 | | - |
| 800 | | - |
| 801 | void QAbstractButton::mouseMoveEvent(QMouseEvent *e) | - |
| 802 | { | - |
| 803 | QAbstractButtonPrivate * const d = d_func(); | - |
| 804 | if (!(e->buttons() & Qt::LeftButton) || !d->pressed) { never evaluated: !(e->buttons() & Qt::LeftButton) never evaluated: !d->pressed | 0 |
| 805 | e->ignore(); | - |
| 806 | return; | 0 |
| 807 | } | - |
| 808 | | - |
| 809 | if (hitButton(e->pos()) != d->down) { never evaluated: hitButton(e->pos()) != d->down | 0 |
| 810 | setDown(!d->down); | - |
| 811 | repaint(); | - |
| 812 | QApplication::flush(); | - |
| 813 | if (d->down) | 0 |
| 814 | d->emitPressed(); never executed: d->emitPressed(); | 0 |
| 815 | else | - |
| 816 | d->emitReleased(); never executed: d->emitReleased(); | 0 |
| 817 | e->accept(); | - |
| 818 | } else if (!hitButton(e->pos())) { never evaluated: !hitButton(e->pos()) | 0 |
| 819 | e->ignore(); | - |
| 820 | } | 0 |
| 821 | } | - |
| 822 | | - |
| 823 | | - |
| 824 | void QAbstractButton::keyPressEvent(QKeyEvent *e) | - |
| 825 | { | - |
| 826 | QAbstractButtonPrivate * const d = d_func(); | - |
| 827 | bool next = true; | - |
| 828 | switch (e->key()) { | - |
| 829 | case Qt::Key_Enter: | - |
| 830 | case Qt::Key_Return: | - |
| 831 | e->ignore(); | - |
| 832 | break; executed: break;Execution Count:8 | 8 |
| 833 | case Qt::Key_Select: | - |
| 834 | case Qt::Key_Space: | - |
| 835 | if (!e->isAutoRepeat()) { partially evaluated: !e->isAutoRepeat()| yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
| 836 | setDown(true); | - |
| 837 | repaint(); | - |
| 838 | QApplication::flush(); | - |
| 839 | d->emitPressed(); | - |
| 840 | } executed: }Execution Count:14 | 14 |
| 841 | break; executed: break;Execution Count:14 | 14 |
| 842 | case Qt::Key_Up: | - |
| 843 | next = false; | - |
| 844 | | - |
| 845 | case Qt::Key_Left: | - |
| 846 | case Qt::Key_Right: | - |
| 847 | case Qt::Key_Down: { | - |
| 848 | QWidget *pw = parentWidget(); | - |
| 849 | if (d->autoExclusive evaluated: d->autoExclusive| yes Evaluation Count:11 | yes Evaluation Count:2 |
| 2-11 |
| 850 | | - |
| 851 | || d->group partially evaluated: d->group| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 852 | | - |
| 853 | | - |
| 854 | || (pw && qobject_cast<QAbstractItemView *>(pw->parentWidget())) never evaluated: qobject_cast<QAbstractItemView *>(pw->parentWidget()) | 0 |
| 855 | | - |
| 856 | ) { | - |
| 857 | | - |
| 858 | | - |
| 859 | | - |
| 860 | | - |
| 861 | d->moveFocus(e->key()); | - |
| 862 | if (hasFocus()) evaluated: hasFocus()| yes Evaluation Count:3 | yes Evaluation Count:10 |
| 3-10 |
| 863 | e->ignore(); executed: e->ignore();Execution Count:3 | 3 |
| 864 | } else { executed: }Execution Count:13 | 13 |
| 865 | | - |
| 866 | QWidget *w = pw ? pw : this; | 0 |
| 867 | bool reverse = (w->layoutDirection() == Qt::RightToLeft); | - |
| 868 | if ((e->key() == Qt::Key_Left && !reverse) never evaluated: e->key() == Qt::Key_Left never evaluated: !reverse | 0 |
| 869 | || (e->key() == Qt::Key_Right && reverse)) { never evaluated: e->key() == Qt::Key_Right | 0 |
| 870 | next = false; | - |
| 871 | } | 0 |
| 872 | focusNextPrevChild(next); | - |
| 873 | } | 0 |
| 874 | break; executed: break;Execution Count:13 | 13 |
| 875 | } | - |
| 876 | case Qt::Key_Escape: | - |
| 877 | if (d->down) { partially evaluated: d->down| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
| 878 | setDown(false); | - |
| 879 | repaint(); | - |
| 880 | QApplication::flush(); | - |
| 881 | d->emitReleased(); | - |
| 882 | break; executed: break;Execution Count:3 | 3 |
| 883 | } | - |
| 884 | | - |
| 885 | default: code before this statement never executed: default: | 0 |
| 886 | e->ignore(); | - |
| 887 | } executed: }Execution Count:4 | 4 |
| 888 | } executed: }Execution Count:42 | 42 |
| 889 | | - |
| 890 | | - |
| 891 | void QAbstractButton::keyReleaseEvent(QKeyEvent *e) | - |
| 892 | { | - |
| 893 | QAbstractButtonPrivate * const d = d_func(); | - |
| 894 | | - |
| 895 | if (!e->isAutoRepeat()) partially evaluated: !e->isAutoRepeat()| yes Evaluation Count:40 | no Evaluation Count:0 |
| 0-40 |
| 896 | d->repeatTimer.stop(); executed: d->repeatTimer.stop();Execution Count:40 | 40 |
| 897 | | - |
| 898 | switch (e->key()) { | - |
| 899 | case Qt::Key_Select: | - |
| 900 | case Qt::Key_Space: | - |
| 901 | if (!e->isAutoRepeat() && d->down) partially evaluated: !e->isAutoRepeat()| yes Evaluation Count:13 | no Evaluation Count:0 |
partially evaluated: d->down| yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-13 |
| 902 | d->click(); executed: d->click();Execution Count:13 | 13 |
| 903 | break; executed: break;Execution Count:13 | 13 |
| 904 | default: | - |
| 905 | e->ignore(); | - |
| 906 | } executed: }Execution Count:27 | 27 |
| 907 | } executed: }Execution Count:40 | 40 |
| 908 | | - |
| 909 | | - |
| 910 | | - |
| 911 | void QAbstractButton::timerEvent(QTimerEvent *e) | - |
| 912 | { | - |
| 913 | QAbstractButtonPrivate * const d = d_func(); | - |
| 914 | if (e->timerId() == d->repeatTimer.timerId()) { evaluated: e->timerId() == d->repeatTimer.timerId()| yes Evaluation Count:63 | yes Evaluation Count:38 |
| 38-63 |
| 915 | d->repeatTimer.start(d->autoRepeatInterval, this); | - |
| 916 | if (d->down) { partially evaluated: d->down| yes Evaluation Count:63 | no Evaluation Count:0 |
| 0-63 |
| 917 | QPointer<QAbstractButton> guard(this); | - |
| 918 | nextCheckState(); | - |
| 919 | if (guard) partially evaluated: guard| yes Evaluation Count:63 | no Evaluation Count:0 |
| 0-63 |
| 920 | d->emitReleased(); executed: d->emitReleased();Execution Count:63 | 63 |
| 921 | if (guard) partially evaluated: guard| yes Evaluation Count:63 | no Evaluation Count:0 |
| 0-63 |
| 922 | d->emitClicked(); executed: d->emitClicked();Execution Count:63 | 63 |
| 923 | if (guard) partially evaluated: guard| yes Evaluation Count:63 | no Evaluation Count:0 |
| 0-63 |
| 924 | d->emitPressed(); executed: d->emitPressed();Execution Count:63 | 63 |
| 925 | } executed: }Execution Count:63 | 63 |
| 926 | } else if (e->timerId() == d->animateTimer.timerId()) { executed: }Execution Count:63 partially evaluated: e->timerId() == d->animateTimer.timerId()| yes Evaluation Count:38 | no Evaluation Count:0 |
| 0-63 |
| 927 | d->animateTimer.stop(); | - |
| 928 | d->click(); | - |
| 929 | } executed: }Execution Count:38 | 38 |
| 930 | } | - |
| 931 | | - |
| 932 | | - |
| 933 | void QAbstractButton::focusInEvent(QFocusEvent *e) | - |
| 934 | { | - |
| 935 | QAbstractButtonPrivate * const d = d_func(); | - |
| 936 | | - |
| 937 | | - |
| 938 | | - |
| 939 | d->fixFocusPolicy(); | - |
| 940 | QWidget::focusInEvent(e); | - |
| 941 | } executed: }Execution Count:240 | 240 |
| 942 | | - |
| 943 | | - |
| 944 | void QAbstractButton::focusOutEvent(QFocusEvent *e) | - |
| 945 | { | - |
| 946 | QAbstractButtonPrivate * const d = d_func(); | - |
| 947 | if (e->reason() != Qt::PopupFocusReason) evaluated: e->reason() != Qt::PopupFocusReason| yes Evaluation Count:155 | yes Evaluation Count:5 |
| 5-155 |
| 948 | d->down = false; executed: d->down = false;Execution Count:155 | 155 |
| 949 | QWidget::focusOutEvent(e); | - |
| 950 | } executed: }Execution Count:160 | 160 |
| 951 | | - |
| 952 | | - |
| 953 | void QAbstractButton::changeEvent(QEvent *e) | - |
| 954 | { | - |
| 955 | QAbstractButtonPrivate * const d = d_func(); | - |
| 956 | switch (e->type()) { | - |
| 957 | case QEvent::EnabledChange: | - |
| 958 | if (!isEnabled()) evaluated: !isEnabled()| yes Evaluation Count:1704 | yes Evaluation Count:970 |
| 970-1704 |
| 959 | setDown(false); executed: setDown(false);Execution Count:1704 | 1704 |
| 960 | break; executed: break;Execution Count:2674 | 2674 |
| 961 | default: | - |
| 962 | d->sizeHint = QSize(); | - |
| 963 | break; executed: break;Execution Count:10667 | 10667 |
| 964 | } | - |
| 965 | QWidget::changeEvent(e); | - |
| 966 | } executed: }Execution Count:13341 | 13341 |
| 967 | QSize QAbstractButton::iconSize() const | - |
| 968 | { | - |
| 969 | const QAbstractButtonPrivate * const d = d_func(); | - |
| 970 | if (d->iconSize.isValid()) evaluated: d->iconSize.isValid()| yes Evaluation Count:253 | yes Evaluation Count:7653 |
| 253-7653 |
| 971 | return d->iconSize; executed: return d->iconSize;Execution Count:253 | 253 |
| 972 | int e = style()->pixelMetric(QStyle::PM_ButtonIconSize, 0, this); | - |
| 973 | return QSize(e, e); executed: return QSize(e, e);Execution Count:7653 | 7653 |
| 974 | } | - |
| 975 | | - |
| 976 | void QAbstractButton::setIconSize(const QSize &size) | - |
| 977 | { | - |
| 978 | QAbstractButtonPrivate * const d = d_func(); | - |
| 979 | if (d->iconSize == size) partially evaluated: d->iconSize == size| no Evaluation Count:0 | yes Evaluation Count:26 |
| 0-26 |
| 980 | return; | 0 |
| 981 | | - |
| 982 | d->iconSize = size; | - |
| 983 | d->sizeHint = QSize(); | - |
| 984 | updateGeometry(); | - |
| 985 | if (isVisible()) { partially evaluated: isVisible()| no Evaluation Count:0 | yes Evaluation Count:26 |
| 0-26 |
| 986 | update(); | - |
| 987 | } | 0 |
| 988 | } executed: }Execution Count:26 | 26 |
| 989 | | - |
| 990 | | - |
| 991 | | - |
| 992 | | - |
| 993 | | - |
| | |