1/*
2 * SPDX-FileCopyrightText: 2020 Arjen Hiemstra <ahiemstra@heimr.nl>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#pragma once
8
9#include "shadowedrectangle.h"
10
11/*!
12 * \qmltype ShadowedTexture
13 * \inqmlmodule org.kde.kirigami.primitives
14 *
15 * \brief A rectangle with a shadow, using a Item as texture.
16 *
17 * This item will render a source item, with a shadow below it. The rendering is done
18 * using distance fields, which provide greatly improved performance. The shadow is
19 * rendered outside of the item's bounds, so the item's width and height are the
20 * rectangle's width and height.
21 *
22 * \inherits ShadowedRectangle
23 *
24 * \since 5.69
25 */
26class ShadowedTexture : public ShadowedRectangle
27{
28 Q_OBJECT
29 QML_ELEMENT
30
31 /*!
32 * \qmlproperty Item ShadowedTexture::source
33 *
34 * This property holds the source item that will get rendered with the
35 * shadow.
36 */
37 Q_PROPERTY(QQuickItem *source READ source WRITE setSource NOTIFY sourceChanged FINAL)
38
39public:
40 ShadowedTexture(QQuickItem *parent = nullptr);
41 ~ShadowedTexture() override;
42
43 QQuickItem *source() const;
44 void setSource(QQuickItem *newSource);
45 Q_SIGNAL void sourceChanged();
46
47protected:
48 QSGNode *updatePaintNode(QSGNode *node, QQuickItem::UpdatePaintNodeData *data) override;
49
50private:
51 QQuickItem *m_source = nullptr;
52 bool m_sourceChanged = false;
53};
54

source code of kirigami/src/primitives/shadowedtexture.h