102 switch (anchorLine) {
139 d->inDestructor =
true;
140 d->remDepend(
d->fill);
141 d->remDepend(
d->centerIn);
142 d->remDepend(
d->leftAnchorItem);
143 d->remDepend(
d->rightAnchorItem);
144 d->remDepend(
d->topAnchorItem);
145 d->remDepend(
d->bottomAnchorItem);
146 d->remDepend(
d->vCenterAnchorItem);
147 d->remDepend(
d->hCenterAnchorItem);
148 d->remDepend(
d->baselineAnchorItem);
173 qmlWarning(
item) << QQuickAnchors::tr(
"Possible anchor loop detected on fill.");
202 qmlWarning(
item) << QQuickAnchors::tr(
"Possible anchor loop detected on centerIn.");
251 if (
fill == controlItem) {
316 return d->centerAligned;
327 d->centerInChanged();
330 d->updateVerticalAnchors();
332 d->updateHorizontalAnchors();
344 d->componentComplete =
false;
350 d->componentComplete =
true;
409 dependencies[0] =
fill;
419 std::sort(dependencies, dependencies + 9);
422 for (
int i = 0;
i < 9; ++
i) {
424 if (lastDependency != dependency) {
426 lastDependency = dependency;
483 d->remDepend(oldFill);
488 qmlWarning(
d->item) <<
tr(
"Cannot anchor to an item that isn't a parent or sibling.");
493 d->remDepend(oldFill);
494 d->addDepend(
d->fill);
513 if (
d->centerIn ==
c)
524 qmlWarning(
d->item) <<
tr(
"Cannot anchor to an item that isn't a parent or sibling.");
530 d->addDepend(
d->centerIn);
532 d->centerInChanged();
547 qreal &stretch)
const
554 bool invalid =
false;
555 if ((edge2IsParent && edge1IsParent) || (edge2IsSibling && edge1IsSibling)) {
556 stretch = (
position(edge2Item, edge2Line) + offset2)
557 - (
position(edge1Item, edge1Line) + offset1);
558 }
else if (edge2IsParent && edge1IsSibling) {
559 stretch = (
position(edge2Item, edge2Line) + offset2)
561 +
position(edge1Item, edge1Line) + offset1);
562 }
else if (edge2IsSibling && edge1IsParent) {
564 - (
position(edge1Item, edge1Line) + offset1);
578 qmlWarning(
item) << QQuickAnchors::tr(
"Possible anchor loop detected on vertical anchor.");
666 qreal effectiveRightMargin, effectiveLeftMargin, effectiveHorizontalCenterOffset;
667 QQuickItem *effectiveLeftItem, *effectiveRightItem, *effectiveHorizontalCenterItem;
701 invalid =
calcStretch(effectiveLeftItem, effectiveLeftLine,
702 effectiveRightItem, effectiveRightLine,
703 effectiveLeftMargin, -effectiveRightMargin,
706 invalid =
calcStretch(effectiveLeftItem, effectiveLeftLine,
707 effectiveHorizontalCenterItem, effectiveHorizontalCenterLine,
708 effectiveLeftMargin, effectiveHorizontalCenterOffset,
719 setItemX(
position(effectiveLeftItem, effectiveLeftLine) + effectiveLeftMargin);
725 bool invalid =
calcStretch(effectiveHorizontalCenterItem,
726 effectiveHorizontalCenterLine,
727 effectiveRightItem, effectiveRightLine,
728 effectiveHorizontalCenterOffset, -effectiveRightMargin,
747 setItemX(
position(effectiveHorizontalCenterItem, effectiveHorizontalCenterLine) -
hcenter(
item) + effectiveHorizontalCenterOffset);
753 qmlWarning(
item) << QQuickAnchors::tr(
"Possible anchor loop detected on horizontal anchor.");
766 if (!
d->checkVAnchorValid(edge) ||
772 if (!
d->checkVValid()) {
773 d->usedAnchors &= ~TopAnchor;
778 d->topAnchorItem = edge.
item;
780 d->remDepend(oldTop);
781 d->addDepend(
d->topAnchorItem);
783 d->updateVerticalAnchors();
789 d->usedAnchors &= ~TopAnchor;
790 d->remDepend(
d->topAnchorItem);
791 d->topAnchorItem =
nullptr;
794 d->updateVerticalAnchors();
806 if (!
d->checkVAnchorValid(edge) ||
807 (
d->bottomAnchorItem == edge.
item &&
d->bottomAnchorLine == edge.
anchorLine))
812 if (!
d->checkVValid()) {
813 d->usedAnchors &= ~BottomAnchor;
818 d->bottomAnchorItem = edge.
item;
820 d->remDepend(oldBottom);
821 d->addDepend(
d->bottomAnchorItem);
823 d->updateVerticalAnchors();
829 d->usedAnchors &= ~BottomAnchor;
830 d->remDepend(
d->bottomAnchorItem);
831 d->bottomAnchorItem =
nullptr;
834 d->updateVerticalAnchors();
846 if (!
d->checkVAnchorValid(edge) ||
847 (
d->vCenterAnchorItem == edge.
item &&
d->vCenterAnchorLine == edge.
anchorLine))
852 if (!
d->checkVValid()) {
853 d->usedAnchors &= ~VCenterAnchor;
858 d->vCenterAnchorItem = edge.
item;
860 d->remDepend(oldVCenter);
861 d->addDepend(
d->vCenterAnchorItem);
863 d->updateVerticalAnchors();
869 d->usedAnchors &= ~VCenterAnchor;
870 d->remDepend(
d->vCenterAnchorItem);
871 d->vCenterAnchorItem =
nullptr;
874 d->updateVerticalAnchors();
886 if (!
d->checkVAnchorValid(edge) ||
887 (
d->baselineAnchorItem == edge.
item &&
d->baselineAnchorLine == edge.
anchorLine))
892 if (!
d->checkVValid()) {
893 d->usedAnchors &= ~BaselineAnchor;
898 d->baselineAnchorItem = edge.
item;
900 d->remDepend(oldBaseline);
901 d->addDepend(
d->baselineAnchorItem);
903 d->updateVerticalAnchors();
909 d->usedAnchors &= ~BaselineAnchor;
910 d->remDepend(
d->baselineAnchorItem);
911 d->baselineAnchorItem =
nullptr;
914 d->updateVerticalAnchors();
926 if (!
d->checkHAnchorValid(edge) ||
932 if (!
d->checkHValid()) {
933 d->usedAnchors &= ~LeftAnchor;
938 d->leftAnchorItem = edge.
item;
940 d->remDepend(oldLeft);
941 d->addDepend(
d->leftAnchorItem);
943 d->updateHorizontalAnchors();
949 d->usedAnchors &= ~LeftAnchor;
950 d->remDepend(
d->leftAnchorItem);
951 d->leftAnchorItem =
nullptr;
954 d->updateHorizontalAnchors();
966 if (!
d->checkHAnchorValid(edge) ||
972 if (!
d->checkHValid()) {
973 d->usedAnchors &= ~RightAnchor;
978 d->rightAnchorItem = edge.
item;
980 d->remDepend(oldRight);
981 d->addDepend(
d->rightAnchorItem);
983 d->updateHorizontalAnchors();
989 d->usedAnchors &= ~RightAnchor;
990 d->remDepend(
d->rightAnchorItem);
991 d->rightAnchorItem =
nullptr;
994 d->updateHorizontalAnchors();
1006 if (!
d->checkHAnchorValid(edge) ||
1007 (
d->hCenterAnchorItem == edge.
item &&
d->hCenterAnchorLine == edge.
anchorLine))
1012 if (!
d->checkHValid()) {
1013 d->usedAnchors &= ~HCenterAnchor;
1018 d->hCenterAnchorItem = edge.
item;
1020 d->remDepend(oldHCenter);
1021 d->addDepend(
d->hCenterAnchorItem);
1023 d->updateHorizontalAnchors();
1029 d->usedAnchors &= ~HCenterAnchor;
1030 d->remDepend(
d->hCenterAnchorItem);
1031 d->hCenterAnchorItem =
nullptr;
1034 d->updateHorizontalAnchors();
1040 return d->leftMargin;
1046 d->leftMarginExplicit =
true;
1053 d->updateHorizontalAnchors();
1060 d->leftMarginExplicit =
false;
1061 if (
d->leftMargin ==
d->margins)
1063 d->leftMargin =
d->margins;
1067 d->updateHorizontalAnchors();
1074 return d->rightMargin;
1080 d->rightMarginExplicit =
true;
1087 d->updateHorizontalAnchors();
1094 d->rightMarginExplicit =
false;
1095 if (
d->rightMargin ==
d->margins)
1097 d->rightMargin =
d->margins;
1101 d->updateHorizontalAnchors();
1118 bool updateHorizontal =
false;
1119 bool updateVertical =
false;
1121 if (!
d->rightMarginExplicit &&
d->rightMargin !=
offset) {
1123 updateHorizontal =
true;
1126 if (!
d->leftMarginExplicit &&
d->leftMargin !=
offset) {
1128 updateHorizontal =
true;
1131 if (!
d->topMarginExplicit &&
d->topMargin !=
offset) {
1133 updateVertical =
true;
1136 if (!
d->bottomMarginExplicit &&
d->bottomMargin !=
offset) {
1138 updateVertical =
true;
1143 if (updateHorizontal || updateVertical)
1146 if (updateHorizontal)
1147 d->updateHorizontalAnchors();
1149 d->updateVerticalAnchors();
1158 return d->hCenterOffset;
1164 if (
d->hCenterOffset ==
offset)
1168 d->centerInChanged();
1170 d->updateHorizontalAnchors();
1177 return d->topMargin;
1183 d->topMarginExplicit =
true;
1190 d->updateVerticalAnchors();
1197 d->topMarginExplicit =
false;
1198 if (
d->topMargin ==
d->margins)
1200 d->topMargin =
d->margins;
1204 d->updateVerticalAnchors();
1211 return d->bottomMargin;
1217 d->bottomMarginExplicit =
true;
1218 if (
d->bottomMargin ==
offset)
1224 d->updateVerticalAnchors();
1231 d->bottomMarginExplicit =
false;
1232 if (
d->bottomMargin ==
d->margins)
1234 d->bottomMargin =
d->margins;
1238 d->updateVerticalAnchors();
1245 return d->vCenterOffset;
1251 if (
d->vCenterOffset ==
offset)
1255 d->centerInChanged();
1257 d->updateVerticalAnchors();
1264 return d->baselineOffset;
1270 if (
d->baselineOffset ==
offset)
1273 d->updateVerticalAnchors();
1280 return static_cast<QQuickAnchors::Anchors
>(
d->usedAnchors);
1286 if (
d->fill ||
d->centerIn)
1301 qmlWarning(
item) << QQuickAnchors::tr(
"Cannot specify left, right, and horizontalCenter anchors at the same time.");
1311 qmlWarning(
item) << QQuickAnchors::tr(
"Cannot anchor to a null item.");
1314 qmlWarning(
item) << QQuickAnchors::tr(
"Cannot anchor a horizontal edge to a vertical edge.");
1318 qmlWarning(
item) << QQuickAnchors::tr(
"Cannot anchor to an item that isn't a parent or sibling.");
1321 qmlWarning(
item) << QQuickAnchors::tr(
"Cannot anchor item to self.");
1333 qmlWarning(
item) << QQuickAnchors::tr(
"Cannot specify top, bottom, and verticalCenter anchors at the same time.");
1339 qmlWarning(
item) << QQuickAnchors::tr(
"Baseline anchor cannot be used in conjunction with top, bottom, or verticalCenter anchors.");
1349 qmlWarning(
item) << QQuickAnchors::tr(
"Cannot anchor to a null item.");
1352 qmlWarning(
item) << QQuickAnchors::tr(
"Cannot anchor a vertical edge to a horizontal edge.");
1356 qmlWarning(
item) << QQuickAnchors::tr(
"Cannot anchor to an item that isn't a parent or sibling.");
1359 qmlWarning(
item) << QQuickAnchors::tr(
"Cannot anchor item to self.");
1368#include "moc_qquickanchors_p_p.cpp"
1370#include <moc_qquickanchors_p.cpp>
\inmodule QtCore\reentrant
QQuickAnchors::Anchor anchorLine
qint8 updatingVerticalAnchor
bool checkHAnchorValid(QQuickAnchorLine anchor) const
QQuickAnchors::Anchor baselineAnchorLine
QQuickAnchors::Anchor vCenterAnchorLine
QQuickAnchors::Anchor rightAnchorLine
QQuickItem * hCenterAnchorItem
QQuickAnchors::Anchor hCenterAnchorLine
bool isItemComplete() const
QQuickAnchors::Anchor bottomAnchorLine
void remDepend(QQuickItem *)
QQuickAnchors::Anchor leftAnchorLine
QQuickItem * rightAnchorItem
QQuickGeometryChange calculateDependency(QQuickItem *) const
void updateHorizontalAnchors()
void setItemHeight(qreal)
QQuickItem * topAnchorItem
qint8 updatingHorizontalAnchor
QQuickItem * bottomAnchorItem
bool checkVAnchorValid(QQuickAnchorLine anchor) const
void addDepend(QQuickItem *)
QQuickItem * vCenterAnchorItem
void setItemSize(const QSizeF &)
void clearItem(QQuickItem *)
static QQuickAnchorsPrivate * get(QQuickAnchors *o)
void itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &) override
QQuickItem * baselineAnchorItem
void updateVerticalAnchors()
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
QQuickItem * leftAnchorItem
void setItemPos(const QPointF &)
~QQuickAnchors() override
qreal verticalCenterOffset
void setLeftMargin(qreal)
void resetVerticalCenter()
void horizontalCenterChanged()
void setHorizontalCenterOffset(qreal)
void bottomMarginChanged()
void centerAlignedChanged()
void setVerticalCenterOffset(qreal)
void rightMarginChanged()
void verticalCenterOffsetChanged()
void setBottom(const QQuickAnchorLine &edge)
void setCenterIn(QQuickItem *)
void setTop(const QQuickAnchorLine &edge)
void setVerticalCenter(const QQuickAnchorLine &edge)
void setHorizontalCenter(const QQuickAnchorLine &edge)
void setBaselineOffset(qreal)
void setRightMargin(qreal)
void horizontalCenterOffsetChanged()
void baselineOffsetChanged()
void setBaseline(const QQuickAnchorLine &edge)
void setAlignWhenCentered(bool)
void setFill(QQuickItem *)
QQuickAnchors(QQuickItem *item, QObject *parent=nullptr)
qreal horizontalCenterOffset
void verticalCenterChanged()
QQuickAnchorLine horizontalCenter
Anchors usedAnchors() const
void setBottomMargin(qreal)
void setRight(const QQuickAnchorLine &edge)
QQuickAnchorLine baseline
Qt::Orientations activeDirections() const
QQuickAnchorLine verticalCenter
void resetHorizontalCenter()
void setLeft(const QQuickAnchorLine &edge)
bool horizontalChange() const
void setSizeChange(bool enabled)
void setAllChanged(bool enabled)
void setVerticalChange(bool enabled)
void setWidthChange(bool enabled)
void setHeightChange(bool enabled)
bool verticalChange() const
void setHorizontalChange(bool enabled)
quint32 effectiveLayoutMirror
static QQuickItemPrivate * get(QQuickItem *item)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
void setSize(const QSizeF &size)
qreal x
\qmlproperty real QtQuick::Item::x \qmlproperty real QtQuick::Item::y \qmlproperty real QtQuick::Item...
qreal y
Defines the item's y position relative to its parent.
void setPosition(const QPointF &)
\inmodule QtCore\reentrant
Combined button and popup list for selecting options.
int qRound(qfloat16 d) noexcept
GLsizei const GLfloat * v
[13]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr offset
GLdouble GLdouble GLdouble GLdouble q
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
static Q_ALWAYS_INLINE qreal readWidth(const QQuickItem *item)
static qreal hcenter(const QQuickItem *item)
static qreal vcenter(const QQuickItem *item)
static QQuickAnchors::Anchor reverseAnchorLine(QQuickAnchors::Anchor anchorLine)
static qreal adjustedPosition(QQuickItem *item, QQuickAnchors::Anchor anchorLine)
static QT_BEGIN_NAMESPACE Q_ALWAYS_INLINE QQuickItem * readParentItem(const QQuickItem *item)
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
static Q_ALWAYS_INLINE qreal readHeight(const QQuickItem *item)
static Q_ALWAYS_INLINE qreal readX(const QQuickItem *item)
static Q_ALWAYS_INLINE qreal readBaselineOffset(const QQuickItem *item)
static Q_ALWAYS_INLINE qreal readY(const QQuickItem *item)
QQuickAnchors * anchors(QQuickItem *item)
Int aligned(Int v, Int byteAlign)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent