Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | class QGroupBoxPrivate : public QWidgetPrivate | - |
9 | { | - |
10 | inline QGroupBox* q_func() { return static_cast<QGroupBox *>(q_ptr); } inline const QGroupBox* q_func() const { return static_cast<const QGroupBox *>(q_ptr); } friend class QGroupBox; | - |
11 | | - |
12 | public: | - |
13 | void skip(); | - |
14 | void init(); | - |
15 | void calculateFrame(); | - |
16 | QString title; | - |
17 | int align; | - |
18 | | - |
19 | int shortcutId; | - |
20 | | - |
21 | | - |
22 | void _q_fixFocus(Qt::FocusReason reason); | - |
23 | void _q_setChildrenEnabled(bool b); | - |
24 | void click(); | - |
25 | bool flat; | - |
26 | bool checkable; | - |
27 | bool checked; | - |
28 | bool hover; | - |
29 | bool overCheckBox; | - |
30 | QStyle::SubControl pressedControl; | - |
31 | }; | - |
32 | void QGroupBox::initStyleOption(QStyleOptionGroupBox *option) const | - |
33 | { | - |
34 | if (!option) partially evaluated: !option no Evaluation Count:0 | yes Evaluation Count:1009 |
| 0-1009 |
35 | return; | 0 |
36 | | - |
37 | const QGroupBoxPrivate * const d = d_func(); | - |
38 | option->initFrom(this); | - |
39 | option->text = d->title; | - |
40 | option->lineWidth = 1; | - |
41 | option->midLineWidth = 0; | - |
42 | option->textAlignment = Qt::Alignment(d->align); | - |
43 | option->activeSubControls |= d->pressedControl; | - |
44 | option->subControls = QStyle::SC_GroupBoxFrame; | - |
45 | | - |
46 | if (d->hover) partially evaluated: d->hover no Evaluation Count:0 | yes Evaluation Count:1009 |
| 0-1009 |
47 | option->state |= QStyle::State_MouseOver; never executed: option->state |= QStyle::State_MouseOver; | 0 |
48 | else | - |
49 | option->state &= ~QStyle::State_MouseOver; executed: option->state &= ~QStyle::State_MouseOver; Execution Count:1009 | 1009 |
50 | | - |
51 | if (d->flat) partially evaluated: d->flat no Evaluation Count:0 | yes Evaluation Count:1009 |
| 0-1009 |
52 | option->features |= QStyleOptionFrameV2::Flat; never executed: option->features |= QStyleOptionFrameV2::Flat; | 0 |
53 | | - |
54 | if (d->checkable) { evaluated: d->checkable yes Evaluation Count:157 | yes Evaluation Count:852 |
| 157-852 |
55 | option->subControls |= QStyle::SC_GroupBoxCheckBox; | - |
56 | option->state |= (d->checked ? QStyle::State_On : QStyle::State_Off); evaluated: d->checked yes Evaluation Count:113 | yes Evaluation Count:44 |
| 44-113 |
57 | if ((d->pressedControl == QStyle::SC_GroupBoxCheckBox evaluated: d->pressedControl == QStyle::SC_GroupBoxCheckBox yes Evaluation Count:8 | yes Evaluation Count:149 |
| 8-149 |
58 | || d->pressedControl == QStyle::SC_GroupBoxLabel) && (d->hover || d->overCheckBox)) evaluated: d->pressedControl == QStyle::SC_GroupBoxLabel yes Evaluation Count:4 | yes Evaluation Count:145 |
partially evaluated: d->hover no Evaluation Count:0 | yes Evaluation Count:12 |
partially evaluated: d->overCheckBox yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-145 |
59 | option->state |= QStyle::State_Sunken; executed: option->state |= QStyle::State_Sunken; Execution Count:12 | 12 |
60 | } executed: } Execution Count:157 | 157 |
61 | | - |
62 | if (!option->palette.isBrushSet(isEnabled() ? QPalette::Active : | 0-1009 |
63 | QPalette::Disabled, QPalette::WindowText)) partially evaluated: !option->palette.isBrushSet(isEnabled() ? QPalette::Active : QPalette::Disabled, QPalette::WindowText) yes Evaluation Count:1009 | no Evaluation Count:0 |
| 0-1009 |
64 | option->textColor = QColor(style()->styleHint(QStyle::SH_GroupBox_TextLabelColor, | 1009 |
65 | option, this)); executed: option->textColor = QColor(style()->styleHint(QStyle::SH_GroupBox_TextLabelColor, option, this)); Execution Count:1009 | 1009 |
66 | | - |
67 | if (!d->title.isEmpty()) evaluated: !d->title.isEmpty() yes Evaluation Count:634 | yes Evaluation Count:375 |
| 375-634 |
68 | option->subControls |= QStyle::SC_GroupBoxLabel; executed: option->subControls |= QStyle::SC_GroupBoxLabel; Execution Count:634 | 634 |
69 | } executed: } Execution Count:1009 | 1009 |
70 | | - |
71 | void QGroupBoxPrivate::click() | - |
72 | { | - |
73 | QGroupBox * const q = q_func(); | - |
74 | | - |
75 | QPointer<QGroupBox> guard(q); | - |
76 | q->setChecked(!checked); | - |
77 | if (!guard) partially evaluated: !guard no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
78 | return; | 0 |
79 | q->clicked(checked); | - |
80 | } executed: } Execution Count:6 | 6 |
81 | QGroupBox::QGroupBox(QWidget *parent) | - |
82 | : QWidget(*new QGroupBoxPrivate, parent, 0) | - |
83 | { | - |
84 | QGroupBoxPrivate * const d = d_func(); | - |
85 | d->init(); | - |
86 | } executed: } Execution Count:41 | 41 |
87 | | - |
88 | | - |
89 | | - |
90 | | - |
91 | | - |
92 | QGroupBox::QGroupBox(const QString &title, QWidget *parent) | - |
93 | : QWidget(*new QGroupBoxPrivate, parent, 0) | - |
94 | { | - |
95 | QGroupBoxPrivate * const d = d_func(); | - |
96 | d->init(); | - |
97 | setTitle(title); | - |
98 | } executed: } Execution Count:26 | 26 |
99 | | - |
100 | | - |
101 | | - |
102 | | - |
103 | | - |
104 | QGroupBox::~QGroupBox() | - |
105 | { | - |
106 | } | - |
107 | | - |
108 | void QGroupBoxPrivate::init() | - |
109 | { | - |
110 | QGroupBox * const q = q_func(); | - |
111 | align = Qt::AlignLeft; | - |
112 | | - |
113 | shortcutId = 0; | - |
114 | | - |
115 | flat = false; | - |
116 | checkable = false; | - |
117 | checked = true; | - |
118 | hover = false; | - |
119 | overCheckBox = false; | - |
120 | pressedControl = QStyle::SC_None; | - |
121 | calculateFrame(); | - |
122 | q->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred, | - |
123 | QSizePolicy::GroupBox)); | - |
124 | } executed: } Execution Count:67 | 67 |
125 | | - |
126 | void QGroupBox::setTitle(const QString &title) | - |
127 | { | - |
128 | QGroupBoxPrivate * const d = d_func(); | - |
129 | if (d->title == title) evaluated: d->title == title yes Evaluation Count:1 | yes Evaluation Count:54 |
| 1-54 |
130 | return; executed: return; Execution Count:1 | 1 |
131 | d->title = title; | - |
132 | | - |
133 | releaseShortcut(d->shortcutId); | - |
134 | d->shortcutId = grabShortcut(QKeySequence::mnemonic(title)); | - |
135 | | - |
136 | d->calculateFrame(); | - |
137 | | - |
138 | update(); | - |
139 | updateGeometry(); | - |
140 | | - |
141 | QAccessibleEvent event(this, QAccessible::NameChanged); | - |
142 | QAccessible::updateAccessibility(&event); | - |
143 | | - |
144 | } executed: } Execution Count:54 | 54 |
145 | QString QGroupBox::title() const | - |
146 | { | - |
147 | const QGroupBoxPrivate * const d = d_func(); | - |
148 | return d->title; executed: return d->title; Execution Count:22 | 22 |
149 | } | - |
150 | Qt::Alignment QGroupBox::alignment() const | - |
151 | { | - |
152 | const QGroupBoxPrivate * const d = d_func(); | - |
153 | return QFlag(d->align); executed: return QFlag(d->align); Execution Count:15 | 15 |
154 | } | - |
155 | | - |
156 | void QGroupBox::setAlignment(int alignment) | - |
157 | { | - |
158 | QGroupBoxPrivate * const d = d_func(); | - |
159 | d->align = alignment; | - |
160 | updateGeometry(); | - |
161 | update(); | - |
162 | } | 0 |
163 | | - |
164 | | - |
165 | | - |
166 | void QGroupBox::resizeEvent(QResizeEvent *e) | - |
167 | { | - |
168 | QWidget::resizeEvent(e); | - |
169 | } executed: } Execution Count:24 | 24 |
170 | | - |
171 | | - |
172 | | - |
173 | | - |
174 | void QGroupBox::paintEvent(QPaintEvent *) | - |
175 | { | - |
176 | QStylePainter paint(this); | - |
177 | QStyleOptionGroupBox option; | - |
178 | initStyleOption(&option); | - |
179 | paint.drawComplexControl(QStyle::CC_GroupBox, option); | - |
180 | } executed: } Execution Count:29 | 29 |
181 | | - |
182 | | - |
183 | bool QGroupBox::event(QEvent *e) | - |
184 | { | - |
185 | QGroupBoxPrivate * const d = d_func(); | - |
186 | | - |
187 | if (e->type() == QEvent::Shortcut) { partially evaluated: e->type() == QEvent::Shortcut no Evaluation Count:0 | yes Evaluation Count:760 |
| 0-760 |
188 | QShortcutEvent *se = static_cast<QShortcutEvent *>(e); | - |
189 | if (se->shortcutId() == d->shortcutId) { never evaluated: se->shortcutId() == d->shortcutId | 0 |
190 | if (!isCheckable()) { never evaluated: !isCheckable() | 0 |
191 | d->_q_fixFocus(Qt::ShortcutFocusReason); | - |
192 | } else { | 0 |
193 | d->click(); | - |
194 | setFocus(Qt::ShortcutFocusReason); | - |
195 | } | 0 |
196 | return true; never executed: return true; | 0 |
197 | } | - |
198 | } | 0 |
199 | | - |
200 | QStyleOptionGroupBox box; | - |
201 | initStyleOption(&box); | - |
202 | switch (e->type()) { | - |
203 | case QEvent::HoverEnter: | - |
204 | case QEvent::HoverMove: { | - |
205 | QStyle::SubControl control = style()->hitTestComplexControl(QStyle::CC_GroupBox, &box, | - |
206 | static_cast<QHoverEvent *>(e)->pos(), | - |
207 | this); | - |
208 | bool oldHover = d->hover; | - |
209 | d->hover = d->checkable && (control == QStyle::SC_GroupBoxLabel || control == QStyle::SC_GroupBoxCheckBox); never evaluated: d->checkable never evaluated: control == QStyle::SC_GroupBoxLabel never evaluated: control == QStyle::SC_GroupBoxCheckBox | 0 |
210 | if (oldHover != d->hover) { never evaluated: oldHover != d->hover | 0 |
211 | QRect rect = style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxCheckBox, this) | - |
212 | | style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxLabel, this); | - |
213 | update(rect); | - |
214 | } | 0 |
215 | return true; never executed: return true; | 0 |
216 | } | - |
217 | case QEvent::HoverLeave: | - |
218 | d->hover = false; | - |
219 | if (d->checkable) { never evaluated: d->checkable | 0 |
220 | QRect rect = style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxCheckBox, this) | - |
221 | | style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxLabel, this); | - |
222 | update(rect); | - |
223 | } | 0 |
224 | return true; never executed: return true; | 0 |
225 | case QEvent::KeyPress: { | - |
226 | QKeyEvent *k = static_cast<QKeyEvent*>(e); | - |
227 | if (!k->isAutoRepeat() && (k->key() == Qt::Key_Select || k->key() == Qt::Key_Space)) { partially evaluated: !k->isAutoRepeat() yes Evaluation Count:3 | no Evaluation Count:0 |
partially evaluated: k->key() == Qt::Key_Select no Evaluation Count:0 | yes Evaluation Count:3 |
partially evaluated: k->key() == Qt::Key_Space no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
228 | d->pressedControl = QStyle::SC_GroupBoxCheckBox; | - |
229 | update(style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxCheckBox, this)); | - |
230 | return true; never executed: return true; | 0 |
231 | } | - |
232 | break; executed: break; Execution Count:3 | 3 |
233 | } | - |
234 | case QEvent::KeyRelease: { | - |
235 | QKeyEvent *k = static_cast<QKeyEvent*>(e); | - |
236 | if (!k->isAutoRepeat() && (k->key() == Qt::Key_Select || k->key() == Qt::Key_Space)) { partially evaluated: !k->isAutoRepeat() yes Evaluation Count:13 | no Evaluation Count:0 |
partially evaluated: k->key() == Qt::Key_Select no Evaluation Count:0 | yes Evaluation Count:13 |
partially evaluated: k->key() == Qt::Key_Space no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
237 | bool toggle = (d->pressedControl == QStyle::SC_GroupBoxLabel never evaluated: d->pressedControl == QStyle::SC_GroupBoxLabel | 0 |
238 | || d->pressedControl == QStyle::SC_GroupBoxCheckBox); never evaluated: d->pressedControl == QStyle::SC_GroupBoxCheckBox | 0 |
239 | d->pressedControl = QStyle::SC_None; | - |
240 | if (toggle) | 0 |
241 | d->click(); never executed: d->click(); | 0 |
242 | return true; never executed: return true; | 0 |
243 | } | - |
244 | break; executed: break; Execution Count:13 | 13 |
245 | } | - |
246 | default: | - |
247 | break; executed: break; Execution Count:744 | 744 |
248 | } | - |
249 | return QWidget::event(e); executed: return QWidget::event(e); Execution Count:760 | 760 |
250 | } | - |
251 | | - |
252 | | - |
253 | void QGroupBox::childEvent(QChildEvent *c) | - |
254 | { | - |
255 | QGroupBoxPrivate * const d = d_func(); | - |
256 | if (c->type() != QEvent::ChildAdded || !c->child()->isWidgetType()) evaluated: c->type() != QEvent::ChildAdded yes Evaluation Count:89 | yes Evaluation Count:156 |
evaluated: !c->child()->isWidgetType() yes Evaluation Count:35 | yes Evaluation Count:121 |
| 35-156 |
257 | return; executed: return; Execution Count:124 | 124 |
258 | QWidget *w = (QWidget*)c->child(); | - |
259 | if (d->checkable) { evaluated: d->checkable yes Evaluation Count:9 | yes Evaluation Count:112 |
| 9-112 |
260 | if (d->checked) { evaluated: d->checked yes Evaluation Count:6 | yes Evaluation Count:3 |
| 3-6 |
261 | if (!w->testAttribute(Qt::WA_ForceDisabled)) partially evaluated: !w->testAttribute(Qt::WA_ForceDisabled) yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
262 | w->setEnabled(true); executed: w->setEnabled(true); Execution Count:6 | 6 |
263 | } else { executed: } Execution Count:6 | 6 |
264 | if (w->isEnabled()) { partially evaluated: w->isEnabled() yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
265 | w->setEnabled(false); | - |
266 | w->setAttribute(Qt::WA_ForceDisabled, false); | - |
267 | } executed: } Execution Count:3 | 3 |
268 | } executed: } Execution Count:3 | 3 |
269 | } | - |
270 | } executed: } Execution Count:121 | 121 |
271 | void QGroupBoxPrivate::_q_fixFocus(Qt::FocusReason reason) | - |
272 | { | - |
273 | QGroupBox * const q = q_func(); | - |
274 | QWidget *fw = q->focusWidget(); | - |
275 | if (!fw || fw == q) { partially evaluated: !fw no Evaluation Count:0 | yes Evaluation Count:1 |
partially evaluated: fw == q yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
276 | QWidget * best = 0; | - |
277 | QWidget * candidate = 0; | - |
278 | QWidget * w = q; | - |
279 | while ((w = w->nextInFocusChain()) != q) { evaluated: (w = w->nextInFocusChain()) != q yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
280 | if (q->isAncestorOf(w) && (w->focusPolicy() & Qt::TabFocus) == Qt::TabFocus && w->isVisibleTo(q)) { partially evaluated: q->isAncestorOf(w) yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: (w->focusPolicy() & Qt::TabFocus) == Qt::TabFocus yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: w->isVisibleTo(q) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
281 | if (!best && qobject_cast<QRadioButton*>(w) && ((QRadioButton*)w)->isChecked()) partially evaluated: !best yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: qobject_cast<QRadioButton*>(w) no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: ((QRadioButton*)w)->isChecked() | 0-1 |
282 | | - |
283 | | - |
284 | best = w; never executed: best = w; | 0 |
285 | else | - |
286 | if (!candidate) partially evaluated: !candidate yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
287 | | - |
288 | candidate = w; executed: candidate = w; Execution Count:1 | 1 |
289 | } | - |
290 | } executed: } Execution Count:1 | 1 |
291 | if (best) partially evaluated: best no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
292 | fw = best; never executed: fw = best; | 0 |
293 | else if (candidate) partially evaluated: candidate yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
294 | fw = candidate; executed: fw = candidate; Execution Count:1 | 1 |
295 | } | - |
296 | if (fw) partially evaluated: fw yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
297 | fw->setFocus(reason); executed: fw->setFocus(reason); Execution Count:1 | 1 |
298 | } executed: } Execution Count:1 | 1 |
299 | | - |
300 | | - |
301 | | - |
302 | | - |
303 | void QGroupBoxPrivate::calculateFrame() | - |
304 | { | - |
305 | QGroupBox * const q = q_func(); | - |
306 | QStyleOptionGroupBox box; | - |
307 | q->initStyleOption(&box); | - |
308 | QRect contentsRect = q->style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxContents, q); | - |
309 | q->setContentsMargins(contentsRect.left() - box.rect.left(), contentsRect.top() - box.rect.top(), | - |
310 | box.rect.right() - contentsRect.right(), box.rect.bottom() - contentsRect.bottom()); | - |
311 | setLayoutItemMargins(QStyle::SE_GroupBoxLayoutItem, &box); | - |
312 | } executed: } Execution Count:155 | 155 |
313 | | - |
314 | | - |
315 | | - |
316 | void QGroupBox::focusInEvent(QFocusEvent *fe) | - |
317 | { | - |
318 | QGroupBoxPrivate * const d = d_func(); | - |
319 | if (focusPolicy() == Qt::NoFocus) { partially evaluated: focusPolicy() == Qt::NoFocus yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
320 | d->_q_fixFocus(fe->reason()); | - |
321 | } else { executed: } Execution Count:1 | 1 |
322 | QWidget::focusInEvent(fe); | - |
323 | } | 0 |
324 | } | - |
325 | | - |
326 | | - |
327 | | - |
328 | | - |
329 | | - |
330 | QSize QGroupBox::minimumSizeHint() const | - |
331 | { | - |
332 | const QGroupBoxPrivate * const d = d_func(); | - |
333 | QStyleOptionGroupBox option; | - |
334 | initStyleOption(&option); | - |
335 | | - |
336 | QFontMetrics metrics(fontMetrics()); | - |
337 | | - |
338 | int baseWidth = metrics.width(d->title) + metrics.width(QLatin1Char(' ')); | - |
339 | int baseHeight = metrics.height(); | - |
340 | if (d->checkable) { evaluated: d->checkable yes Evaluation Count:4 | yes Evaluation Count:38 |
| 4-38 |
341 | baseWidth += style()->pixelMetric(QStyle::PM_IndicatorWidth); | - |
342 | baseWidth += style()->pixelMetric(QStyle::PM_CheckBoxLabelSpacing); | - |
343 | baseHeight = qMax(baseHeight, style()->pixelMetric(QStyle::PM_IndicatorHeight)); | - |
344 | } executed: } Execution Count:4 | 4 |
345 | | - |
346 | QSize size = style()->sizeFromContents(QStyle::CT_GroupBox, &option, QSize(baseWidth, baseHeight), this); | - |
347 | return size.expandedTo(QWidget::minimumSizeHint()); executed: return size.expandedTo(QWidget::minimumSizeHint()); Execution Count:42 | 42 |
348 | } | - |
349 | bool QGroupBox::isFlat() const | - |
350 | { | - |
351 | const QGroupBoxPrivate * const d = d_func(); | - |
352 | return d->flat; executed: return d->flat; Execution Count:42 | 42 |
353 | } | - |
354 | | - |
355 | void QGroupBox::setFlat(bool b) | - |
356 | { | - |
357 | QGroupBoxPrivate * const d = d_func(); | - |
358 | if (d->flat == b) never evaluated: d->flat == b | 0 |
359 | return; | 0 |
360 | d->flat = b; | - |
361 | updateGeometry(); | - |
362 | update(); | - |
363 | } | 0 |
364 | void QGroupBox::setCheckable(bool checkable) | - |
365 | { | - |
366 | QGroupBoxPrivate * const d = d_func(); | - |
367 | | - |
368 | bool wasCheckable = d->checkable; | - |
369 | d->checkable = checkable; | - |
370 | | - |
371 | if (checkable) { evaluated: checkable yes Evaluation Count:20 | yes Evaluation Count:7 |
| 7-20 |
372 | setChecked(true); | - |
373 | if (!wasCheckable) { partially evaluated: !wasCheckable yes Evaluation Count:20 | no Evaluation Count:0 |
| 0-20 |
374 | setFocusPolicy(Qt::StrongFocus); | - |
375 | d->_q_setChildrenEnabled(true); | - |
376 | updateGeometry(); | - |
377 | } executed: } Execution Count:20 | 20 |
378 | } else { executed: } Execution Count:20 | 20 |
379 | if (wasCheckable) { partially evaluated: wasCheckable no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
380 | setFocusPolicy(Qt::NoFocus); | - |
381 | d->_q_setChildrenEnabled(true); | - |
382 | updateGeometry(); | - |
383 | } | 0 |
384 | d->_q_setChildrenEnabled(true); | - |
385 | } executed: } Execution Count:7 | 7 |
386 | | - |
387 | if (wasCheckable != checkable) { evaluated: wasCheckable != checkable yes Evaluation Count:20 | yes Evaluation Count:7 |
| 7-20 |
388 | d->calculateFrame(); | - |
389 | update(); | - |
390 | } executed: } Execution Count:20 | 20 |
391 | } executed: } Execution Count:27 | 27 |
392 | | - |
393 | bool QGroupBox::isCheckable() const | - |
394 | { | - |
395 | const QGroupBoxPrivate * const d = d_func(); | - |
396 | return d->checkable; executed: return d->checkable; Execution Count:8 | 8 |
397 | } | - |
398 | | - |
399 | | - |
400 | bool QGroupBox::isChecked() const | - |
401 | { | - |
402 | const QGroupBoxPrivate * const d = d_func(); | - |
403 | return d->checkable && d->checked; executed: return d->checkable && d->checked; Execution Count:42 | 42 |
404 | } | - |
405 | void QGroupBox::setChecked(bool b) | - |
406 | { | - |
407 | QGroupBoxPrivate * const d = d_func(); | - |
408 | if (d->checkable && b != d->checked) { evaluated: d->checkable yes Evaluation Count:51 | yes Evaluation Count:6 |
evaluated: b != d->checked yes Evaluation Count:23 | yes Evaluation Count:28 |
| 6-51 |
409 | update(); | - |
410 | d->checked = b; | - |
411 | d->_q_setChildrenEnabled(b); | - |
412 | | - |
413 | QAccessible::State st; | - |
414 | st.checked = true; | - |
415 | QAccessibleStateChangeEvent *ev = new QAccessibleStateChangeEvent(this, st); | - |
416 | QAccessible::updateAccessibility(ev); | - |
417 | | - |
418 | toggled(b); | - |
419 | } executed: } Execution Count:23 | 23 |
420 | } executed: } Execution Count:57 | 57 |
421 | | - |
422 | | - |
423 | | - |
424 | | - |
425 | | - |
426 | void QGroupBoxPrivate::_q_setChildrenEnabled(bool b) | - |
427 | { | - |
428 | QGroupBox * const q = q_func(); | - |
429 | QObjectList childList = q->children(); | - |
430 | for (int i = 0; i < childList.size(); ++i) { evaluated: i < childList.size() yes Evaluation Count:14 | yes Evaluation Count:53 |
| 14-53 |
431 | QObject *o = childList.at(i); | - |
432 | if (o->isWidgetType()) { evaluated: o->isWidgetType() yes Evaluation Count:12 | yes Evaluation Count:2 |
| 2-12 |
433 | QWidget *w = static_cast<QWidget *>(o); | - |
434 | if (b) { evaluated: b yes Evaluation Count:4 | yes Evaluation Count:8 |
| 4-8 |
435 | if (!w->testAttribute(Qt::WA_ForceDisabled)) partially evaluated: !w->testAttribute(Qt::WA_ForceDisabled) yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
436 | w->setEnabled(true); executed: w->setEnabled(true); Execution Count:4 | 4 |
437 | } else { executed: } Execution Count:4 | 4 |
438 | if (w->isEnabled()) { evaluated: w->isEnabled() yes Evaluation Count:7 | yes Evaluation Count:1 |
| 1-7 |
439 | w->setEnabled(false); | - |
440 | w->setAttribute(Qt::WA_ForceDisabled, false); | - |
441 | } executed: } Execution Count:7 | 7 |
442 | } executed: } Execution Count:8 | 8 |
443 | } | - |
444 | } executed: } Execution Count:14 | 14 |
445 | } executed: } Execution Count:53 | 53 |
446 | | - |
447 | | - |
448 | void QGroupBox::changeEvent(QEvent *ev) | - |
449 | { | - |
450 | QGroupBoxPrivate * const d = d_func(); | - |
451 | if (ev->type() == QEvent::EnabledChange) { evaluated: ev->type() == QEvent::EnabledChange yes Evaluation Count:18 | yes Evaluation Count:159 |
| 18-159 |
452 | if (d->checkable && isEnabled()) { partially evaluated: d->checkable yes Evaluation Count:18 | no Evaluation Count:0 |
evaluated: isEnabled() yes Evaluation Count:9 | yes Evaluation Count:9 |
| 0-18 |
453 | | - |
454 | if (!d->checked) evaluated: !d->checked yes Evaluation Count:3 | yes Evaluation Count:6 |
| 3-6 |
455 | d->_q_setChildrenEnabled(false); executed: d->_q_setChildrenEnabled(false); Execution Count:3 | 3 |
456 | } executed: } Execution Count:9 | 9 |
457 | } else if (ev->type() == QEvent::FontChange partially evaluated: ev->type() == QEvent::FontChange no Evaluation Count:0 | yes Evaluation Count:159 |
executed: } Execution Count:18 | 0-159 |
458 | | - |
459 | | - |
460 | | - |
461 | || ev->type() == QEvent::StyleChange) { evaluated: ev->type() == QEvent::StyleChange yes Evaluation Count:14 | yes Evaluation Count:145 |
| 14-145 |
462 | d->calculateFrame(); | - |
463 | } executed: } Execution Count:14 | 14 |
464 | QWidget::changeEvent(ev); | - |
465 | } executed: } Execution Count:177 | 177 |
466 | | - |
467 | | - |
468 | void QGroupBox::mousePressEvent(QMouseEvent *event) | - |
469 | { | - |
470 | if (event->button() != Qt::LeftButton) { partially evaluated: event->button() != Qt::LeftButton no Evaluation Count:0 | yes Evaluation Count:17 |
| 0-17 |
471 | event->ignore(); | - |
472 | return; | 0 |
473 | } | - |
474 | | - |
475 | QGroupBoxPrivate * const d = d_func(); | - |
476 | QStyleOptionGroupBox box; | - |
477 | initStyleOption(&box); | - |
478 | d->pressedControl = style()->hitTestComplexControl(QStyle::CC_GroupBox, &box, | - |
479 | event->pos(), this); | - |
480 | if (d->checkable && (d->pressedControl & (QStyle::SC_GroupBoxCheckBox | QStyle::SC_GroupBoxLabel))) { evaluated: d->checkable yes Evaluation Count:12 | yes Evaluation Count:5 |
evaluated: (d->pressedControl & (QStyle::SC_GroupBoxCheckBox | QStyle::SC_GroupBoxLabel)) yes Evaluation Count:6 | yes Evaluation Count:6 |
| 5-12 |
481 | d->overCheckBox = true; | - |
482 | update(style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxCheckBox, this)); | - |
483 | } executed: } Execution Count:6 | 6 |
484 | } executed: } Execution Count:17 | 17 |
485 | | - |
486 | | - |
487 | void QGroupBox::mouseMoveEvent(QMouseEvent *event) | - |
488 | { | - |
489 | QGroupBoxPrivate * const d = d_func(); | - |
490 | QStyleOptionGroupBox box; | - |
491 | initStyleOption(&box); | - |
492 | QStyle::SubControl pressed = style()->hitTestComplexControl(QStyle::CC_GroupBox, &box, | - |
493 | event->pos(), this); | - |
494 | bool oldOverCheckBox = d->overCheckBox; | - |
495 | d->overCheckBox = (pressed == QStyle::SC_GroupBoxCheckBox || pressed == QStyle::SC_GroupBoxLabel); never evaluated: pressed == QStyle::SC_GroupBoxCheckBox never evaluated: pressed == QStyle::SC_GroupBoxLabel | 0 |
496 | if (d->checkable && (d->pressedControl == QStyle::SC_GroupBoxCheckBox || d->pressedControl == QStyle::SC_GroupBoxLabel) never evaluated: d->checkable never evaluated: d->pressedControl == QStyle::SC_GroupBoxCheckBox never evaluated: d->pressedControl == QStyle::SC_GroupBoxLabel | 0 |
497 | && (d->overCheckBox != oldOverCheckBox)) never evaluated: (d->overCheckBox != oldOverCheckBox) | 0 |
498 | update(style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxCheckBox, this)); never executed: update(style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxCheckBox, this)); | 0 |
499 | } | 0 |
500 | | - |
501 | | - |
502 | void QGroupBox::mouseReleaseEvent(QMouseEvent *event) | - |
503 | { | - |
504 | if (event->button() != Qt::LeftButton) { partially evaluated: event->button() != Qt::LeftButton no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
505 | event->ignore(); | - |
506 | return; | 0 |
507 | } | - |
508 | | - |
509 | QGroupBoxPrivate * const d = d_func(); | - |
510 | if (!d->overCheckBox) { evaluated: !d->overCheckBox yes Evaluation Count:12 | yes Evaluation Count:6 |
| 6-12 |
511 | event->ignore(); | - |
512 | return; executed: return; Execution Count:12 | 12 |
513 | } | - |
514 | QStyleOptionGroupBox box; | - |
515 | initStyleOption(&box); | - |
516 | QStyle::SubControl released = style()->hitTestComplexControl(QStyle::CC_GroupBox, &box, | - |
517 | event->pos(), this); | - |
518 | bool toggle = d->checkable && (released == QStyle::SC_GroupBoxLabel partially evaluated: d->checkable yes Evaluation Count:6 | no Evaluation Count:0 |
evaluated: released == QStyle::SC_GroupBoxLabel yes Evaluation Count:2 | yes Evaluation Count:4 |
| 0-6 |
519 | || released == QStyle::SC_GroupBoxCheckBox); partially evaluated: released == QStyle::SC_GroupBoxCheckBox yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
520 | d->pressedControl = QStyle::SC_None; | - |
521 | d->overCheckBox = false; | - |
522 | if (toggle) partially evaluated: toggle yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
523 | d->click(); executed: d->click(); Execution Count:6 | 6 |
524 | else if (d->checkable) never evaluated: d->checkable | 0 |
525 | update(style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxCheckBox, this)); never executed: update(style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxCheckBox, this)); | 0 |
526 | } | - |
527 | | - |
528 | | - |
529 | | - |
530 | | - |
531 | | - |
| | |