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
qquickcontrol_p.h
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#ifndef QQUICKCONTROL_P_H
5#define QQUICKCONTROL_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/qlocale.h>
19#include <QtGui/qpalette.h>
20#include <QtQuick/qquickitem.h>
21#include <QtQuick/private/qquickpalette_p.h>
22#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
23
25
27
28class Q_QUICKTEMPLATES2_EXPORT QQuickControl : public QQuickItem
29{
31 Q_PROPERTY(QFont font READ font WRITE setFont RESET resetFont NOTIFY fontChanged FINAL)
32 Q_PROPERTY(qreal availableWidth READ availableWidth NOTIFY availableWidthChanged FINAL)
33 Q_PROPERTY(qreal availableHeight READ availableHeight NOTIFY availableHeightChanged FINAL)
34 Q_PROPERTY(qreal padding READ padding WRITE setPadding RESET resetPadding NOTIFY paddingChanged FINAL)
35 Q_PROPERTY(qreal topPadding READ topPadding WRITE setTopPadding RESET resetTopPadding NOTIFY topPaddingChanged FINAL)
36 Q_PROPERTY(qreal leftPadding READ leftPadding WRITE setLeftPadding RESET resetLeftPadding NOTIFY leftPaddingChanged FINAL)
37 Q_PROPERTY(qreal rightPadding READ rightPadding WRITE setRightPadding RESET resetRightPadding NOTIFY rightPaddingChanged FINAL)
38 Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged FINAL)
39 Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing RESET resetSpacing NOTIFY spacingChanged FINAL)
40 Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET resetLocale NOTIFY localeChanged FINAL)
41 Q_PROPERTY(bool mirrored READ isMirrored NOTIFY mirroredChanged FINAL)
42 QT6_ONLY(Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy NOTIFY focusPolicyChanged FINAL))
43 Q_PROPERTY(Qt::FocusReason focusReason READ focusReason WRITE setFocusReason NOTIFY focusReasonChanged FINAL)
44 Q_PROPERTY(bool visualFocus READ hasVisualFocus NOTIFY visualFocusChanged FINAL)
45 Q_PROPERTY(bool hovered READ isHovered NOTIFY hoveredChanged FINAL)
46 Q_PROPERTY(bool hoverEnabled READ isHoverEnabled WRITE setHoverEnabled RESET resetHoverEnabled NOTIFY hoverEnabledChanged FINAL)
47 Q_PROPERTY(bool wheelEnabled READ isWheelEnabled WRITE setWheelEnabled NOTIFY wheelEnabledChanged FINAL)
48 Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
49 Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem NOTIFY contentItemChanged FINAL)
50 Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset RESET resetBaselineOffset NOTIFY baselineOffsetChanged FINAL)
51 // 2.5 (Qt 5.12)
52 Q_PROPERTY(qreal horizontalPadding READ horizontalPadding WRITE setHorizontalPadding RESET resetHorizontalPadding NOTIFY horizontalPaddingChanged FINAL REVISION(2, 5))
53 Q_PROPERTY(qreal verticalPadding READ verticalPadding WRITE setVerticalPadding RESET resetVerticalPadding NOTIFY verticalPaddingChanged FINAL REVISION(2, 5))
54 Q_PROPERTY(qreal implicitContentWidth READ implicitContentWidth NOTIFY implicitContentWidthChanged FINAL REVISION(2, 5))
55 Q_PROPERTY(qreal implicitContentHeight READ implicitContentHeight NOTIFY implicitContentHeightChanged FINAL REVISION(2, 5))
56 Q_PROPERTY(qreal implicitBackgroundWidth READ implicitBackgroundWidth NOTIFY implicitBackgroundWidthChanged FINAL REVISION(2, 5))
57 Q_PROPERTY(qreal implicitBackgroundHeight READ implicitBackgroundHeight NOTIFY implicitBackgroundHeightChanged FINAL REVISION(2, 5))
58 Q_PROPERTY(qreal topInset READ topInset WRITE setTopInset RESET resetTopInset NOTIFY topInsetChanged FINAL REVISION(2, 5))
59 Q_PROPERTY(qreal leftInset READ leftInset WRITE setLeftInset RESET resetLeftInset NOTIFY leftInsetChanged FINAL REVISION(2, 5))
60 Q_PROPERTY(qreal rightInset READ rightInset WRITE setRightInset RESET resetRightInset NOTIFY rightInsetChanged FINAL REVISION(2, 5))
61 Q_PROPERTY(qreal bottomInset READ bottomInset WRITE setBottomInset RESET resetBottomInset NOTIFY bottomInsetChanged FINAL REVISION(2, 5))
62 Q_CLASSINFO("DeferredPropertyNames", "background,contentItem")
63 QML_NAMED_ELEMENT(Control)
65
66public:
67 explicit QQuickControl(QQuickItem *parent = nullptr);
69
70 QFont font() const;
71 void setFont(const QFont &font);
72 void resetFont();
73
74 qreal availableWidth() const;
75 qreal availableHeight() const;
76
77 qreal padding() const;
78 void setPadding(qreal padding);
79 void resetPadding();
80
81 qreal topPadding() const;
82 void setTopPadding(qreal padding);
83 void resetTopPadding();
84
85 qreal leftPadding() const;
86 void setLeftPadding(qreal padding);
87 void resetLeftPadding();
88
89 qreal rightPadding() const;
90 void setRightPadding(qreal padding);
91 void resetRightPadding();
92
93 qreal bottomPadding() const;
94 void setBottomPadding(qreal padding);
95 void resetBottomPadding();
96
97 qreal spacing() const;
98 void setSpacing(qreal spacing);
99 void resetSpacing();
100
101 QLocale locale() const;
102 void setLocale(const QLocale &locale);
103 void resetLocale();
104
105 bool isMirrored() const;
106
107 Qt::FocusReason focusReason() const;
108 void setFocusReason(Qt::FocusReason reason);
109
110 bool hasVisualFocus() const;
111
112 bool isHovered() const;
113 void setHovered(bool hovered);
114
115 bool isHoverEnabled() const;
116 void setHoverEnabled(bool enabled);
117 void resetHoverEnabled();
118
119 bool isWheelEnabled() const;
120 void setWheelEnabled(bool enabled);
121
122 QQuickItem *background() const;
123 void setBackground(QQuickItem *background);
124
125 QQuickItem *contentItem() const;
126 void setContentItem(QQuickItem *item);
127
128 qreal baselineOffset() const;
129 void setBaselineOffset(qreal offset);
130 void resetBaselineOffset();
131
132 // 2.5 (Qt 5.12)
133 qreal horizontalPadding() const;
134 void setHorizontalPadding(qreal padding);
135 void resetHorizontalPadding();
136
137 qreal verticalPadding() const;
138 void setVerticalPadding(qreal padding);
139 void resetVerticalPadding();
140
141 qreal implicitContentWidth() const;
142 qreal implicitContentHeight() const;
143
144 qreal implicitBackgroundWidth() const;
145 qreal implicitBackgroundHeight() const;
146
147 qreal topInset() const;
148 void setTopInset(qreal inset);
149 void resetTopInset();
150
151 qreal leftInset() const;
152 void setLeftInset(qreal inset);
153 void resetLeftInset();
154
155 qreal rightInset() const;
156 void setRightInset(qreal inset);
157 void resetRightInset();
158
159 qreal bottomInset() const;
160 void setBottomInset(qreal inset);
161 void resetBottomInset();
162
164 void fontChanged();
165 void availableWidthChanged();
166 void availableHeightChanged();
167 void paddingChanged();
168 void topPaddingChanged();
169 void leftPaddingChanged();
170 void rightPaddingChanged();
171 void bottomPaddingChanged();
173 void localeChanged();
174 void focusReasonChanged();
175 void mirroredChanged();
176 void visualFocusChanged();
177 void hoveredChanged();
178 void hoverEnabledChanged();
179 void wheelEnabledChanged();
180 void backgroundChanged();
181 void contentItemChanged();
182 void baselineOffsetChanged();
183 // 2.5 (Qt 5.12)
184 Q_REVISION(2, 5) void horizontalPaddingChanged();
185 Q_REVISION(2, 5) void verticalPaddingChanged();
186 Q_REVISION(2, 5) void implicitContentWidthChanged();
187 Q_REVISION(2, 5) void implicitContentHeightChanged();
188 Q_REVISION(2, 5) void implicitBackgroundWidthChanged();
189 Q_REVISION(2, 5) void implicitBackgroundHeightChanged();
190 Q_REVISION(2, 5) void topInsetChanged();
191 Q_REVISION(2, 5) void leftInsetChanged();
192 Q_REVISION(2, 5) void rightInsetChanged();
193 Q_REVISION(2, 5) void bottomInsetChanged();
194
195protected:
196 virtual QFont defaultFont() const;
197
199
200 void classBegin() override;
201 void componentComplete() override;
202
203 void itemChange(ItemChange change, const ItemChangeData &value) override;
204
205 void focusInEvent(QFocusEvent *event) override;
206 void focusOutEvent(QFocusEvent *event) override;
207#if QT_CONFIG(quicktemplates2_hover)
208 void hoverEnterEvent(QHoverEvent *event) override;
209 void hoverMoveEvent(QHoverEvent *event) override;
210 void hoverLeaveEvent(QHoverEvent *event) override;
211#endif
212 void mousePressEvent(QMouseEvent *event) override;
213 void mouseMoveEvent(QMouseEvent *event) override;
214 void mouseReleaseEvent(QMouseEvent *event) override;
215 void mouseUngrabEvent() override;
216#if QT_CONFIG(quicktemplates2_multitouch)
217 void touchEvent(QTouchEvent *event) override;
218 void touchUngrabEvent() override;
219#endif
220#if QT_CONFIG(wheelevent)
221 void wheelEvent(QWheelEvent *event) override;
222#endif
223
224 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
225
226 virtual void fontChange(const QFont &newFont, const QFont &oldFont);
227#if QT_CONFIG(quicktemplates2_hover)
228 virtual void hoverChange();
229#endif
230 virtual void mirrorChange();
231 virtual void spacingChange(qreal newSpacing, qreal oldSpacing);
232 virtual void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding);
233 virtual void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem);
234 virtual void localeChange(const QLocale &newLocale, const QLocale &oldLocale);
235 virtual void insetChange(const QMarginsF &newInset, const QMarginsF &oldInset);
236 virtual void enabledChange();
237
238#if QT_CONFIG(accessibility)
239 virtual QAccessible::Role accessibleRole() const;
240 virtual void accessibilityActiveChanged(bool active);
241#endif
242
243 // helper functions which avoid to check QT_CONFIG(accessibility)
244 QString accessibleName() const;
245 void maybeSetAccessibleName(const QString &name);
246
247 QVariant accessibleProperty(const char *propertyName);
248 bool setAccessibleProperty(const char *propertyName, const QVariant &value);
249
250private:
251 Q_DISABLE_COPY(QQuickControl)
252 Q_DECLARE_PRIVATE(QQuickControl)
253};
254
256
257#endif // QQUICKCONTROL_P_H
The QFocusEvent class contains event parameters for widget focus events.
Definition qevent.h:470
\reentrant
Definition qfont.h:22
\inmodule QtGui
Definition qevent.h:246
\inmodule QtCore
Definition qmargins.h:270
\inmodule QtGui
Definition qevent.h:196
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
Definition qquickitem.h:144
\inmodule QtCore\reentrant
Definition qrect.h:484
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QTouchEvent class contains parameters that describe a touch event.
Definition qevent.h:917
\inmodule QtCore
Definition qvariant.h:65
void spacingChanged()
qreal spacing
Combined button and popup list for selecting options.
Definition qcompare.h:63
class QT6_ONLY(Q_CORE_EXPORT) QChar
Definition qchar.h:44
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLenum GLuint GLintptr offset
GLuint name
struct _cl_event * event
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_REVISION(...)
#define Q_CLASSINFO(name, value)
#define Q_SIGNALS
double qreal
Definition qtypes.h:187
#define explicit
QGraphicsItem * item
\inmodule QtQuick
Definition qquickitem.h:159