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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKLAYOUTITEMPROXY_P_H
6#define QQUICKLAYOUTITEMPROXY_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <private/qquickitem_p.h>
20#include <private/qquickrectangle_p.h>
21
22QT_BEGIN_NAMESPACE
23
24class QQuickLayoutItemProxyAttachedData;
27{
28 Q_OBJECT
29
30 Q_PROPERTY(QQuickItem *target READ target WRITE setTarget NOTIFY targetChanged)
33
34public:
37
38 void geometryChange(const QRectF &newGeom, const QRectF &oldGeom) override;
39 void itemChange(ItemChange c, const ItemChangeData &d) override;
40
41 QQuickItem *target() const;
42 void setTarget(QQuickItem *newTarget);
43 Q_INVOKABLE QQuickItem *effectiveTarget() const;
44 void clearTarget();
45
46 void maybeTakeControl();
47public slots:
48 void updatePos();
49
50private slots:
51 // We define some slots to react to changes to the Layout attached properties.
52 // They are all named following the same scheme, which allows us to use a macro.
53#define propertyForwarding(Property)
54 void target##Property##Changed();
55 void proxy##Property##Changed();
56
57 propertyForwarding(MinimumWidth)
58 propertyForwarding(MinimumHeight)
59 propertyForwarding(PreferredWidth)
60 propertyForwarding(PreferredHeight)
61 propertyForwarding(MaximumWidth)
62 propertyForwarding(MaximumHeight)
63 propertyForwarding(FillWidth)
64 propertyForwarding(FillHeight)
65 propertyForwarding(Alignment)
66 propertyForwarding(HorizontalStretchFactor)
67 propertyForwarding(VerticalStretchFactor)
68 propertyForwarding(Margins)
69 propertyForwarding(LeftMargin)
70 propertyForwarding(TopMargin)
71 propertyForwarding(RightMargin)
72 propertyForwarding(BottomMargin)
73#undef propertyForwarding
74
76 void targetChanged();
77
78private:
80};
81
83{
84 Q_DECLARE_PUBLIC(QQuickLayoutItemProxy)
85
86public:
88
89 // the target of the LayoutItem
90 QQuickItem *target = nullptr;
91
92 // These values are required to know why the Layout property of the proxy changed
93 // If it changed because the target changed we should keep the connection valid
94 // If a Layout property change is not invoked by the target, it was set
95 // explicitly by the application developer and we should disconnect the connection
96 // between target and proxy for this property.
113
115};
116
147
149
151
152#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.
Combined button and popup list for selecting options.
#define connectPropertyForwarding(property, Property)
#define propertyForwarding(property, Property)
QT_END_NAMESPACE Q_DECLARE_METATYPE(QQuickLayoutItemProxyAttachedData *)