Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qquickgroupbox.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qquickgroupbox_p.h"
5#include "qquickframe_p_p.h"
7
8#include <QtGui/qpa/qplatformtheme.h>
9
11
16
55{
56 Q_DECLARE_PUBLIC(QQuickGroupBox)
57
58public:
59 void cancelLabel();
60 void executeLabel(bool complete = false);
61
64
66
69};
70
71static inline QString labelName() { return QStringLiteral("label"); }
72
74{
75 Q_Q(QQuickGroupBox);
77}
78
80{
81 Q_Q(QQuickGroupBox);
82 if (label.wasExecuted())
83 return;
84
85 if (!label || complete)
87 if (complete)
89}
90
92{
93 Q_Q(QQuickGroupBox);
95 if (item == label)
96 emit q->implicitLabelWidthChanged();
97}
98
100{
101 Q_Q(QQuickGroupBox);
103 if (item == label)
104 emit q->implicitLabelHeightChanged();
105}
106
109{
110}
111
113{
114 Q_D(QQuickGroupBox);
115 d->removeImplicitSizeListener(d->label);
116}
117
127{
128 Q_D(const QQuickGroupBox);
129 return d->title;
130}
131
133{
134 Q_D(QQuickGroupBox);
135 if (d->title == title)
136 return;
137
138 d->title = title;
141}
142
151{
152 QQuickGroupBoxPrivate *d = const_cast<QQuickGroupBoxPrivate *>(d_func());
153 if (!d->label)
154 d->executeLabel();
155 return d->label;
156}
157
159{
160 Q_D(QQuickGroupBox);
161 if (d->label == label)
162 return;
163
165
166 if (!d->label.isExecuting())
167 d->cancelLabel();
168
169 const qreal oldImplicitLabelWidth = implicitLabelWidth();
170 const qreal oldImplicitLabelHeight = implicitLabelHeight();
171
172 d->removeImplicitSizeListener(d->label);
174 d->label = label;
175
176 if (label) {
177 if (!label->parentItem())
178 label->setParentItem(this);
179 d->addImplicitSizeListener(label);
180 }
181
182 if (!qFuzzyCompare(oldImplicitLabelWidth, implicitLabelWidth()))
183 emit implicitLabelWidthChanged();
184 if (!qFuzzyCompare(oldImplicitLabelHeight, implicitLabelHeight()))
185 emit implicitLabelHeightChanged();
186 if (!d->label.isExecuting())
188}
189
202{
203 Q_D(const QQuickGroupBox);
204 if (!d->label)
205 return 0;
206 return d->label->implicitWidth();
207}
208
221{
222 Q_D(const QQuickGroupBox);
223 if (!d->label)
224 return 0;
225 return d->label->implicitHeight();
226}
227
229{
230 Q_D(QQuickGroupBox);
231 d->executeLabel(true);
233}
234
236{
238}
239
240#if QT_CONFIG(accessibility)
241QAccessible::Role QQuickGroupBox::accessibleRole() const
242{
243 return QAccessible::Grouping;
244}
245
246void QQuickGroupBox::accessibilityActiveChanged(bool active)
247{
248 Q_D(QQuickGroupBox);
249 QQuickFrame::accessibilityActiveChanged(active);
250
251 if (active)
253}
254#endif
255
257
258#include "moc_qquickgroupbox_p.cpp"
\reentrant
Definition qfont.h:20
The QPalette class contains color groups for each widget state.
Definition qpalette.h:19
virtual void componentComplete()=0
Invoked after the root component that caused this instantiation has completed construction.
static void hideOldItem(QQuickItem *item)
static void warnIfCustomizationNotSupported(QObject *control, QQuickItem *item, const QString &propertyName)
void maybeSetAccessibleName(const QString &name)
Visual frame and title for a logical group of controls.
void executeLabel(bool complete=false)
void itemImplicitWidthChanged(QQuickItem *item) override
void itemImplicitHeightChanged(QQuickItem *item) override
QQuickDeferredPointer< QQuickItem > label
QPalette defaultPalette() const override
void titleChanged()
void labelChanged()
void setLabel(QQuickItem *label)
QQuickGroupBox(QQuickItem *parent=nullptr)
QFont defaultFont() const override
void setTitle(const QString &title)
QQuickItem * label
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
virtual void itemImplicitWidthChanged(QQuickItem *)
virtual void itemImplicitHeightChanged(QQuickItem *)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:64
void setParentItem(QQuickItem *parent)
static QPalette palette(Scope scope)
static QFont font(Scope scope)
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
Combined button and popup list for selecting options.
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
Definition qfloat16.h:287
GLuint GLsizei const GLchar * label
[43]
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
void quickCancelDeferred(QObject *object, const QString &property)
void quickCompleteDeferred(QObject *object, const QString &property, QQuickDeferredPointer< T > &delegate)
void quickBeginDeferred(QObject *object, const QString &property, QQuickDeferredPointer< T > &delegate)
static QString labelName()
#define QStringLiteral(str)
#define emit
double qreal
Definition qtypes.h:92
QString title
[35]
QGraphicsItem * item
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent