| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | class QRadioButtonPrivate : public QAbstractButtonPrivate | - |
| 6 | { | - |
| 7 | inline QRadioButton* q_func() { return static_cast<QRadioButton *>(q_ptr); } inline const QRadioButton* q_func() const { return static_cast<const QRadioButton *>(q_ptr); } friend class QRadioButton; | - |
| 8 | | - |
| 9 | public: | - |
| 10 | QRadioButtonPrivate() : QAbstractButtonPrivate(QSizePolicy::RadioButton), hovering(true) {} executed: }Execution Count:51 | 51 |
| 11 | void init(); | - |
| 12 | uint hovering : 1; | - |
| 13 | }; | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | void QRadioButtonPrivate::init() | - |
| 19 | { | - |
| 20 | QRadioButton * const q = q_func(); | - |
| 21 | q->setCheckable(true); | - |
| 22 | q->setAutoExclusive(true); | - |
| 23 | q->setMouseTracking(true); | - |
| 24 | q->setForegroundRole(QPalette::WindowText); | - |
| 25 | setLayoutItemMargins(QStyle::SE_RadioButtonLayoutItem); | - |
| 26 | } executed: }Execution Count:51 | 51 |
| 27 | QRadioButton::QRadioButton(QWidget *parent) | - |
| 28 | : QAbstractButton(*new QRadioButtonPrivate, parent) | - |
| 29 | { | - |
| 30 | QRadioButtonPrivate * const d = d_func(); | - |
| 31 | d->init(); | - |
| 32 | } executed: }Execution Count:38 | 38 |
| 33 | | - |
| 34 | | - |
| 35 | | - |
| 36 | | - |
| 37 | QRadioButton::~QRadioButton() | - |
| 38 | { | - |
| 39 | } | - |
| 40 | | - |
| 41 | | - |
| 42 | | - |
| 43 | | - |
| 44 | | - |
| 45 | | - |
| 46 | | - |
| 47 | QRadioButton::QRadioButton(const QString &text, QWidget *parent) | - |
| 48 | : QAbstractButton(*new QRadioButtonPrivate, parent) | - |
| 49 | { | - |
| 50 | QRadioButtonPrivate * const d = d_func(); | - |
| 51 | d->init(); | - |
| 52 | setText(text); | - |
| 53 | } executed: }Execution Count:13 | 13 |
| 54 | void QRadioButton::initStyleOption(QStyleOptionButton *option) const | - |
| 55 | { | - |
| 56 | if (!option) partially evaluated: !option| no Evaluation Count:0 | yes Evaluation Count:61 |
| 0-61 |
| 57 | return; | 0 |
| 58 | const QRadioButtonPrivate * const d = d_func(); | - |
| 59 | option->initFrom(this); | - |
| 60 | option->text = d->text; | - |
| 61 | option->icon = d->icon; | - |
| 62 | option->iconSize = iconSize(); | - |
| 63 | if (d->down) evaluated: d->down| yes Evaluation Count:1 | yes Evaluation Count:60 |
| 1-60 |
| 64 | option->state |= QStyle::State_Sunken; executed: option->state |= QStyle::State_Sunken;Execution Count:1 | 1 |
| 65 | option->state |= (d->checked) ? QStyle::State_On : QStyle::State_Off; evaluated: (d->checked)| yes Evaluation Count:7 | yes Evaluation Count:54 |
| 7-54 |
| 66 | if (testAttribute(Qt::WA_Hover) && underMouse()) { partially evaluated: testAttribute(Qt::WA_Hover)| no Evaluation Count:0 | yes Evaluation Count:61 |
never evaluated: underMouse() | 0-61 |
| 67 | if (d->hovering) never evaluated: d->hovering | 0 |
| 68 | option->state |= QStyle::State_MouseOver; never executed: option->state |= QStyle::State_MouseOver; | 0 |
| 69 | else | - |
| 70 | option->state &= ~QStyle::State_MouseOver; never executed: option->state &= ~QStyle::State_MouseOver; | 0 |
| 71 | } | - |
| 72 | } executed: }Execution Count:61 | 61 |
| 73 | | - |
| 74 | | - |
| 75 | | - |
| 76 | | - |
| 77 | QSize QRadioButton::sizeHint() const | - |
| 78 | { | - |
| 79 | const QRadioButtonPrivate * const d = d_func(); | - |
| 80 | if (d->sizeHint.isValid()) evaluated: d->sizeHint.isValid()| yes Evaluation Count:34 | yes Evaluation Count:35 |
| 34-35 |
| 81 | return d->sizeHint; executed: return d->sizeHint;Execution Count:34 | 34 |
| 82 | ensurePolished(); | - |
| 83 | QStyleOptionButton opt; | - |
| 84 | initStyleOption(&opt); | - |
| 85 | QSize sz = style()->itemTextRect(fontMetrics(), QRect(), Qt::TextShowMnemonic, | - |
| 86 | false, text()).size(); | - |
| 87 | if (!opt.icon.isNull()) partially evaluated: !opt.icon.isNull()| no Evaluation Count:0 | yes Evaluation Count:35 |
| 0-35 |
| 88 | sz = QSize(sz.width() + opt.iconSize.width() + 4, qMax(sz.height(), opt.iconSize.height())); never executed: sz = QSize(sz.width() + opt.iconSize.width() + 4, qMax(sz.height(), opt.iconSize.height())); | 0 |
| 89 | d->sizeHint = (style()->sizeFromContents(QStyle::CT_RadioButton, &opt, sz, this). | - |
| 90 | expandedTo(QApplication::globalStrut())); | - |
| 91 | return d->sizeHint; executed: return d->sizeHint;Execution Count:35 | 35 |
| 92 | } | - |
| 93 | | - |
| 94 | | - |
| 95 | | - |
| 96 | | - |
| 97 | QSize QRadioButton::minimumSizeHint() const | - |
| 98 | { | - |
| 99 | return sizeHint(); executed: return sizeHint();Execution Count:34 | 34 |
| 100 | } | - |
| 101 | | - |
| 102 | | - |
| 103 | | - |
| 104 | | - |
| 105 | bool QRadioButton::hitButton(const QPoint &pos) const | - |
| 106 | { | - |
| 107 | QStyleOptionButton opt; | - |
| 108 | initStyleOption(&opt); | - |
| 109 | return style()->subElementRect(QStyle::SE_RadioButtonClickRect, &opt, this).contains(pos); never executed: return style()->subElementRect(QStyle::SE_RadioButtonClickRect, &opt, this).contains(pos); | 0 |
| 110 | } | - |
| 111 | | - |
| 112 | | - |
| 113 | | - |
| 114 | | - |
| 115 | void QRadioButton::mouseMoveEvent(QMouseEvent *e) | - |
| 116 | { | - |
| 117 | QRadioButtonPrivate * const d = d_func(); | - |
| 118 | if (testAttribute(Qt::WA_Hover)) { never evaluated: testAttribute(Qt::WA_Hover) | 0 |
| 119 | bool hit = false; | - |
| 120 | if (underMouse()) never evaluated: underMouse() | 0 |
| 121 | hit = hitButton(e->pos()); never executed: hit = hitButton(e->pos()); | 0 |
| 122 | | - |
| 123 | if (hit != d->hovering) { never evaluated: hit != d->hovering | 0 |
| 124 | update(); | - |
| 125 | d->hovering = hit; | - |
| 126 | } | 0 |
| 127 | } | 0 |
| 128 | | - |
| 129 | QAbstractButton::mouseMoveEvent(e); | - |
| 130 | } | 0 |
| 131 | | - |
| 132 | | - |
| 133 | | - |
| 134 | void QRadioButton::paintEvent(QPaintEvent *) | - |
| 135 | { | - |
| 136 | QStylePainter p(this); | - |
| 137 | QStyleOptionButton opt; | - |
| 138 | initStyleOption(&opt); | - |
| 139 | p.drawControl(QStyle::CE_RadioButton, opt); | - |
| 140 | } executed: }Execution Count:26 | 26 |
| 141 | | - |
| 142 | | - |
| 143 | bool QRadioButton::event(QEvent *e) | - |
| 144 | { | - |
| 145 | QRadioButtonPrivate * const d = d_func(); | - |
| 146 | if (e->type() == QEvent::StyleChange evaluated: e->type() == QEvent::StyleChange| yes Evaluation Count:17 | yes Evaluation Count:424 |
| 17-424 |
| 147 | | - |
| 148 | | - |
| 149 | | - |
| 150 | ) | - |
| 151 | d->setLayoutItemMargins(QStyle::SE_RadioButtonLayoutItem); executed: d->setLayoutItemMargins(QStyle::SE_RadioButtonLayoutItem);Execution Count:17 | 17 |
| 152 | return QAbstractButton::event(e); executed: return QAbstractButton::event(e);Execution Count:441 | 441 |
| 153 | } | - |
| 154 | | - |
| 155 | | - |
| 156 | | - |
| 157 | | - |
| | |