7#include <private/qquickstate_p_p.h>
9#include <QtQml/qqmlinfo.h>
10#include <QtCore/qmath.h>
28 std::unique_ptr<StateSnapshot>
orig;
29 std::unique_ptr<StateSnapshot>
rewind;
49 qmlWarning(
q) << QQuickParentChange::tr(
"Unable to preserve appearance under complex transform");
56 if (
ok && !isRotate) {
60 qmlWarning(
q) << QQuickParentChange::tr(
"Unable to preserve appearance under non-uniform scale");
63 }
else if (
ok && isRotate) {
67 qmlWarning(
q) << QQuickParentChange::tr(
"Unable to preserve appearance under non-uniform scale");
74 qmlWarning(
q) << QQuickParentChange::tr(
"Unable to preserve appearance under scale of 0");
84 target->setParentItem(targetParent);
90 t.translate(-tempxt, -tempyt);
93 t.translate(tempxt, tempyt);
106 target->setParentItem(targetParent);
159 return d->xString.value;
171 return d->xString.isValid();
177 return d->yString.value;
189 return d->yString.isValid();
195 return d->widthString.value;
207 return d->widthString.isValid();
213 return d->heightString.value;
225 return d->heightString.isValid();
231 return d->scaleString.value;
243 return d->scaleString.isValid();
249 return d->rotationString.value;
261 return d->rotationString.isValid();
267 return d->orig ?
d->orig->parent :
nullptr;
305 if (!
d->target || !
d->parent)
314 if (
d->xString.isValid()) {
316 qreal x =
d->xString.value.numberLiteral(&
ok);
332 if (
d->yString.isValid()) {
334 qreal y =
d->yString.value.numberLiteral(&
ok);
350 if (
d->scaleString.isValid()) {
368 if (
d->rotationString.isValid()) {
379 ra.toBinding = newBinding;
380 ra.fromValue =
ra.property.read();
381 ra.deletableToBinding =
true;
386 if (
d->widthString.isValid()) {
404 if (
d->heightString.isValid()) {
431 *
d->orig = *
d->rewind;
437 d->doChange(
d->parent);
453 target->setSize(
QSizeF(snapshot->width, snapshot->height));
455 target->setScale(snapshot->scale);
456 target->setRotation(snapshot->rotation);
457 target->setParentItem(snapshot->parent);
458 if (snapshot->stackBefore)
459 target->stackBefore(snapshot->stackBefore);
466 d->reverseRewindHelper(
d->orig);
480 return (
d->target == otherPC->object());
493 d->rewind->x =
d->target->x();
494 d->rewind->y =
d->target->y();
495 d->rewind->scale =
d->target->scale();
496 d->rewind->width =
d->target->width();
497 d->rewind->height =
d->target->height();
498 d->rewind->rotation =
d->target->rotation();
500 d->rewind->parent =
d->target->parentItem();
501 d->rewind->stackBefore =
nullptr;
503 if (!
d->rewind->parent)
518 d->reverseRewindHelper(
d->rewind);
605 return d->bottomScript;
612 d->bottomScript = edge;
627 return d->vCenterScript;
634 d->vCenterScript = edge;
649 return d->baselineScript;
656 d->baselineScript = edge;
671 return d->leftScript;
678 d->leftScript = edge;
693 return d->rightScript;
700 d->rightScript = edge;
715 return d->hCenterScript;
722 d->hCenterScript = edge;
817 d->leftBinding =
d->rightBinding =
d->hCenterBinding =
d->topBinding
818 =
d->bottomBinding =
d->vCenterBinding =
d->baselineBinding =
nullptr;
830 d->leftBinding->setTarget(
d->leftProp);
834 d->rightBinding->setTarget(
d->rightProp);
838 d->hCenterBinding->setTarget(
d->hCenterProp);
842 d->topBinding->setTarget(
d->topProp);
846 d->bottomBinding->setTarget(
d->bottomProp);
850 d->vCenterBinding->setTarget(
d->vCenterProp);
854 d->baselineBinding->setTarget(
d->baselineProp);
914 if (
d->applyOrigLeft) {
915 if (!
d->origLeftBinding)
919 if (
d->applyOrigRight) {
920 if (!
d->origRightBinding)
924 if (
d->applyOrigHCenter) {
925 if (!
d->origHCenterBinding)
929 if (
d->applyOrigTop) {
930 if (!
d->origTopBinding)
934 if (
d->applyOrigBottom) {
935 if (!
d->origBottomBinding)
939 if (
d->applyOrigVCenter) {
940 if (!
d->origVCenterBinding)
944 if (
d->applyOrigBaseline) {
945 if (!
d->origBaselineBinding)
985 if (
d->hCenterBinding)
989 if (
d->bottomBinding)
991 if (
d->vCenterBinding)
993 if (
d->baselineBinding)
1010 if (
d->leftBinding) {
1014 if (
d->rightBinding) {
1018 if (
d->hCenterBinding) {
1022 if (
d->topBinding) {
1026 if (
d->bottomBinding) {
1030 if (
d->vCenterBinding) {
1034 if (
d->baselineBinding) {
1040 if (
d->origLeftBinding)
1042 if (
d->origRightBinding)
1044 if (
d->origHCenterBinding)
1046 if (
d->origTopBinding)
1048 if (
d->origBottomBinding)
1050 if (
d->origVCenterBinding)
1052 if (
d->origBaselineBinding)
1061 const QRectF oldGeometry(
d->target->position(),
d->target->size());
1062 bool stateSetWidth = (stateHAnchors &&
1069 bool origSetWidth = (origHAnchors &&
1073 if (
d->origWidth.isValid() && stateSetWidth && !origSetWidth && !
qt_is_nan(
d->origWidth)) {
1075 if (targetPrivate->width !=
d->origWidth)
1076 targetPrivate->width.setValueBypassingBindings(
d->origWidth);
1079 bool stateSetHeight = (stateVAnchors &&
1087 bool origSetHeight = (origVAnchors &&
1092 if (
d->origHeight.isValid() && stateSetHeight && !origSetHeight && !
qt_is_nan(
d->origHeight)) {
1094 if (targetPrivate->height !=
d->origHeight)
1095 targetPrivate->height.setValueBypassingBindings(
d->origHeight);
1098 if (stateHAnchors && !origHAnchors && !
qt_is_nan(
d->origX) &&
d->origX != targetPrivate->x)
1099 targetPrivate->x.setValueBypassingBindings(
d->origX);
1101 if (stateVAnchors && !origVAnchors && !
qt_is_nan(
d->origY) &&
d->origY != targetPrivate->y)
1102 targetPrivate->y.setValueBypassingBindings(
d->origY);
1104 const QRectF newGeometry(
d->target->position(),
d->target->size());
1105 if (newGeometry != oldGeometry) {
1109 if (newGeometry.
size() != oldGeometry.
size())
1111 targetPrivate->
dirty(dirtyFlags);
1112 d->target->geometryChange(newGeometry, oldGeometry);
1126 QQuickAnchors::Anchors combined =
d->anchorSet->d_func()->usedAnchors |
d->anchorSet->d_func()->resetAnchors;
1132 if (hChange &&
d->fromX !=
d->toX) {
1137 if (vChange &&
d->fromY !=
d->toY) {
1142 if (hChange &&
d->fromWidth !=
d->toWidth) {
1144 a.toValue =
d->toWidth;
1147 if (vChange &&
d->fromHeight !=
d->toHeight) {
1149 a.toValue =
d->toHeight;
1178 d->origWidth =
d->target->width();
1180 d->origHeight =
d->target->height();
1181 d->origX =
d->target->x();
1182 d->origY =
d->target->y();
1184 d->applyOrigLeft =
d->applyOrigRight =
d->applyOrigHCenter =
d->applyOrigTop
1185 =
d->applyOrigBottom =
d->applyOrigVCenter =
d->applyOrigBaseline =
false;
1248 d->fromX =
d->target->x();
1249 d->fromY =
d->target->y();
1250 d->fromWidth =
d->target->width();
1251 d->fromHeight =
d->target->height();
1257 QQuickAnchors::Anchors combined =
d->anchorSet->d_func()->resetAnchors |
1258 d->anchorSet->d_func()->usedAnchors;
1307 const QRectF oldGeometry(
d->target->position(),
d->target->size());
1311 if (!
qt_is_nan(
d->rewindX) &&
d->rewindX != targetPrivate->x)
1312 targetPrivate->x.setValueBypassingBindings(
d->rewindX);
1313 if (!
qt_is_nan(
d->rewindY) &&
d->rewindY != targetPrivate->y)
1314 targetPrivate->y.setValueBypassingBindings(
d->rewindY);
1318 if (
d->rewindWidth != targetPrivate->width)
1319 targetPrivate->width.setValueBypassingBindings(
d->rewindWidth);
1324 if (
d->rewindHeight != targetPrivate->height)
1325 targetPrivate->height.setValueBypassingBindings(
d->rewindHeight);
1328 const QRectF newGeometry(
d->target->position(),
d->target->size());
1329 if (newGeometry != oldGeometry) {
1331 d->target->geometryChange(newGeometry, oldGeometry);
1350 d->rewindX =
d->target->x();
1351 d->rewindY =
d->target->y();
1352 d->rewindWidth =
d->target->width();
1353 d->rewindHeight =
d->target->height();
1362 d->toX =
d->target->x();
1363 d->toY =
d->target->y();
1364 d->toWidth =
d->target->width();
1365 d->toHeight =
d->target->height();
1370#include <moc_qquickstateoperations_p.cpp>
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
const QObjectList & children() const
Returns a list of child objects.
\inmodule QtCore\reentrant
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
static QQmlAnyBinding createFromScriptString(const QQmlProperty &prop, const QQmlScriptString &script, QObject *obj, QQmlContext *ctxt)
static QQmlBinding * create(const QQmlPropertyData *, const QQmlScriptString &, QObject *, QQmlContext *)
static void setBinding(QQmlAbstractBinding *binding, BindingFlags flags=None, QQmlPropertyData::WriteFlags writeFlags=QQmlPropertyData::DontRemoveBinding)
static void removeBinding(const QQmlProperty &that)
static QQmlPropertyPrivate * get(const QQmlProperty &p)
static QQmlAbstractBinding * binding(QObject *, QQmlPropertyIndex index)
The QQmlProperty class abstracts accessing properties on objects created from QML.
QVariant read() const
Returns the property value.
The QQmlScriptString class encapsulates a script and its context.
bool isUndefinedLiteral() const
Returns whether the content of the QQmlScriptString is the undefined literal.
QQmlBinding::Ptr baselineBinding
QQmlAbstractBinding::Ptr origLeftBinding
QQuickAnchorChangesPrivate()
QQmlBinding::Ptr leftBinding
QQmlAbstractBinding::Ptr origBottomBinding
QQuickAnchorLine rewindTop
QQmlAbstractBinding::Ptr origTopBinding
QQuickAnchorSet * anchorSet
QQmlBinding::Ptr bottomBinding
QQmlNullableValue< qreal > origWidth
QQuickAnchorLine rewindLeft
QQmlAbstractBinding::Ptr origHCenterBinding
QQmlBinding::Ptr vCenterBinding
QQmlNullableValue< qreal > origHeight
~QQuickAnchorChangesPrivate()
QQuickAnchorLine rewindBaseline
QQmlProperty baselineProp
QQuickAnchorLine rewindHCenter
QQuickAnchorLine rewindBottom
QQmlBinding::Ptr hCenterBinding
QQmlAbstractBinding::Ptr origRightBinding
QQuickAnchorLine rewindVCenter
QQmlBinding::Ptr rightBinding
QQuickAnchorLine rewindRight
QQmlAbstractBinding::Ptr origVCenterBinding
QQmlBinding::Ptr topBinding
QQmlAbstractBinding::Ptr origBaselineBinding
QQuickAnchorChanges(QObject *parent=nullptr)
void saveCurrentValues() override
void setObject(QQuickItem *)
bool changesBindings() override
QList< QQuickStateAction > additionalActions() const
void saveOriginals() override
void copyOriginals(QQuickStateActionEvent *) override
ActionList actions() override
void execute() override
\qmlpropertygroup QtQuick::AnchorChanges::anchors \qmlproperty AnchorLine QtQuick::AnchorChanges::anc...
void clearBindings() override
bool isReversable() override
EventType type() const override
QQuickItem * object() const
\qmlproperty Item QtQuick::AnchorChanges::target This property holds the \l Item for which the anchor...
bool mayOverride(QQuickStateActionEvent *other) override
void saveTargetValues() override
QQuickAnchorSet * anchors
QQuickAnchors::Anchors usedAnchors
QQuickAnchors::Anchors resetAnchors
QQmlScriptString rightScript
QQmlScriptString leftScript
QQmlScriptString topScript
QQmlScriptString bottomScript
QQmlScriptString vCenterScript
QQmlScriptString baselineScript
QQmlScriptString hCenterScript
QQmlScriptString baseline
QQuickAnchors::Anchors usedAnchors() const
QQuickAnchorSet(QObject *parent=nullptr)
QQmlScriptString verticalCenter
QQmlScriptString horizontalCenter
virtual ~QQuickAnchorSet()
void setBottom(const QQmlScriptString &edge)
void setLeft(const QQmlScriptString &edge)
void setTop(const QQmlScriptString &edge)
void resetVerticalCenter()
void resetHorizontalCenter()
void setHorizontalCenter(const QQmlScriptString &edge)
void setVerticalCenter(const QQmlScriptString &edge)
void setBaseline(const QQmlScriptString &edge)
void setRight(const QQmlScriptString &edge)
void resetVerticalCenter()
QQuickAnchorLine horizontalCenter
Anchors usedAnchors() const
QQuickAnchorLine baseline
QQuickAnchorLine verticalCenter
void resetHorizontalCenter()
QQuickAnchors * anchors() const
\qmlpropertygroup QtQuick::Item::anchors \qmlproperty AnchorLine QtQuick::Item::anchors....
static QQuickItemPrivate * get(QQuickItem *item)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
QQuickItem * parentItem() const
QQmlNullableValue< QQmlScriptString > xString
QQmlNullableValue< QQmlScriptString > rotationString
void reverseRewindHelper(const std::unique_ptr< StateSnapshot > &snapshot)
QQmlNullableValue< QQmlScriptString > scaleString
void doChange(QQuickItem *targetParent)
std::unique_ptr< StateSnapshot > orig
QQmlNullableValue< QQmlScriptString > widthString
std::unique_ptr< StateSnapshot > rewind
QQmlNullableValue< QQmlScriptString > yString
QPointer< QQuickItem > parent
QQmlNullableValue< QQmlScriptString > heightString
void setObject(QQuickItem *)
void setRotation(const QQmlScriptString &rotation)
void saveCurrentValues() override
EventType type() const override
void saveOriginals() override
ActionList actions() override
void setX(const QQmlScriptString &x)
QQuickItem * object() const
\qmlproperty Item QtQuick::ParentChange::target This property holds the item to be reparented
void setY(const QQmlScriptString &y)
void setHeight(const QQmlScriptString &height)
QQmlScriptString rotation
bool mayOverride(QQuickStateActionEvent *other) override
QQuickParentChange(QObject *parent=nullptr)
\qmltype ParentChange \instantiates QQuickParentChange \inqmlmodule QtQuick
void setWidth(const QQmlScriptString &width)
bool rotationIsSet() const
void setScale(const QQmlScriptString &scale)
void setParent(QQuickItem *)
bool isReversable() override
QQuickItem * originalParent() const
QList< QQuickStateAction > ActionList
\inmodule QtCore\reentrant
constexpr QPointF topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr QSizeF size() const noexcept
Returns the size of the rectangle.
Combined button and popup list for selecting options.
qfloat16 qSqrt(qfloat16 f)
constexpr float qRadiansToDegrees(float radians)
static Q_DECL_CONST_FUNCTION bool qt_is_nan(double d)
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr offset
GLuint GLenum GLenum transform
GLdouble GLdouble GLdouble GLdouble q
GLenum GLenum GLenum GLenum GLenum scale
QQmlContext * qmlContext(const QObject *obj)
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
QPointer< QQuickItem > stackBefore
QPointer< QQuickItem > parent
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent