Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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
21QT_BEGIN_NAMESPACE
22
23class QQuickLayoutItemProxyAttachedData;
26{
27 Q_OBJECT
28
29 Q_PROPERTY(QQuickItem *target READ target WRITE setTarget NOTIFY targetChanged)
32
33public:
36
37 void geometryChange(const QRectF &newGeom, const QRectF &oldGeom) override;
38 void itemChange(ItemChange c, const ItemChangeData &d) override;
39
40 QQuickItem *target() const;
41 void setTarget(QQuickItem *newTarget);
42 Q_INVOKABLE QQuickItem *effectiveTarget() const;
43 void clearTarget();
44
45 void maybeTakeControl();
46public slots:
47 void updatePos();
48
49private slots:
50 // We define some slots to react to changes to the Layout attached properties.
51 // They are all named following the same scheme, which allows us to use a macro.
52#define propertyForwarding(Property)
53 void target##Property##Changed();
54 void proxy##Property##Changed();
55
56 propertyForwarding(MinimumWidth)
57 propertyForwarding(MinimumHeight)
58 propertyForwarding(PreferredWidth)
59 propertyForwarding(PreferredHeight)
60 propertyForwarding(MaximumWidth)
61 propertyForwarding(MaximumHeight)
62 propertyForwarding(FillWidth)
63 propertyForwarding(FillHeight)
64 propertyForwarding(Alignment)
65 propertyForwarding(HorizontalStretchFactor)
66 propertyForwarding(VerticalStretchFactor)
67 propertyForwarding(Margins)
68 propertyForwarding(LeftMargin)
69 propertyForwarding(TopMargin)
70 propertyForwarding(RightMargin)
71 propertyForwarding(BottomMargin)
72#undef propertyForwarding
73
75 void targetChanged();
76
77private:
79};
80
82{
83 Q_DECLARE_PUBLIC(QQuickLayoutItemProxy)
84
85public:
87
88 // the target of the LayoutItem
89 QQuickItem *target = nullptr;
90
91 // These values are required to know why the Layout property of the proxy changed
92 // If it changed because the target changed we should keep the connection valid
93 // If a Layout property change is not invoked by the target, it was set
94 // explicitly by the application developer and we should disconnect the connection
95 // between target and proxy for this property.
112
114};
115
146
148
150
151#endif // QQUICKLAYOUTITEMPROXY_P_H
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 proxyHasControl() const
QQuickLayoutItemProxyAttachedData::proxyHasControl.
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...
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...
QQuickItem * target() const
\qmlproperty Item LayoutItemProxy::target
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.
#define connectPropertyForwarding(property, Property)
#define propertyForwarding(property, Property)
QT_END_NAMESPACE Q_DECLARE_METATYPE(QQuickLayoutItemProxyAttachedData *)