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 * A rectangle with a shadow, using a QQuickItem as texture.
13 *
14 * This item will render a source item, with a shadow below it. The rendering is done
15 * using distance fields, which provide greatly improved performance. The shadow is
16 * rendered outside of the item's bounds, so the item's width and height are the
17 * rectangle's width and height.
18 *
19 * @since 5.69 / 2.12
20 */
21class ShadowedTexture : public ShadowedRectangle
22{
23 Q_OBJECT
24 QML_ELEMENT
25
26 /**
27 * This property holds the source item that will get rendered with the
28 * shadow.
29 */
30 Q_PROPERTY(QQuickItem *source READ source WRITE setSource NOTIFY sourceChanged FINAL)
31
32public:
33 ShadowedTexture(QQuickItem *parent = nullptr);
34 ~ShadowedTexture() override;
35
36 QQuickItem *source() const;
37 void setSource(QQuickItem *newSource);
38 Q_SIGNAL void sourceChanged();
39
40protected:
41 QSGNode *updatePaintNode(QSGNode *node, QQuickItem::UpdatePaintNodeData *data) override;
42
43private:
44 QQuickItem *m_source = nullptr;
45 bool m_sourceChanged = false;
46};
47

source code of kirigami/src/shadowedtexture.h