Kirigami2

ShadowedImage.qml
1 /*
2  * SPDX-FileCopyrightText: 2020 Arjen Hiemstra <[email protected]>
3  * SPDX-FileCopyrightText: 2022 Carl Schwan <[email protected]>
4  *
5  * SPDX-License-Identifier: LGPL-2.0-or-later
6  */
7 
8 import QtQuick 2.1
9 import org.kde.kirigami 2.12 as Kirigami
10 
11 /**
12  * @brief An image with a shadow.
13  *
14  * This item will render a image, 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  * don't include the shadow.
18  *
19  * Example usage:
20  * @code
21  * import org.kde.kirigami 2.19
22  *
23  * ShadowedImage {
24  * source: 'qrc:/myKoolGearPicture.png'
25  *
26  * radius: 20
27  *
28  * shadow.size: 20
29  * shadow.xOffset: 5
30  * shadow.yOffset: 5
31  *
32  * border.width: 2
33  * border.color: Kirigami.Theme.textColor
34  *
35  * corners.topLeftRadius: 4
36  * corners.topRightRadius: 5
37  * corners.bottomLeftRadius: 2
38  * corners.bottomRightRadius: 10
39  * }
40  * @endcode
41  *
42  * @since 5.69
43  * @since 2.12
44  * @inherit Item
45  */
46 Item {
47 
48 //BEGIN properties
49  /**
50  * @brief This property holds the color that will be underneath the image.
51  *
52  * This will be visible if the image has transparancy.
53  *
54  * @see org::kde::kirigami::ShadowedRectangle::radius
55  * @property color color
56  */
57  property alias color: shadowRectangle.color
58 
59  /**
60  * @brief This propery holds the corner radius of the image.
61  * @see org::kde::kirigami::ShadowedRectangle::radius
62  * @property real radius
63  */
64  property alias radius: shadowRectangle.radius
65 
66  /**
67  * @brief This property holds shadow's properties group.
68  * @see org::kde::kirigami::ShadowedRectangle::shadow
69  * @property org::kde::kirigami::ShadowedRectangle::ShadowGroup shadow
70  */
71  property alias shadow: shadowRectangle.shadow
72 
73  /**
74  * @brief This propery holds the border's properties of the image.
75  * @see org::kde::kirigami::ShadowedRectangle::border
76  * @property org::kde::kirigami::ShadowedRectangle::BorderGroup border
77  */
78  property alias border: shadowRectangle.border
79 
80  /**
81  * @brief This propery holds the corner radius properties of the image.
82  * @see org::kde::kirigami::ShadowedRectangle::corners
83  * @property org::kde::kirigami::ShadowedRectangle::CornersGroup corners
84  */
85  property alias corners: shadowRectangle.corners
86 
87  /**
88  * @brief This propery holds the source of the image.
89  * @brief QtQuick.Image::source
90  */
91  property alias source: image.source
92 
93  /**
94  * @brief This property sets whether this image should be loaded asynchronously.
95  *
96  * Set this to false if you want the main thread to load the image, which
97  * blocks it until the image is loaded. Setting this to true loads the
98  * image in a separate thread which is useful when maintaining a responsive
99  * user interface is more desirable than having images immediately visible.
100  *
101  * @see QtQuick.Image::asynchronous
102  * @property bool asynchronous
103  */
104  property alias asynchronous: image.asynchronous
105 
106  /**
107  * @brief This property defines what happens when the source image has a different
108  * size than the item.
109  * @see QtQuick.Image::fillMode
110  * @property int fillMode
111  */
112  property alias fillMode: image.fillMode
113 
114  /**
115  * @brief This property holds the scaled width and height of the full-frame image.
116  * @see QtQuick.Image::sourceSize
117  */
118  property alias sourceSize: image.sourceSize
119 //END properties
120 
121  Image {
122  id: image
123  anchors.fill: parent
124  visible: shadowRectangle.softwareRendering
125  }
126 
127  Kirigami.ShadowedTexture {
128  id: shadowRectangle
129  anchors.fill: parent
130 
131  source: image.status === Image.Ready ? image : null
132  }
133 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Jan 29 2023 04:11:03 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.