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
qquicklayoutitemproxy_p.h
Go to the documentation of this file.
1// Copyright (C) 2023 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 QQUICKLAYOUTITEMPROXY_P_H
5#define QQUICKLAYOUTITEMPROXY_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 <private/qquickitem_p.h>
19#include <private/qquickrectangle_p.h>
20
24{
26
27 Q_PROPERTY(QQuickItem *target READ target WRITE setTarget NOTIFY targetChanged)
28 QML_NAMED_ELEMENT(LayoutItemProxy)
30
31public:
33 ~QQuickLayoutItemProxy() override;
34
35 void geometryChange(const QRectF &newGeom, const QRectF &oldGeom) override;
36 void itemChange(ItemChange c, const ItemChangeData &d) override;
37
39 void setTarget(QQuickItem *newTarget);
41 void clearTarget();
42
43 void maybeTakeControl();
44public slots:
45 void updatePos();
46
48 // We define some slots to react to changes to the Layout attached properties.
49 // They are all named following the same scheme, which allows us to use a macro.
50#define propertyForwarding(Property) \
51 void target##Property##Changed(); \
52 void proxy##Property##Changed();
53
54 propertyForwarding(MinimumWidth)
55 propertyForwarding(MinimumHeight)
56 propertyForwarding(PreferredWidth)
57 propertyForwarding(PreferredHeight)
58 propertyForwarding(MaximumWidth)
59 propertyForwarding(MaximumHeight)
60 propertyForwarding(FillWidth)
61 propertyForwarding(FillHeight)
62 propertyForwarding(Alignment)
63 propertyForwarding(HorizontalStretchFactor)
64 propertyForwarding(VerticalStretchFactor)
65 propertyForwarding(Margins)
66 propertyForwarding(LeftMargin)
67 propertyForwarding(TopMargin)
68 propertyForwarding(RightMargin)
69 propertyForwarding(BottomMargin)
70#undef propertyForwarding
71
73 void targetChanged();
74
75private:
76 Q_DECLARE_PRIVATE(QQuickLayoutItemProxy)
77};
78
80{
81 Q_DECLARE_PUBLIC(QQuickLayoutItemProxy)
82
83public:
85
86 // the target of the LayoutItem
87 QQuickItem *target = nullptr;
88
89 // These values are required to know why the Layout property of the proxy changed
90 // If it changed because the target changed we should keep the connection valid
91 // If a Layout property change is not invoked by the target, it was set
92 // explicitly by the application developer and we should disconnect the connection
93 // between target and proxy for this property.
110
112};
113
144
146
147#endif // QQUICKLAYOUTITEMPROXY_P_H
Definition qlist.h:75
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
Definition qqmllist.h:24
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
qreal y const
Definition qquickitem.h:347
QQuickItem * parent
\qmlproperty Item QtQuick::Item::parent This property holds the visual parent of the item.
Definition qquickitem.h:67
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
Definition qquickitem.h:144
Provides attached properties for items that are managed by one or more LayoutItemProxy.
QQmlListProperty< QQuickLayoutItemProxy > getProxies()
QQuickLayoutItemProxyAttachedData::getProxies.
void registerProxy(QQuickLayoutItemProxy *proxy)
QQuickLayoutItemProxyAttachedData::registerProxy registers a proxy that manages the item this data is...
void releaseControl(QQuickLayoutItemProxy *proxy)
QQuickLayoutItemProxyAttachedData::releaseControl is called by LayoutItemProxies when they try no lon...
bool takeControl(QQuickLayoutItemProxy *proxy)
QQuickLayoutItemProxyAttachedData::takeControl is called by LayoutItemProxies when they try to take c...
void releaseProxy(QQuickLayoutItemProxy *proxy)
QQuickLayoutItemProxyAttachedData::releaseProxy removes a proxy from a list of known proxies that man...
QQmlListProperty< QQuickLayoutItemProxy > proxies
QQuickLayoutItemProxy * getControllingProxy() const
QQuickLayoutItemProxyAttachedData::getControllingProxy.
void clearTarget()
QQuickLayoutItemProxy::clearTarget sets the target to null.
void setTarget(QQuickItem *newTarget)
QQuickLayoutItemProxy::setTarget sets the target.
void geometryChange(const QRectF &newGeom, const QRectF &oldGeom) override
QQuickLayoutItemProxy::geometryChange Reimplementation of QQuickItem::geometryChange to update the ta...
void itemChange(ItemChange c, const ItemChangeData &d) override
QQuickLayoutItemProxy::itemChange is a reimplementation of QQuickItem::itemChange to react to changes...
void maybeTakeControl()
QQuickLayoutItemProxy::maybeTakeControl checks and takes over control of the item.
void updatePos()
QQuickLayoutItemProxy::updatePos sets the geometry of the target to the geometry of the proxy.
Q_INVOKABLE QQuickItem * effectiveTarget() const
QQuickLayoutItemProxy::effectiveTarget.
\inmodule QtCore\reentrant
Definition qrect.h:484
#define Q_DECLARE_METATYPE(TYPE)
Definition qmetatype.h:1525
GLenum target
const GLubyte * c
#define QML_ANONYMOUS
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define propertyForwarding(Property)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_INVOKABLE
#define slots
#define signals
QNetworkProxy proxy
[0]
\inmodule QtQuick
Definition qquickitem.h:159