Warning, /frameworks/kirigami/src/controls/ShadowedImage.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2020 Arjen Hiemstra <ahiemstra@heimr.nl> 0003 * SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 import QtQuick 0009 import org.kde.kirigami as Kirigami 0010 0011 /** 0012 * @brief An image with a shadow. 0013 * 0014 * This item will render a image, 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 * don't include the shadow. 0018 * 0019 * Example usage: 0020 * @code 0021 * import org.kde.kirigami 2.19 0022 * 0023 * ShadowedImage { 0024 * source: 'qrc:/myKoolGearPicture.png' 0025 * 0026 * radius: 20 0027 * 0028 * shadow.size: 20 0029 * shadow.xOffset: 5 0030 * shadow.yOffset: 5 0031 * 0032 * border.width: 2 0033 * border.color: Kirigami.Theme.textColor 0034 * 0035 * corners.topLeftRadius: 4 0036 * corners.topRightRadius: 5 0037 * corners.bottomLeftRadius: 2 0038 * corners.bottomRightRadius: 10 0039 * } 0040 * @endcode 0041 * 0042 * @since 5.69 0043 * @since 2.12 0044 * @inherit Item 0045 */ 0046 Item { 0047 id: root 0048 0049 //BEGIN properties 0050 /** 0051 * @brief This property holds the color that will be underneath the image. 0052 * 0053 * This will be visible if the image has transparancy. 0054 * 0055 * @see org::kde::kirigami::ShadowedRectangle::radius 0056 * @property color color 0057 */ 0058 property alias color: shadowRectangle.color 0059 0060 /** 0061 * @brief This propery holds the corner radius of the image. 0062 * @see org::kde::kirigami::ShadowedRectangle::radius 0063 * @property real radius 0064 */ 0065 property alias radius: shadowRectangle.radius 0066 0067 /** 0068 * @brief This property holds shadow's properties group. 0069 * @see org::kde::kirigami::ShadowedRectangle::shadow 0070 * @property org::kde::kirigami::ShadowedRectangle::ShadowGroup shadow 0071 */ 0072 property alias shadow: shadowRectangle.shadow 0073 0074 /** 0075 * @brief This propery holds the border's properties of the image. 0076 * @see org::kde::kirigami::ShadowedRectangle::border 0077 * @property org::kde::kirigami::ShadowedRectangle::BorderGroup border 0078 */ 0079 property alias border: shadowRectangle.border 0080 0081 /** 0082 * @brief This propery holds the corner radius properties of the image. 0083 * @see org::kde::kirigami::ShadowedRectangle::corners 0084 * @property org::kde::kirigami::ShadowedRectangle::CornersGroup corners 0085 */ 0086 property alias corners: shadowRectangle.corners 0087 0088 /** 0089 * @brief This propery holds the source of the image. 0090 * @brief QtQuick.Image::source 0091 */ 0092 property alias source: image.source 0093 0094 /** 0095 * @brief This property sets whether this image should be loaded asynchronously. 0096 * 0097 * Set this to false if you want the main thread to load the image, which 0098 * blocks it until the image is loaded. Setting this to true loads the 0099 * image in a separate thread which is useful when maintaining a responsive 0100 * user interface is more desirable than having images immediately visible. 0101 * 0102 * @see QtQuick.Image::asynchronous 0103 * @property bool asynchronous 0104 */ 0105 property alias asynchronous: image.asynchronous 0106 0107 /** 0108 * @brief This property defines what happens when the source image has a different 0109 * size than the item. 0110 * @see QtQuick.Image::fillMode 0111 * @property int fillMode 0112 */ 0113 property alias fillMode: image.fillMode 0114 0115 /** 0116 * @brief This property holds whether the image uses mipmap filtering when scaled 0117 * or transformed. 0118 * @see QtQuick.Image::mipmap 0119 * @property bool mipmap 0120 */ 0121 property alias mipmap: image.mipmap 0122 0123 /** 0124 * @brief This property holds the scaled width and height of the full-frame image. 0125 * @see QtQuick.Image::sourceSize 0126 */ 0127 property alias sourceSize: image.sourceSize 0128 //END properties 0129 0130 Image { 0131 id: image 0132 anchors.fill: parent 0133 } 0134 0135 ShaderEffectSource { 0136 id: textureSource 0137 sourceItem: image 0138 hideSource: !shadowRectangle.softwareRendering 0139 } 0140 0141 Kirigami.ShadowedTexture { 0142 id: shadowRectangle 0143 anchors.fill: parent 0144 source: (image.status === Image.Ready && !softwareRendering) ? textureSource : null 0145 } 0146 }