qgroupbox.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qgroupbox.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8class 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-
12public:-
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};-
32void QGroupBox::initStyleOption(QStyleOptionGroupBox *option) const-
33{-
34 if (!option
!optionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
35 return;
never executed: 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
d->hoverDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
47 option->state |= QStyle::State_MouseOver;
never executed: option->state |= QStyle::State_MouseOver;
0
48 else-
49 option->state &= ~QStyle::State_MouseOver;
never executed: option->state &= ~QStyle::State_MouseOver;
0
50-
51 if (d->flat
d->flatDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
52 option->features |= QStyleOptionFrame::Flat;
never executed: option->features |= QStyleOptionFrame::Flat;
0
53-
54 if (d->checkable
d->checkableDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
55 option->subControls |= QStyle::SC_GroupBoxCheckBox;-
56 option->state |= (d->checked
d->checkedDescription
TRUEnever evaluated
FALSEnever evaluated
? QStyle::State_On : QStyle::State_Off);
0
57 if ((d->pressedControl == QStyle::SC_GroupBoxCheckBox
d->pressedCont...oupBoxCheckBoxDescription
TRUEnever evaluated
FALSEnever evaluated
0
58 || d->pressedControl == QStyle::SC_GroupBoxLabel
d->pressedCont..._GroupBoxLabelDescription
TRUEnever evaluated
FALSEnever evaluated
) && (d->hover
d->hoverDescription
TRUEnever evaluated
FALSEnever evaluated
|| d->overCheckBox
d->overCheckBoxDescription
TRUEnever evaluated
FALSEnever evaluated
))
0
59 option->state |= QStyle::State_Sunken;
never executed: option->state |= QStyle::State_Sunken;
0
60 }
never executed: end of block
0
61-
62 if (!option->palette.isBrushSet(isEnabled() ? QPalette::Active :
!option->palet...e::WindowText)Description
TRUEnever evaluated
FALSEnever evaluated
0
63 QPalette::Disabled, QPalette::WindowText)
!option->palet...e::WindowText)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
64 option->textColor = QColor(style()->styleHint(QStyle::SH_GroupBox_TextLabelColor,
never executed: option->textColor = QColor(style()->styleHint(QStyle::SH_GroupBox_TextLabelColor, option, this));
0
65 option, this));
never executed: option->textColor = QColor(style()->styleHint(QStyle::SH_GroupBox_TextLabelColor, option, this));
0
66-
67 if (!d->title.isEmpty()
!d->title.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
68 option->subControls |= QStyle::SC_GroupBoxLabel;
never executed: option->subControls |= QStyle::SC_GroupBoxLabel;
0
69}
never executed: end of block
0
70-
71void QGroupBoxPrivate::click()-
72{-
73 QGroupBox * const q = q_func();-
74-
75 QPointer<QGroupBox> guard(q);-
76 q->setChecked(!checked);-
77 if (!guard
!guardDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
78 return;
never executed: return;
0
79 q->clicked(checked);-
80}
never executed: end of block
0
81QGroupBox::QGroupBox(QWidget *parent)-
82 : QWidget(*new QGroupBoxPrivate, parent, 0)-
83{-
84 QGroupBoxPrivate * const d = d_func();-
85 d->init();-
86}
never executed: end of block
0
87-
88-
89-
90-
91-
92QGroupBox::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}
never executed: end of block
0
99-
100-
101-
102-
103-
104QGroupBox::~QGroupBox()-
105{-
106}-
107-
108void 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}
never executed: end of block
0
125-
126void QGroupBox::setTitle(const QString &title)-
127{-
128 QGroupBoxPrivate * const d = d_func();-
129 if (d->title == title
d->title == titleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
130 return;
never executed: return;
0
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}
never executed: end of block
0
145QString QGroupBox::title() const-
146{-
147 const QGroupBoxPrivate * const d = d_func();-
148 return
never executed: return d->title;
d->title;
never executed: return d->title;
0
149}-
150Qt::Alignment QGroupBox::alignment() const-
151{-
152 const QGroupBoxPrivate * const d = d_func();-
153 return
never executed: return QFlag(d->align);
QFlag(d->align);
never executed: return QFlag(d->align);
0
154}-
155-
156void QGroupBox::setAlignment(int alignment)-
157{-
158 QGroupBoxPrivate * const d = d_func();-
159 d->align = alignment;-
160 updateGeometry();-
161 update();-
162}
never executed: end of block
0
163-
164-
165-
166void QGroupBox::resizeEvent(QResizeEvent *e)-
167{-
168 QWidget::resizeEvent(e);-
169}
never executed: end of block
0
170-
171-
172-
173-
174void QGroupBox::paintEvent(QPaintEvent *)-
175{-
176 QStylePainter paint(this);-
177 QStyleOptionGroupBox option;-
178 initStyleOption(&option);-
179 paint.drawComplexControl(QStyle::CC_GroupBox, option);-
180}
never executed: end of block
0
181-
182-
183bool QGroupBox::event(QEvent *e)-
184{-
185 QGroupBoxPrivate * const d = d_func();-
186-
187 if (e->type() == QEvent::Shortcut
e->type() == QEvent::ShortcutDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
188 QShortcutEvent *se = static_cast<QShortcutEvent *>(e);-
189 if (se->shortcutId() == d->shortcutId
se->shortcutId... d->shortcutIdDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
190 if (!isCheckable()
!isCheckable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
191 d->_q_fixFocus(Qt::ShortcutFocusReason);-
192 }
never executed: end of block
else {
0
193 d->click();-
194 setFocus(Qt::ShortcutFocusReason);-
195 }
never executed: end of block
0
196 return
never executed: return true;
true;
never executed: return true;
0
197 }-
198 }
never executed: end of block
0
199-
200 QStyleOptionGroupBox box;-
201 initStyleOption(&box);-
202 switch (e->type()) {-
203 case
never executed: case QEvent::HoverEnter:
QEvent::HoverEnter:
never executed: case QEvent::HoverEnter:
0
204 case
never executed: case QEvent::HoverMove:
QEvent::HoverMove:
never executed: case QEvent::HoverMove:
{
0
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
d->checkableDescription
TRUEnever evaluated
FALSEnever evaluated
&& (control == QStyle::SC_GroupBoxLabel
control == QSt..._GroupBoxLabelDescription
TRUEnever evaluated
FALSEnever evaluated
|| control == QStyle::SC_GroupBoxCheckBox
control == QSt...oupBoxCheckBoxDescription
TRUEnever evaluated
FALSEnever evaluated
);
0
210 if (oldHover != d->hover
oldHover != d->hoverDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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 }
never executed: end of block
0
215 return
never executed: return true;
true;
never executed: return true;
0
216 }-
217 case
never executed: case QEvent::HoverLeave:
QEvent::HoverLeave:
never executed: case QEvent::HoverLeave:
0
218 d->hover = false;-
219 if (d->checkable
d->checkableDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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 }
never executed: end of block
0
224 return
never executed: return true;
true;
never executed: return true;
0
225 case
never executed: case QEvent::KeyPress:
QEvent::KeyPress:
never executed: case QEvent::KeyPress:
{
0
226 QKeyEvent *k = static_cast<QKeyEvent*>(e);-
227 if (!k->isAutoRepeat()
!k->isAutoRepeat()Description
TRUEnever evaluated
FALSEnever evaluated
&& (k->key() == Qt::Key_Select
k->key() == Qt::Key_SelectDescription
TRUEnever evaluated
FALSEnever evaluated
|| k->key() == Qt::Key_Space
k->key() == Qt::Key_SpaceDescription
TRUEnever evaluated
FALSEnever evaluated
)) {
0
228 d->pressedControl = QStyle::SC_GroupBoxCheckBox;-
229 update(style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxCheckBox, this));-
230 return
never executed: return true;
true;
never executed: return true;
0
231 }-
232 break;
never executed: break;
0
233 }-
234 case
never executed: case QEvent::KeyRelease:
QEvent::KeyRelease:
never executed: case QEvent::KeyRelease:
{
0
235 QKeyEvent *k = static_cast<QKeyEvent*>(e);-
236 if (!k->isAutoRepeat()
!k->isAutoRepeat()Description
TRUEnever evaluated
FALSEnever evaluated
&& (k->key() == Qt::Key_Select
k->key() == Qt::Key_SelectDescription
TRUEnever evaluated
FALSEnever evaluated
|| k->key() == Qt::Key_Space
k->key() == Qt::Key_SpaceDescription
TRUEnever evaluated
FALSEnever evaluated
)) {
0
237 bool toggle = (d->pressedControl == QStyle::SC_GroupBoxLabel
d->pressedCont..._GroupBoxLabelDescription
TRUEnever evaluated
FALSEnever evaluated
0
238 || d->pressedControl == QStyle::SC_GroupBoxCheckBox
d->pressedCont...oupBoxCheckBoxDescription
TRUEnever evaluated
FALSEnever evaluated
);
0
239 d->pressedControl = QStyle::SC_None;-
240 if (toggle
toggleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
241 d->click();
never executed: d->click();
0
242 return
never executed: return true;
true;
never executed: return true;
0
243 }-
244 break;
never executed: break;
0
245 }-
246 default
never executed: default:
:
never executed: default:
0
247 break;
never executed: break;
0
248 }-
249 return
never executed: return QWidget::event(e);
QWidget::event(e);
never executed: return QWidget::event(e);
0
250}-
251-
252-
253void QGroupBox::childEvent(QChildEvent *c)-
254{-
255 QGroupBoxPrivate * const d = d_func();-
256 if (c->type() != QEvent::ChildAdded
c->type() != Q...nt::ChildAddedDescription
TRUEnever evaluated
FALSEnever evaluated
|| !c->child()->isWidgetType()
!c->child()->isWidgetType()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
257 return;
never executed: return;
0
258 QWidget *w = (QWidget*)c->child();-
259 if (w->isWindow()
w->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
260 return;
never executed: return;
0
261 if (d->checkable
d->checkableDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
262 if (d->checked
d->checkedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
263 if (!w->testAttribute(Qt::WA_ForceDisabled)
!w->testAttrib...ForceDisabled)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
264 w->setEnabled(true);
never executed: w->setEnabled(true);
0
265 }
never executed: end of block
else {
0
266 if (w->isEnabled()
w->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
267 w->setEnabled(false);-
268 w->setAttribute(Qt::WA_ForceDisabled, false);-
269 }
never executed: end of block
0
270 }
never executed: end of block
0
271 }-
272}
never executed: end of block
0
273void QGroupBoxPrivate::_q_fixFocus(Qt::FocusReason reason)-
274{-
275 QGroupBox * const q = q_func();-
276 QWidget *fw = q->focusWidget();-
277 if (!fw
!fwDescription
TRUEnever evaluated
FALSEnever evaluated
|| fw == q
fw == qDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
278 QWidget * best = 0;-
279 QWidget * candidate = 0;-
280 QWidget * w = q;-
281 while ((
(w = w->nextIn...sChain()) != qDescription
TRUEnever evaluated
FALSEnever evaluated
w = w->nextInFocusChain()) != q
(w = w->nextIn...sChain()) != qDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
282 if (q->isAncestorOf(w)
q->isAncestorOf(w)Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(w->focusPolic...= Qt::TabFocusDescription
TRUEnever evaluated
FALSEnever evaluated
w->focusPolicy() & Qt::TabFocus) == Qt::TabFocus
(w->focusPolic...= Qt::TabFocusDescription
TRUEnever evaluated
FALSEnever evaluated
&& w->isVisibleTo(q)
w->isVisibleTo(q)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
283 if (!best
!bestDescription
TRUEnever evaluated
FALSEnever evaluated
&& qobject_cast<QRadioButton*>(w)
qobject_cast<QRadioButton*>(w)Description
TRUEnever evaluated
FALSEnever evaluated
&& ((
((QRadioButton...)->isChecked()Description
TRUEnever evaluated
FALSEnever evaluated
QRadioButton*)w)->isChecked()
((QRadioButton...)->isChecked()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
284-
285-
286 best = w;
never executed: best = w;
0
287 else-
288 if (!candidate
!candidateDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
289-
290 candidate = w;
never executed: candidate = w;
0
291 }
never executed: end of block
0
292 }
never executed: end of block
0
293 if (best
bestDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
294 fw = best;
never executed: fw = best;
0
295 else if (candidate
candidateDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
296 fw = candidate;
never executed: fw = candidate;
0
297 }
never executed: end of block
0
298 if (fw
fwDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
299 fw->setFocus(reason);
never executed: fw->setFocus(reason);
0
300}
never executed: end of block
0
301-
302-
303-
304-
305void QGroupBoxPrivate::calculateFrame()-
306{-
307 QGroupBox * const q = q_func();-
308 QStyleOptionGroupBox box;-
309 q->initStyleOption(&box);-
310 QRect contentsRect = q->style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxContents, q);-
311 q->setContentsMargins(contentsRect.left() - box.rect.left(), contentsRect.top() - box.rect.top(),-
312 box.rect.right() - contentsRect.right(), box.rect.bottom() - contentsRect.bottom());-
313 setLayoutItemMargins(QStyle::SE_GroupBoxLayoutItem, &box);-
314}
never executed: end of block
0
315-
316-
317-
318void QGroupBox::focusInEvent(QFocusEvent *fe)-
319{-
320 QGroupBoxPrivate * const d = d_func();-
321 if (focusPolicy() == Qt::NoFocus
focusPolicy() == Qt::NoFocusDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
322 d->_q_fixFocus(fe->reason());-
323 }
never executed: end of block
else {
0
324 QWidget::focusInEvent(fe);-
325 }
never executed: end of block
0
326}-
327-
328-
329-
330-
331-
332QSize QGroupBox::minimumSizeHint() const-
333{-
334 const QGroupBoxPrivate * const d = d_func();-
335 QStyleOptionGroupBox option;-
336 initStyleOption(&option);-
337-
338 QFontMetrics metrics(fontMetrics());-
339-
340 int baseWidth = metrics.width(d->title) + metrics.width(QLatin1Char(' '));-
341 int baseHeight = metrics.height();-
342 if (d->checkable
d->checkableDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
343 baseWidth += style()->pixelMetric(QStyle::PM_IndicatorWidth);-
344 baseWidth += style()->pixelMetric(QStyle::PM_CheckBoxLabelSpacing);-
345 baseHeight = qMax(baseHeight, style()->pixelMetric(QStyle::PM_IndicatorHeight));-
346 }
never executed: end of block
0
347-
348 QSize size = style()->sizeFromContents(QStyle::CT_GroupBox, &option, QSize(baseWidth, baseHeight), this);-
349 return
never executed: return size.expandedTo(QWidget::minimumSizeHint());
size.expandedTo(QWidget::minimumSizeHint());
never executed: return size.expandedTo(QWidget::minimumSizeHint());
0
350}-
351bool QGroupBox::isFlat() const-
352{-
353 const QGroupBoxPrivate * const d = d_func();-
354 return
never executed: return d->flat;
d->flat;
never executed: return d->flat;
0
355}-
356-
357void QGroupBox::setFlat(bool b)-
358{-
359 QGroupBoxPrivate * const d = d_func();-
360 if (d->flat == b
d->flat == bDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
361 return;
never executed: return;
0
362 d->flat = b;-
363 updateGeometry();-
364 update();-
365}
never executed: end of block
0
366void QGroupBox::setCheckable(bool checkable)-
367{-
368 QGroupBoxPrivate * const d = d_func();-
369-
370 bool wasCheckable = d->checkable;-
371 d->checkable = checkable;-
372-
373 if (checkable
checkableDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
374 setChecked(true);-
375 if (!wasCheckable
!wasCheckableDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
376 setFocusPolicy(Qt::StrongFocus);-
377 d->_q_setChildrenEnabled(true);-
378 updateGeometry();-
379 }
never executed: end of block
0
380 }
never executed: end of block
else {
0
381 if (wasCheckable
wasCheckableDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
382 setFocusPolicy(Qt::NoFocus);-
383 d->_q_setChildrenEnabled(true);-
384 updateGeometry();-
385 }
never executed: end of block
0
386 d->_q_setChildrenEnabled(true);-
387 }
never executed: end of block
0
388-
389 if (wasCheckable != checkable
wasCheckable != checkableDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
390 d->calculateFrame();-
391 update();-
392 }
never executed: end of block
0
393}
never executed: end of block
0
394-
395bool QGroupBox::isCheckable() const-
396{-
397 const QGroupBoxPrivate * const d = d_func();-
398 return
never executed: return d->checkable;
d->checkable;
never executed: return d->checkable;
0
399}-
400-
401-
402bool QGroupBox::isChecked() const-
403{-
404 const QGroupBoxPrivate * const d = d_func();-
405 return
never executed: return d->checkable && d->checked;
d->checkable
d->checkableDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->checked
d->checkedDescription
TRUEnever evaluated
FALSEnever evaluated
;
never executed: return d->checkable && d->checked;
0
406}-
407void QGroupBox::setChecked(bool b)-
408{-
409 QGroupBoxPrivate * const d = d_func();-
410 if (d->checkable
d->checkableDescription
TRUEnever evaluated
FALSEnever evaluated
&& b != d->checked
b != d->checkedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
411 update();-
412 d->checked = b;-
413 d->_q_setChildrenEnabled(b);-
414-
415 QAccessible::State st;-
416 st.checked = true;-
417 QAccessibleStateChangeEvent e(this, st);-
418 QAccessible::updateAccessibility(&e);-
419-
420 toggled(b);-
421 }
never executed: end of block
0
422}
never executed: end of block
0
423-
424-
425-
426-
427-
428void QGroupBoxPrivate::_q_setChildrenEnabled(bool b)-
429{-
430 QGroupBox * const q = q_func();-
431 QObjectList childList = q->children();-
432 for (int i = 0; i < childList.size()
i < childList.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
433 QObject *o = childList.at(i);-
434 if (o->isWidgetType()
o->isWidgetType()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
435 QWidget *w = static_cast<QWidget *>(o);-
436 if (b
bDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
437 if (!w->testAttribute(Qt::WA_ForceDisabled)
!w->testAttrib...ForceDisabled)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
438 w->setEnabled(true);
never executed: w->setEnabled(true);
0
439 }
never executed: end of block
else {
0
440 if (w->isEnabled()
w->isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
441 w->setEnabled(false);-
442 w->setAttribute(Qt::WA_ForceDisabled, false);-
443 }
never executed: end of block
0
444 }
never executed: end of block
0
445 }-
446 }
never executed: end of block
0
447}
never executed: end of block
0
448-
449-
450void QGroupBox::changeEvent(QEvent *ev)-
451{-
452 QGroupBoxPrivate * const d = d_func();-
453 if (ev->type() == QEvent::EnabledChange
ev->type() == ...:EnabledChangeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
454 if (d->checkable
d->checkableDescription
TRUEnever evaluated
FALSEnever evaluated
&& isEnabled()
isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
455-
456 if (!d->checked
!d->checkedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
457 d->_q_setChildrenEnabled(false);
never executed: d->_q_setChildrenEnabled(false);
0
458 }
never executed: end of block
0
459 }
never executed: end of block
else if (ev->type() == QEvent::FontChange
ev->type() == ...nt::FontChangeDescription
TRUEnever evaluated
FALSEnever evaluated
0
460-
461-
462-
463 || ev->type() == QEvent::StyleChange
ev->type() == ...t::StyleChangeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
464 d->calculateFrame();-
465 }
never executed: end of block
0
466 QWidget::changeEvent(ev);-
467}
never executed: end of block
0
468-
469-
470void QGroupBox::mousePressEvent(QMouseEvent *event)-
471{-
472 if (event->button() != Qt::LeftButton
event->button(...Qt::LeftButtonDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
473 event->ignore();-
474 return;
never executed: return;
0
475 }-
476-
477 QGroupBoxPrivate * const d = d_func();-
478 QStyleOptionGroupBox box;-
479 initStyleOption(&box);-
480 d->pressedControl = style()->hitTestComplexControl(QStyle::CC_GroupBox, &box,-
481 event->pos(), this);-
482 if (d->checkable
d->checkableDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(d->pressedCon...roupBoxLabel))Description
TRUEnever evaluated
FALSEnever evaluated
d->pressedControl & (QStyle::SC_GroupBoxCheckBox | QStyle::SC_GroupBoxLabel))
(d->pressedCon...roupBoxLabel))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
483 d->overCheckBox = true;-
484 update(style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxCheckBox, this));-
485 }
never executed: end of block
0
486}
never executed: end of block
0
487-
488-
489void QGroupBox::mouseMoveEvent(QMouseEvent *event)-
490{-
491 QGroupBoxPrivate * const d = d_func();-
492 QStyleOptionGroupBox box;-
493 initStyleOption(&box);-
494 QStyle::SubControl pressed = style()->hitTestComplexControl(QStyle::CC_GroupBox, &box,-
495 event->pos(), this);-
496 bool oldOverCheckBox = d->overCheckBox;-
497 d->overCheckBox = (pressed == QStyle::SC_GroupBoxCheckBox
pressed == QSt...oupBoxCheckBoxDescription
TRUEnever evaluated
FALSEnever evaluated
|| pressed == QStyle::SC_GroupBoxLabel
pressed == QSt..._GroupBoxLabelDescription
TRUEnever evaluated
FALSEnever evaluated
);
0
498 if (d->checkable
d->checkableDescription
TRUEnever evaluated
FALSEnever evaluated
&& (d->pressedControl == QStyle::SC_GroupBoxCheckBox
d->pressedCont...oupBoxCheckBoxDescription
TRUEnever evaluated
FALSEnever evaluated
|| d->pressedControl == QStyle::SC_GroupBoxLabel
d->pressedCont..._GroupBoxLabelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
499 && (
(d->overCheckB...dOverCheckBox)Description
TRUEnever evaluated
FALSEnever evaluated
d->overCheckBox != oldOverCheckBox)
(d->overCheckB...dOverCheckBox)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
500 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
501}
never executed: end of block
0
502-
503-
504void QGroupBox::mouseReleaseEvent(QMouseEvent *event)-
505{-
506 if (event->button() != Qt::LeftButton
event->button(...Qt::LeftButtonDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
507 event->ignore();-
508 return;
never executed: return;
0
509 }-
510-
511 QGroupBoxPrivate * const d = d_func();-
512 if (!d->overCheckBox
!d->overCheckBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
513 event->ignore();-
514 return;
never executed: return;
0
515 }-
516 QStyleOptionGroupBox box;-
517 initStyleOption(&box);-
518 QStyle::SubControl released = style()->hitTestComplexControl(QStyle::CC_GroupBox, &box,-
519 event->pos(), this);-
520 bool toggle = d->checkable
d->checkableDescription
TRUEnever evaluated
FALSEnever evaluated
&& (released == QStyle::SC_GroupBoxLabel
released == QS..._GroupBoxLabelDescription
TRUEnever evaluated
FALSEnever evaluated
0
521 || released == QStyle::SC_GroupBoxCheckBox
released == QS...oupBoxCheckBoxDescription
TRUEnever evaluated
FALSEnever evaluated
);
0
522 d->pressedControl = QStyle::SC_None;-
523 d->overCheckBox = false;-
524 if (toggle
toggleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
525 d->click();
never executed: d->click();
0
526 else if (d->checkable
d->checkableDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
527 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
528}
never executed: end of block
0
529-
530-
531-
532-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9