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