// Copyright (C) 2025 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qquicklayeritem_p.h" #include QT_BEGIN_NAMESPACE /*! \qmltype LayerItem \inqmlmodule QtQuick.VectorImage.Helpers \brief An Item that provides access to its transformation matrix as a property. The LayerItem type maintains a \c transformMatrix property, which at any time will contain the combination of the item's own transform with all its ancestors' transforms. It is used in particular to support linked transforms in certain vector graphics formats. As any type in the \c VectorImage.Helpers module, it is only intended to be used in code generated by \l VectorImage and related tools. */ QQuickLayerItem::QQuickLayerItem(QQuickItem *parent) : QQuickItem(parent) { } /*! \qmlproperty matrix4x4 QtQuick.VectorImage.Helpers::LayerItem::transformMatrix The result of combining this item's transform with the transforms of its entire ancestor chain. */ QMatrix4x4 QQuickLayerItem::transformMatrix() { Q_D(const QQuickItem); if (m_transformDirty) { m_transformDirty = false; QTransform xf; d->itemToParentTransform(&xf); m_transform = xf; } return m_transform; } void QQuickLayerItem::itemChange(ItemChange change, const ItemChangeData &value) { if (change == ItemTransformHasChanged) { m_transformDirty = true; emit transformMatrixChanged(); } QQuickItem::itemChange(change, value); } QT_END_NAMESPACE #include