Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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 void itemDestroyed(QQuickItem *item) override;
65
67
69 QQuickDeferredPointer<QQuickItem> label;
70};
71
72static inline QString labelName() { return QStringLiteral("label"); }
73
79
81{
82 Q_Q(QQuickGroupBox);
83 if (label.wasExecuted())
84 return;
85
86 if (!label || complete)
88 if (complete)
90}
91
99
107
109{
110 Q_Q(QQuickGroupBox);
112 if (item == label) {
113 label = nullptr;
114 emit q->labelChanged();
115 }
116}
117
122
124{
125 Q_D(QQuickGroupBox);
126 d->removeImplicitSizeListener(d->label);
127}
128
138{
139 Q_D(const QQuickGroupBox);
140 return d->title;
141}
142
144{
145 Q_D(QQuickGroupBox);
146 if (d->title == title)
147 return;
148
149 d->title = title;
152}
153
162{
163 QQuickGroupBoxPrivate *d = const_cast<QQuickGroupBoxPrivate *>(d_func());
164 if (!d->label)
165 d->executeLabel();
166 return d->label;
167}
168
170{
171 Q_D(QQuickGroupBox);
172 if (d->label == label)
173 return;
174
176
177 if (!d->label.isExecuting())
178 d->cancelLabel();
179
180 const qreal oldImplicitLabelWidth = implicitLabelWidth();
181 const qreal oldImplicitLabelHeight = implicitLabelHeight();
182
183 d->removeImplicitSizeListener(d->label);
185 d->label = label;
186
187 if (label) {
188 if (!label->parentItem())
189 label->setParentItem(this);
190 d->addImplicitSizeListener(label);
191 }
192
193 if (!qFuzzyCompare(oldImplicitLabelWidth, implicitLabelWidth()))
194 emit implicitLabelWidthChanged();
195 if (!qFuzzyCompare(oldImplicitLabelHeight, implicitLabelHeight()))
196 emit implicitLabelHeightChanged();
197 if (!d->label.isExecuting())
199}
200
213{
214 Q_D(const QQuickGroupBox);
215 if (!d->label)
216 return 0;
217 return d->label->implicitWidth();
218}
219
232{
233 Q_D(const QQuickGroupBox);
234 if (!d->label)
235 return 0;
236 return d->label->implicitHeight();
237}
238
240{
241 Q_D(QQuickGroupBox);
242 d->executeLabel(true);
244}
245
250
251#if QT_CONFIG(accessibility)
252QAccessible::Role QQuickGroupBox::accessibleRole() const
253{
254 return QAccessible::Grouping;
255}
256
257void QQuickGroupBox::accessibilityActiveChanged(bool active)
258{
259 Q_D(QQuickGroupBox);
260 QQuickFrame::accessibilityActiveChanged(active);
261
262 if (active)
264}
265#endif
266
268
269#include "moc_qquickgroupbox_p.cpp"
\reentrant
Definition qfont.h:22
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 itemDestroyed(QQuickItem *item) override
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 itemDestroyed(QQuickItem *)
virtual void itemImplicitHeightChanged(QQuickItem *)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
void setParentItem(QQuickItem *parent)
static QPalette palette(Scope scope)
static QFont font(Scope scope)
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
Definition qfloat16.h:333
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:187
QString title
[35]
QGraphicsItem * item