File indexing completed on 2024-04-14 03:53:48
0001 /* 0002 * SPDX-FileCopyrightText: 2020 Arjen Hiemstra <ahiemstra@heimr.nl> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "shadowedrectangle.h" 0010 0011 /** 0012 * A rectangle with a shadow, using a QQuickItem as texture. 0013 * 0014 * This item will render a source item, with a shadow below it. The rendering is done 0015 * using distance fields, which provide greatly improved performance. The shadow is 0016 * rendered outside of the item's bounds, so the item's width and height are the 0017 * rectangle's width and height. 0018 * 0019 * @since 5.69 / 2.12 0020 */ 0021 class ShadowedTexture : public ShadowedRectangle 0022 { 0023 Q_OBJECT 0024 QML_ELEMENT 0025 0026 /** 0027 * This property holds the source item that will get rendered with the 0028 * shadow. 0029 */ 0030 Q_PROPERTY(QQuickItem *source READ source WRITE setSource NOTIFY sourceChanged FINAL) 0031 0032 public: 0033 ShadowedTexture(QQuickItem *parent = nullptr); 0034 ~ShadowedTexture() override; 0035 0036 QQuickItem *source() const; 0037 void setSource(QQuickItem *newSource); 0038 Q_SIGNAL void sourceChanged(); 0039 0040 protected: 0041 QSGNode *updatePaintNode(QSGNode *node, QQuickItem::UpdatePaintNodeData *data) override; 0042 0043 private: 0044 QQuickItem *m_source = nullptr; 0045 bool m_sourceChanged = false; 0046 };