| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | QPushButton::QPushButton(QWidget *parent) | - |
| 12 | : QAbstractButton(*new QPushButtonPrivate, parent) | - |
| 13 | { | - |
| 14 | QPushButtonPrivate * const d = d_func(); | - |
| 15 | d->init(); | - |
| 16 | } executed: }Execution Count:507 | 507 |
| 17 | | - |
| 18 | | - |
| 19 | | - |
| 20 | | - |
| 21 | | - |
| 22 | | - |
| 23 | QPushButton::QPushButton(const QString &text, QWidget *parent) | - |
| 24 | : QAbstractButton(*new QPushButtonPrivate, parent) | - |
| 25 | { | - |
| 26 | QPushButtonPrivate * const d = d_func(); | - |
| 27 | setText(text); | - |
| 28 | d->init(); | - |
| 29 | } executed: }Execution Count:1276 | 1276 |
| 30 | QPushButton::QPushButton(const QIcon& icon, const QString &text, QWidget *parent) | - |
| 31 | : QAbstractButton(*new QPushButtonPrivate, parent) | - |
| 32 | { | - |
| 33 | QPushButtonPrivate * const d = d_func(); | - |
| 34 | setText(text); | - |
| 35 | setIcon(icon); | - |
| 36 | d->init(); | - |
| 37 | } | 0 |
| 38 | | - |
| 39 | | - |
| 40 | | - |
| 41 | QPushButton::QPushButton(QPushButtonPrivate &dd, QWidget *parent) | - |
| 42 | : QAbstractButton(dd, parent) | - |
| 43 | { | - |
| 44 | QPushButtonPrivate * const d = d_func(); | - |
| 45 | d->init(); | - |
| 46 | } executed: }Execution Count:12 | 12 |
| 47 | | - |
| 48 | | - |
| 49 | | - |
| 50 | | - |
| 51 | QPushButton::~QPushButton() | - |
| 52 | { | - |
| 53 | } | - |
| 54 | | - |
| 55 | QDialog *QPushButtonPrivate::dialogParent() const | - |
| 56 | { | - |
| 57 | const QPushButton * const q = q_func(); | - |
| 58 | const QWidget *p = q; | - |
| 59 | while (p && !p->isWindow()) { partially evaluated: p| yes Evaluation Count:20693 | no Evaluation Count:0 |
evaluated: !p->isWindow()| yes Evaluation Count:16811 | yes Evaluation Count:3882 |
| 0-20693 |
| 60 | p = p->parentWidget(); | - |
| 61 | if (const QDialog *dialog = qobject_cast<const QDialog *>(p)) evaluated: const QDialog *dialog = qobject_cast<const QDialog *>(p)| yes Evaluation Count:6234 | yes Evaluation Count:10577 |
| 6234-10577 |
| 62 | return const_cast<QDialog *>(dialog); executed: return const_cast<QDialog *>(dialog);Execution Count:6234 | 6234 |
| 63 | } executed: }Execution Count:10577 | 10577 |
| 64 | return 0; executed: return 0;Execution Count:3882 | 3882 |
| 65 | } | - |
| 66 | void QPushButton::initStyleOption(QStyleOptionButton *option) const | - |
| 67 | { | - |
| 68 | if (!option) partially evaluated: !option| no Evaluation Count:0 | yes Evaluation Count:5873 |
| 0-5873 |
| 69 | return; | 0 |
| 70 | | - |
| 71 | const QPushButtonPrivate * const d = d_func(); | - |
| 72 | option->initFrom(this); | - |
| 73 | option->features = QStyleOptionButton::None; | - |
| 74 | if (d->flat) partially evaluated: d->flat| no Evaluation Count:0 | yes Evaluation Count:5873 |
| 0-5873 |
| 75 | option->features |= QStyleOptionButton::Flat; never executed: option->features |= QStyleOptionButton::Flat; | 0 |
| 76 | | - |
| 77 | if (d->menu) evaluated: d->menu| yes Evaluation Count:18 | yes Evaluation Count:5855 |
| 18-5855 |
| 78 | option->features |= QStyleOptionButton::HasMenu; executed: option->features |= QStyleOptionButton::HasMenu;Execution Count:18 | 18 |
| 79 | | - |
| 80 | if (autoDefault()) evaluated: autoDefault()| yes Evaluation Count:2734 | yes Evaluation Count:3139 |
| 2734-3139 |
| 81 | option->features |= QStyleOptionButton::AutoDefaultButton; executed: option->features |= QStyleOptionButton::AutoDefaultButton;Execution Count:2734 | 2734 |
| 82 | if (d->defaultButton) evaluated: d->defaultButton| yes Evaluation Count:350 | yes Evaluation Count:5523 |
| 350-5523 |
| 83 | option->features |= QStyleOptionButton::DefaultButton; executed: option->features |= QStyleOptionButton::DefaultButton;Execution Count:350 | 350 |
| 84 | if (d->down || d->menuOpen) evaluated: d->down| yes Evaluation Count:77 | yes Evaluation Count:5796 |
partially evaluated: d->menuOpen| no Evaluation Count:0 | yes Evaluation Count:5796 |
| 0-5796 |
| 85 | option->state |= QStyle::State_Sunken; executed: option->state |= QStyle::State_Sunken;Execution Count:77 | 77 |
| 86 | if (d->checked) partially evaluated: d->checked| no Evaluation Count:0 | yes Evaluation Count:5873 |
| 0-5873 |
| 87 | option->state |= QStyle::State_On; never executed: option->state |= QStyle::State_On; | 0 |
| 88 | if (!d->flat && !d->down) partially evaluated: !d->flat| yes Evaluation Count:5873 | no Evaluation Count:0 |
evaluated: !d->down| yes Evaluation Count:5796 | yes Evaluation Count:77 |
| 0-5873 |
| 89 | option->state |= QStyle::State_Raised; executed: option->state |= QStyle::State_Raised;Execution Count:5796 | 5796 |
| 90 | option->text = d->text; | - |
| 91 | option->icon = d->icon; | - |
| 92 | option->iconSize = iconSize(); | - |
| 93 | } executed: }Execution Count:5873 | 5873 |
| 94 | | - |
| 95 | void QPushButton::setAutoDefault(bool enable) | - |
| 96 | { | - |
| 97 | QPushButtonPrivate * const d = d_func(); | - |
| 98 | uint state = enable ? QPushButtonPrivate::On : QPushButtonPrivate::Off; evaluated: enable| yes Evaluation Count:4 | yes Evaluation Count:9 |
| 4-9 |
| 99 | if (d->autoDefault != QPushButtonPrivate::Auto && d->autoDefault == state) evaluated: d->autoDefault != QPushButtonPrivate::Auto| yes Evaluation Count:2 | yes Evaluation Count:11 |
partially evaluated: d->autoDefault == state| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-11 |
| 100 | return; | 0 |
| 101 | d->autoDefault = state; | - |
| 102 | d->sizeHint = QSize(); | - |
| 103 | update(); | - |
| 104 | updateGeometry(); | - |
| 105 | } executed: }Execution Count:13 | 13 |
| 106 | | - |
| 107 | bool QPushButton::autoDefault() const | - |
| 108 | { | - |
| 109 | const QPushButtonPrivate * const d = d_func(); | - |
| 110 | if(d->autoDefault == QPushButtonPrivate::Auto) evaluated: d->autoDefault == QPushButtonPrivate::Auto| yes Evaluation Count:9561 | yes Evaluation Count:122 |
| 122-9561 |
| 111 | return ( d->dialogParent() != 0 ); executed: return ( d->dialogParent() != 0 );Execution Count:9561 | 9561 |
| 112 | return d->autoDefault; executed: return d->autoDefault;Execution Count:122 | 122 |
| 113 | } | - |
| 114 | | - |
| 115 | void QPushButton::setDefault(bool enable) | - |
| 116 | { | - |
| 117 | QPushButtonPrivate * const d = d_func(); | - |
| 118 | if (d->defaultButton == enable) evaluated: d->defaultButton == enable| yes Evaluation Count:2536 | yes Evaluation Count:689 |
| 689-2536 |
| 119 | return; executed: return;Execution Count:2536 | 2536 |
| 120 | d->defaultButton = enable; | - |
| 121 | if (d->defaultButton) { evaluated: d->defaultButton| yes Evaluation Count:442 | yes Evaluation Count:247 |
| 247-442 |
| 122 | if (QDialog *dlg = d->dialogParent()) evaluated: QDialog *dlg = d->dialogParent()| yes Evaluation Count:431 | yes Evaluation Count:11 |
| 11-431 |
| 123 | dlg->d_func()->setMainDefault(this); executed: dlg->d_func()->setMainDefault(this);Execution Count:431 | 431 |
| 124 | } executed: }Execution Count:442 | 442 |
| 125 | update(); | - |
| 126 | | - |
| 127 | QAccessible::State s; | - |
| 128 | s.defaultButton = true; | - |
| 129 | QAccessibleStateChangeEvent event(this, s); | - |
| 130 | QAccessible::updateAccessibility(&event); | - |
| 131 | | - |
| 132 | } executed: }Execution Count:689 | 689 |
| 133 | | - |
| 134 | bool QPushButton::isDefault() const | - |
| 135 | { | - |
| 136 | const QPushButtonPrivate * const d = d_func(); | - |
| 137 | return d->defaultButton; executed: return d->defaultButton;Execution Count:393 | 393 |
| 138 | } | - |
| 139 | | - |
| 140 | | - |
| 141 | | - |
| 142 | | - |
| 143 | QSize QPushButton::sizeHint() const | - |
| 144 | { | - |
| 145 | const QPushButtonPrivate * const d = d_func(); | - |
| 146 | if (d->sizeHint.isValid() && d->lastAutoDefault == autoDefault()) evaluated: d->sizeHint.isValid()| yes Evaluation Count:2262 | yes Evaluation Count:1111 |
evaluated: d->lastAutoDefault == autoDefault()| yes Evaluation Count:2256 | yes Evaluation Count:6 |
| 6-2262 |
| 147 | return d->sizeHint; executed: return d->sizeHint;Execution Count:2256 | 2256 |
| 148 | d->lastAutoDefault = autoDefault(); | - |
| 149 | ensurePolished(); | - |
| 150 | | - |
| 151 | int w = 0, h = 0; | - |
| 152 | | - |
| 153 | QStyleOptionButton opt; | - |
| 154 | initStyleOption(&opt); | - |
| 155 | | - |
| 156 | | - |
| 157 | | - |
| 158 | | - |
| 159 | bool showButtonBoxIcons = qobject_cast<QDialogButtonBox*>(parentWidget()) evaluated: qobject_cast<QDialogButtonBox*>(parentWidget())| yes Evaluation Count:628 | yes Evaluation Count:489 |
| 489-628 |
| 160 | && style()->styleHint(QStyle::SH_DialogButtonBox_ButtonsHaveIcons); partially evaluated: style()->styleHint(QStyle::SH_DialogButtonBox_ButtonsHaveIcons)| no Evaluation Count:0 | yes Evaluation Count:628 |
| 0-628 |
| 161 | | - |
| 162 | if (!icon().isNull() || showButtonBoxIcons) { evaluated: !icon().isNull()| yes Evaluation Count:13 | yes Evaluation Count:1104 |
partially evaluated: showButtonBoxIcons| no Evaluation Count:0 | yes Evaluation Count:1104 |
| 0-1104 |
| 163 | int ih = opt.iconSize.height(); | - |
| 164 | int iw = opt.iconSize.width() + 4; | - |
| 165 | w += iw; | - |
| 166 | h = qMax(h, ih); | - |
| 167 | } executed: }Execution Count:13 | 13 |
| 168 | | - |
| 169 | QString s(text()); | - |
| 170 | bool empty = s.isEmpty(); | - |
| 171 | if (empty) evaluated: empty| yes Evaluation Count:174 | yes Evaluation Count:943 |
| 174-943 |
| 172 | s = QString::fromLatin1("XXXX"); executed: s = QString::fromLatin1("XXXX");Execution Count:174 | 174 |
| 173 | QFontMetrics fm = fontMetrics(); | - |
| 174 | QSize sz = fm.size(Qt::TextShowMnemonic, s); | - |
| 175 | if(!empty || !w) evaluated: !empty| yes Evaluation Count:943 | yes Evaluation Count:174 |
evaluated: !w| yes Evaluation Count:163 | yes Evaluation Count:11 |
| 11-943 |
| 176 | w += sz.width(); executed: w += sz.width();Execution Count:1106 | 1106 |
| 177 | if(!empty || !h) evaluated: !empty| yes Evaluation Count:943 | yes Evaluation Count:174 |
evaluated: !h| yes Evaluation Count:163 | yes Evaluation Count:11 |
| 11-943 |
| 178 | h = qMax(h, sz.height()); executed: h = qMax(h, sz.height());Execution Count:1106 | 1106 |
| 179 | opt.rect.setSize(QSize(w, h)); | - |
| 180 | | - |
| 181 | if (menu()) evaluated: menu()| yes Evaluation Count:4 | yes Evaluation Count:1113 |
| 4-1113 |
| 182 | w += style()->pixelMetric(QStyle::PM_MenuButtonIndicator, &opt, this); executed: w += style()->pixelMetric(QStyle::PM_MenuButtonIndicator, &opt, this);Execution Count:4 | 4 |
| 183 | | - |
| 184 | d->sizeHint = (style()->sizeFromContents(QStyle::CT_PushButton, &opt, QSize(w, h), this). | - |
| 185 | expandedTo(QApplication::globalStrut())); | - |
| 186 | return d->sizeHint; executed: return d->sizeHint;Execution Count:1117 | 1117 |
| 187 | } | - |
| 188 | | - |
| 189 | | - |
| 190 | | - |
| 191 | | - |
| 192 | QSize QPushButton::minimumSizeHint() const | - |
| 193 | { | - |
| 194 | return sizeHint(); executed: return sizeHint();Execution Count:1592 | 1592 |
| 195 | } | - |
| 196 | | - |
| 197 | | - |
| 198 | | - |
| 199 | | - |
| 200 | void QPushButton::paintEvent(QPaintEvent *) | - |
| 201 | { | - |
| 202 | QStylePainter p(this); | - |
| 203 | QStyleOptionButton option; | - |
| 204 | initStyleOption(&option); | - |
| 205 | p.drawControl(QStyle::CE_PushButton, option); | - |
| 206 | } executed: }Execution Count:780 | 780 |
| 207 | | - |
| 208 | | - |
| 209 | | - |
| 210 | void QPushButton::keyPressEvent(QKeyEvent *e) | - |
| 211 | { | - |
| 212 | QPushButtonPrivate * const d = d_func(); | - |
| 213 | switch (e->key()) { | - |
| 214 | case Qt::Key_Enter: | - |
| 215 | case Qt::Key_Return: | - |
| 216 | if (autoDefault() || d->defaultButton) { evaluated: autoDefault()| yes Evaluation Count:3 | yes Evaluation Count:6 |
partially evaluated: d->defaultButton| no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
| 217 | click(); | - |
| 218 | break; executed: break;Execution Count:3 | 3 |
| 219 | } | - |
| 220 | | - |
| 221 | default: code before this statement executed: default:Execution Count:6 | 6 |
| 222 | QAbstractButton::keyPressEvent(e); | - |
| 223 | } executed: }Execution Count:20 | 20 |
| 224 | } executed: }Execution Count:23 | 23 |
| 225 | | - |
| 226 | | - |
| 227 | | - |
| 228 | | - |
| 229 | void QPushButton::focusInEvent(QFocusEvent *e) | - |
| 230 | { | - |
| 231 | QPushButtonPrivate * const d = d_func(); | - |
| 232 | if (e->reason() != Qt::PopupFocusReason && autoDefault() && !d->defaultButton) { evaluated: e->reason() != Qt::PopupFocusReason| yes Evaluation Count:223 | yes Evaluation Count:2 |
evaluated: autoDefault()| yes Evaluation Count:149 | yes Evaluation Count:74 |
evaluated: !d->defaultButton| yes Evaluation Count:12 | yes Evaluation Count:137 |
| 2-223 |
| 233 | d->defaultButton = true; | - |
| 234 | QDialog *dlg = qobject_cast<QDialog*>(window()); | - |
| 235 | if (dlg) partially evaluated: dlg| yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
| 236 | dlg->d_func()->setDefault(this); executed: dlg->d_func()->setDefault(this);Execution Count:12 | 12 |
| 237 | } executed: }Execution Count:12 | 12 |
| 238 | QAbstractButton::focusInEvent(e); | - |
| 239 | } executed: }Execution Count:225 | 225 |
| 240 | | - |
| 241 | | - |
| 242 | | - |
| 243 | | - |
| 244 | void QPushButton::focusOutEvent(QFocusEvent *e) | - |
| 245 | { | - |
| 246 | QPushButtonPrivate * const d = d_func(); | - |
| 247 | if (e->reason() != Qt::PopupFocusReason && autoDefault() && d->defaultButton) { evaluated: e->reason() != Qt::PopupFocusReason| yes Evaluation Count:141 | yes Evaluation Count:5 |
evaluated: autoDefault()| yes Evaluation Count:74 | yes Evaluation Count:67 |
evaluated: d->defaultButton| yes Evaluation Count:71 | yes Evaluation Count:3 |
| 3-141 |
| 248 | QDialog *dlg = qobject_cast<QDialog*>(window()); | - |
| 249 | if (dlg) partially evaluated: dlg| yes Evaluation Count:71 | no Evaluation Count:0 |
| 0-71 |
| 250 | dlg->d_func()->setDefault(0); executed: dlg->d_func()->setDefault(0);Execution Count:71 | 71 |
| 251 | else | - |
| 252 | d->defaultButton = false; never executed: d->defaultButton = false; | 0 |
| 253 | } | - |
| 254 | | - |
| 255 | QAbstractButton::focusOutEvent(e); | - |
| 256 | | - |
| 257 | if (d->menu && d->menu->isVisible()) evaluated: d->menu| yes Evaluation Count:2 | yes Evaluation Count:144 |
partially evaluated: d->menu->isVisible()| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-144 |
| 258 | setDown(true); executed: setDown(true);Execution Count:2 | 2 |
| 259 | | - |
| 260 | } executed: }Execution Count:146 | 146 |
| 261 | void QPushButton::setMenu(QMenu* menu) | - |
| 262 | { | - |
| 263 | QPushButtonPrivate * const d = d_func(); | - |
| 264 | if (menu == d->menu) partially evaluated: menu == d->menu| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 265 | return; | 0 |
| 266 | | - |
| 267 | if (menu && !d->menu) { evaluated: menu| yes Evaluation Count:6 | yes Evaluation Count:2 |
partially evaluated: !d->menu| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 268 | connect(this, "2""pressed()", this, "1""_q_popupPressed()", Qt::UniqueConnection); | - |
| 269 | } executed: }Execution Count:6 | 6 |
| 270 | if (d->menu) evaluated: d->menu| yes Evaluation Count:2 | yes Evaluation Count:6 |
| 2-6 |
| 271 | removeAction(d->menu->menuAction()); executed: removeAction(d->menu->menuAction());Execution Count:2 | 2 |
| 272 | d->menu = menu; | - |
| 273 | if (d->menu) evaluated: d->menu| yes Evaluation Count:6 | yes Evaluation Count:2 |
| 2-6 |
| 274 | addAction(d->menu->menuAction()); executed: addAction(d->menu->menuAction());Execution Count:6 | 6 |
| 275 | | - |
| 276 | d->resetLayoutItemMargins(); | - |
| 277 | d->sizeHint = QSize(); | - |
| 278 | update(); | - |
| 279 | updateGeometry(); | - |
| 280 | } executed: }Execution Count:8 | 8 |
| 281 | | - |
| 282 | | - |
| 283 | | - |
| 284 | | - |
| 285 | | - |
| 286 | | - |
| 287 | | - |
| 288 | QMenu* QPushButton::menu() const | - |
| 289 | { | - |
| 290 | const QPushButtonPrivate * const d = d_func(); | - |
| 291 | return d->menu; executed: return d->menu;Execution Count:1146 | 1146 |
| 292 | } | - |
| 293 | | - |
| 294 | | - |
| 295 | | - |
| 296 | | - |
| 297 | | - |
| 298 | | - |
| 299 | void QPushButton::showMenu() | - |
| 300 | { | - |
| 301 | QPushButtonPrivate * const d = d_func(); | - |
| 302 | if (!d || !d->menu) never evaluated: !d->menu | 0 |
| 303 | return; | 0 |
| 304 | setDown(true); | - |
| 305 | d->_q_popupPressed(); | - |
| 306 | } | 0 |
| 307 | | - |
| 308 | void QPushButtonPrivate::_q_popupPressed() | - |
| 309 | { | - |
| 310 | QPushButton * const q = q_func(); | - |
| 311 | if (!down || !menu) partially evaluated: !down| no Evaluation Count:0 | yes Evaluation Count:4 |
partially evaluated: !menu| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 312 | return; | 0 |
| 313 | | - |
| 314 | menu->setNoReplayFor(q); | - |
| 315 | | - |
| 316 | QPoint menuPos = adjustedMenuPosition(); | - |
| 317 | | - |
| 318 | QPointer<QPushButton> guard(q); | - |
| 319 | QMenuPrivate::get(menu)->causedPopup.widget = guard; | - |
| 320 | | - |
| 321 | | - |
| 322 | | - |
| 323 | menuOpen = true; | - |
| 324 | menu->exec(menuPos); | - |
| 325 | if (guard) { evaluated: guard| yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
| 326 | menuOpen = false; | - |
| 327 | q->setDown(false); | - |
| 328 | } executed: }Execution Count:2 | 2 |
| 329 | } executed: }Execution Count:4 | 4 |
| 330 | | - |
| 331 | QPoint QPushButtonPrivate::adjustedMenuPosition() | - |
| 332 | { | - |
| 333 | QPushButton * const q = q_func(); | - |
| 334 | | - |
| 335 | bool horizontal = true; | - |
| 336 | | - |
| 337 | QToolBar *tb = qobject_cast<QToolBar*>(parent); | - |
| 338 | if (tb && tb->orientation() == Qt::Vertical) partially evaluated: tb| no Evaluation Count:0 | yes Evaluation Count:6 |
never evaluated: tb->orientation() == Qt::Vertical | 0-6 |
| 339 | horizontal = false; never executed: horizontal = false; | 0 |
| 340 | | - |
| 341 | | - |
| 342 | QWidgetItem item(q); | - |
| 343 | QRect rect = item.geometry(); | - |
| 344 | rect.setRect(rect.x() - q->x(), rect.y() - q->y(), rect.width(), rect.height()); | - |
| 345 | | - |
| 346 | QSize menuSize = menu->sizeHint(); | - |
| 347 | QPoint globalPos = q->mapToGlobal(rect.topLeft()); | - |
| 348 | int x = globalPos.x(); | - |
| 349 | int y = globalPos.y(); | - |
| 350 | if (horizontal) { partially evaluated: horizontal| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 351 | if (globalPos.y() + rect.height() + menuSize.height() <= QApplication::desktop()->availableGeometry(q).height()) { evaluated: globalPos.y() + rect.height() + menuSize.height() <= QApplication::desktop()->availableGeometry(q).height()| yes Evaluation Count:3 | yes Evaluation Count:3 |
| 3 |
| 352 | y += rect.height(); | - |
| 353 | } else { executed: }Execution Count:3 | 3 |
| 354 | y -= menuSize.height(); | - |
| 355 | } executed: }Execution Count:3 | 3 |
| 356 | if (q->layoutDirection() == Qt::RightToLeft) partially evaluated: q->layoutDirection() == Qt::RightToLeft| no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
| 357 | x += rect.width() - menuSize.width(); never executed: x += rect.width() - menuSize.width(); | 0 |
| 358 | } else { executed: }Execution Count:6 | 6 |
| 359 | if (globalPos.x() + rect.width() + menu->sizeHint().width() <= QApplication::desktop()->availableGeometry(q).width()) never evaluated: globalPos.x() + rect.width() + menu->sizeHint().width() <= QApplication::desktop()->availableGeometry(q).width() | 0 |
| 360 | x += rect.width(); never executed: x += rect.width(); | 0 |
| 361 | else | - |
| 362 | x -= menuSize.width(); never executed: x -= menuSize.width(); | 0 |
| 363 | } | - |
| 364 | | - |
| 365 | return QPoint(x,y); executed: return QPoint(x,y);Execution Count:6 | 6 |
| 366 | } | - |
| 367 | | - |
| 368 | | - |
| 369 | | - |
| 370 | void QPushButtonPrivate::resetLayoutItemMargins() | - |
| 371 | { | - |
| 372 | QPushButton * const q = q_func(); | - |
| 373 | QStyleOptionButton opt; | - |
| 374 | q->initStyleOption(&opt); | - |
| 375 | setLayoutItemMargins(QStyle::SE_PushButtonLayoutItem, &opt); | - |
| 376 | } executed: }Execution Count:3919 | 3919 |
| 377 | | - |
| 378 | void QPushButton::setFlat(bool flat) | - |
| 379 | { | - |
| 380 | QPushButtonPrivate * const d = d_func(); | - |
| 381 | if (d->flat == flat) never evaluated: d->flat == flat | 0 |
| 382 | return; | 0 |
| 383 | d->flat = flat; | - |
| 384 | d->resetLayoutItemMargins(); | - |
| 385 | d->sizeHint = QSize(); | - |
| 386 | update(); | - |
| 387 | updateGeometry(); | - |
| 388 | } | 0 |
| 389 | | - |
| 390 | bool QPushButton::isFlat() const | - |
| 391 | { | - |
| 392 | const QPushButtonPrivate * const d = d_func(); | - |
| 393 | return d->flat; never executed: return d->flat; | 0 |
| 394 | } | - |
| 395 | | - |
| 396 | | - |
| 397 | bool QPushButton::event(QEvent *e) | - |
| 398 | { | - |
| 399 | QPushButtonPrivate * const d = d_func(); | - |
| 400 | if (e->type() == QEvent::ParentChange) { evaluated: e->type() == QEvent::ParentChange| yes Evaluation Count:113 | yes Evaluation Count:18151 |
| 113-18151 |
| 401 | if (QDialog *dialog = d->dialogParent()) { evaluated: QDialog *dialog = d->dialogParent()| yes Evaluation Count:28 | yes Evaluation Count:85 |
| 28-85 |
| 402 | if (d->defaultButton) evaluated: d->defaultButton| yes Evaluation Count:4 | yes Evaluation Count:24 |
| 4-24 |
| 403 | dialog->d_func()->setMainDefault(this); executed: dialog->d_func()->setMainDefault(this);Execution Count:4 | 4 |
| 404 | } executed: }Execution Count:28 | 28 |
| 405 | } else if (e->type() == QEvent::StyleChange evaluated: e->type() == QEvent::StyleChange| yes Evaluation Count:2104 | yes Evaluation Count:16047 |
executed: }Execution Count:113 | 113-16047 |
| 406 | | - |
| 407 | | - |
| 408 | | - |
| 409 | ) { | - |
| 410 | d->resetLayoutItemMargins(); | - |
| 411 | updateGeometry(); | - |
| 412 | } else if (e->type() == QEvent::PolishRequest) { executed: }Execution Count:2104 evaluated: e->type() == QEvent::PolishRequest| yes Evaluation Count:623 | yes Evaluation Count:15424 |
| 623-15424 |
| 413 | updateGeometry(); | - |
| 414 | } executed: }Execution Count:623 | 623 |
| 415 | return QAbstractButton::event(e); executed: return QAbstractButton::event(e);Execution Count:18264 | 18264 |
| 416 | } | - |
| 417 | | - |
| 418 | | - |
| 419 | | - |
| | |