11#if QT_CONFIG(radiobutton)
17#if QT_CONFIG(accessibility)
20#include <private/qwidget_p.h>
21#include <private/qguiapplication_p.h>
22#include <qpa/qplatformtheme.h>
25#include <QtCore/qpointer.h>
71 option->textAlignment = Qt::Alignment(
d->align);
72 option->activeSubControls |=
d->pressedControl;
92 if (!
d->title.isEmpty())
100 QPointer<QGroupBox> guard(
q);
176#ifndef QT_NO_SHORTCUT
196#ifndef QT_NO_SHORTCUT
204#if QT_CONFIG(accessibility)
205 QAccessibleEvent
event(
this, QAccessible::NameChanged);
206 QAccessible::updateAccessibility(&
event);
289#ifndef QT_NO_SHORTCUT
292 if (se->shortcutId() ==
d->shortcutId) {
311 bool oldHover =
d->hover;
313 if (oldHover !=
d->hover) {
332 .value<QList<Qt::Key>>();
344 .value<QList<Qt::Key>>();
369 if (!(
c->added() ||
c->polished()) || !
c->child()->isWidgetType())
379 if (
w->isEnabled()) {
380 w->setEnabled(
false);
399 if (!fw || fw ==
q) {
403 while ((
w =
w->nextInFocusChain()) !=
q) {
405#if QT_CONFIG(radiobutton)
406 if (!best && qobject_cast<QRadioButton*>(
w) && ((
QRadioButton*)
w)->isChecked())
433 q->initStyleOption(&
box);
435 q->setContentsMargins(contentsRect.
left() -
box.rect.left(), contentsRect.
top() -
box.rect.top(),
436 box.rect.right() - contentsRect.
right(),
box.rect.bottom() - contentsRect.
bottom());
446 d->_q_fixFocus(fe->reason());
464 int baseWidth =
metrics.horizontalAdvance(
d->title) +
metrics.horizontalAdvance(u
' ');
465 int baseHeight =
metrics.height();
530 bool wasCheckable =
d->checkable;
537 d->_q_setChildrenEnabled(
true);
543 d->_q_setChildrenEnabled(
true);
546 d->_q_setChildrenEnabled(
true);
565 return d->checkable &&
d->checked;
609 if (
d->checkable &&
b !=
d->checked) {
612 d->_q_setChildrenEnabled(
b);
613#if QT_CONFIG(accessibility)
616 QAccessibleStateChangeEvent e(
this, st);
617 QAccessible::updateAccessibility(&e);
631 if (
o->isWidgetType()) {
637 if (
w->isEnabled()) {
638 w->setEnabled(
false);
654 d->_q_setChildrenEnabled(
false);
678 event->position().toPoint(),
this);
680 d->overCheckBox =
true;
694 event->position().toPoint(),
this);
695 bool oldOverCheckBox =
d->overCheckBox;
698 && (
d->overCheckBox != oldOverCheckBox))
713 if (!
d->overCheckBox) {
720 event->position().toPoint(),
this);
724 d->overCheckBox =
false;
727 else if (
d->checkable)
733#include "moc_qgroupbox.cpp"
The QColor class provides colors based on RGB, HSV or CMYK values.
Type type() const
Returns the event type.
The QFocusEvent class contains event parameters for widget focus events.
\reentrant \inmodule QtGui
QStyle::SubControl pressedControl
void _q_setChildrenEnabled(bool b)
void _q_fixFocus(Qt::FocusReason reason)
The QGroupBox widget provides a group box frame with a title.
void paintEvent(QPaintEvent *event) override
\reimp
QString title
the group box title text
virtual void initStyleOption(QStyleOptionGroupBox *option) const
Initialize option with the values from this QGroupBox.
void mouseReleaseEvent(QMouseEvent *event) override
\reimp
QGroupBox(QWidget *parent=nullptr)
Constructs a group box widget with the given parent but with no title.
void mousePressEvent(QMouseEvent *event) override
\reimp
void resizeEvent(QResizeEvent *event) override
\reimp
void toggled(bool)
If the group box is checkable, this signal is emitted when the check box is toggled.
bool event(QEvent *event) override
\reimp
void childEvent(QChildEvent *event) override
\reimp
bool checkable
whether the group box has a checkbox in its title
void mouseMoveEvent(QMouseEvent *event) override
\reimp
void setChecked(bool checked)
void setCheckable(bool checkable)
void changeEvent(QEvent *event) override
\reimp
void setAlignment(int alignment)
Qt::Alignment alignment
the alignment of the group box title.
~QGroupBox()
Destroys the group box.
void focusInEvent(QFocusEvent *event) override
\reimp
QSize minimumSizeHint() const override
\reimp
void setTitle(const QString &title)
static QPlatformTheme * platformTheme()
The QKeyEvent class describes a key event.
bool isAutoRepeat() const
Returns true if this event comes from an auto-repeating key; returns false if it comes from an initia...
int key() const
Returns the code of the key that was pressed or released.
static QKeySequence mnemonic(const QString &text)
Returns the shortcut key sequence for the mnemonic in text, or an empty key sequence if no mnemonics ...
The QPaintEvent class contains event parameters for paint events.
\inmodule QtCore\reentrant
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
The QResizeEvent class contains event parameters for resize events.
The QShortcutEvent class provides an event which is generated when the user presses a key combination...
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
\macro QT_RESTRICTED_CAST_FROM_ASCII
\variable QStyleOptionFrame::features
The QStylePainter class is a convenience class for drawing QStyle elements inside a widget.
virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget=nullptr) const =0
Returns the rectangle containing the specified subControl of the given complex control (with the styl...
virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w=nullptr) const =0
Returns the size of the element described by the specified option and type, based on the provided con...
@ SH_GroupBox_TextLabelColor
virtual SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *widget=nullptr) const =0
Returns the sub control at the given position in the given complex control (with the style options sp...
@ PM_CheckBoxLabelSpacing
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
Returns the value of the given pixel metric.
SubControl
This enum describes the available sub controls.
Combined button and popup list for selecting options.
constexpr const T & qMax(const T &a, const T &b)
GLboolean GLboolean GLboolean b
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLsizei GLenum const void GLuint GLsizei GLfloat * metrics
GLsizei const GLint * box
GLdouble GLdouble GLdouble GLdouble q
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)