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
qquickanchors_p_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 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 QQUICKANCHORS_P_P_H
5#define QQUICKANCHORS_P_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 "qquickanchors_p.h"
20#include <private/qobject_p.h>
21
23
24class Q_QUICK_EXPORT QQuickAnchorLine
25{
29public:
33 : item(i)
34 , anchorLine(static_cast<QQuickAnchors::Anchor>(l))
35 { Q_ASSERT(l < ((QQuickAnchors::BaselineAnchor << 1) - 1)); }
36
37 QQuickItem *item = nullptr;
39};
40
41inline bool operator==(const QQuickAnchorLine& a, const QQuickAnchorLine& b)
42{
43 return a.item == b.item && a.anchorLine == b.anchorLine;
44}
45
47{
48 Q_DECLARE_PUBLIC(QQuickAnchors)
49public:
91
92 void clearItem(QQuickItem *);
93
95 void addDepend(QQuickItem *);
96 void remDepend(QQuickItem *);
97 bool isItemComplete() const;
98
99 void setItemHeight(qreal);
100 void setItemWidth(qreal);
101 void setItemX(qreal);
102 void setItemY(qreal);
103 void setItemPos(const QPointF &);
104 void setItemSize(const QSizeF &);
105
106 void update();
107 void updateOnComplete();
108 void updateMe();
109
110 // QQuickItemGeometryListener interface
112 QQuickAnchorsPrivate *anchorPrivate() override { return this; }
113
114 bool checkHValid() const;
115 bool checkVValid() const;
116 bool checkHAnchorValid(QQuickAnchorLine anchor) const;
117 bool checkVAnchorValid(QQuickAnchorLine anchor) const;
118 bool calcStretch(QQuickItem *edge1Item, QQuickAnchors::Anchor edge1Line,
119 QQuickItem *edge2Item, QQuickAnchors::Anchor edge2Line,
120 qreal offset1, qreal offset2, QQuickAnchors::Anchor line, qreal &stretch) const;
121
122 bool isMirrored() const;
125 void fillChanged();
126 void centerInChanged();
127
136
138
141
149
150 // The bit fields below are carefully laid out in chunks of 1 byte, so the compiler doesn't
151 // need to generate 2 loads (and combining shifts/ors) to create a single field.
152
161
168 uint usedAnchors : 7; // QQuickAnchors::Anchors
170
171 // Instead of using a mostly empty bit field, we can stretch the following fields up to be full
172 // bytes. The advantage is that incrementing/decrementing does not need any combining ands/ors.
177
178
180 return static_cast<QQuickAnchorsPrivate *>(QObjectPrivate::get(o));
181 }
182};
183
185
187
188#endif
static QObjectPrivate * get(QObject *o)
Definition qobject_p.h:150
\inmodule QtCore\reentrant
Definition qpoint.h:217
QQuickAnchorLine(QQuickItem *i, QQuickAnchors::Anchor l)
QQuickAnchorLine(QQuickItem *i, uint l)
bool checkHAnchorValid(QQuickAnchorLine anchor) const
QQuickAnchors::Anchor baselineAnchorLine
QQuickAnchors::Anchor vCenterAnchorLine
QQuickAnchors::Anchor rightAnchorLine
QQuickAnchors::Anchor hCenterAnchorLine
bool isItemComplete() const
QQuickAnchors::Anchor bottomAnchorLine
void remDepend(QQuickItem *)
QQuickAnchors::Anchor leftAnchorLine
QQuickGeometryChange calculateDependency(QQuickItem *) const
QQuickAnchorsPrivate(QQuickItem *i)
bool checkVAnchorValid(QQuickAnchorLine anchor) const
void addDepend(QQuickItem *)
void setItemSize(const QSizeF &)
void clearItem(QQuickItem *)
static QQuickAnchorsPrivate * get(QQuickAnchors *o)
void itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &) override
bool isMirrored() const
QQuickItem * baselineAnchorItem
QQuickAnchorsPrivate * anchorPrivate() override
bool calcStretch(QQuickItem *edge1Item, QQuickAnchors::Anchor edge1Line, QQuickItem *edge2Item, QQuickAnchors::Anchor edge2Line, qreal offset1, qreal offset2, QQuickAnchors::Anchor line, qreal &stretch) const
QQuickAnchors::Anchor topAnchorLine
void setItemPos(const QPointF &)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
\inmodule QtCore\reentrant
Definition qrect.h:484
\inmodule QtCore
Definition qsize.h:208
Combined button and popup list for selecting options.
#define Q_DECLARE_METATYPE(TYPE)
Definition qmetatype.h:1525
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
[7]
#define QML_ANONYMOUS
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
bool operator==(const QQuickAnchorLine &a, const QQuickAnchorLine &b)
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define Q_GADGET
unsigned int uint
Definition qtypes.h:34
QT_BEGIN_NAMESPACE typedef signed char qint8
Definition qtypes.h:45
double qreal
Definition qtypes.h:187
QObject::connect nullptr
QGraphicsItem * item