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 2.1
0009 import org.kde.kirigami 2.12 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{.qml}
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  * @since KDE Frameworks 5.69
0042  * @since org.kde.kirigami 2.12
0043  * @inherit QtQuick.Item
0044  */
0045 Item {
0046 
0047 //BEGIN properties
0048     /**
0049      * @brief This property holds the color that will be underneath the image.
0050      *
0051      * This will be visible if the image has transparancy.
0052      *
0053      * @see kirigami::ShadowedRectangle::radius
0054      * @property color color
0055      */
0056     property alias color: shadowRectangle.color
0057 
0058     /**
0059      * @brief This propery holds the corner radius of the image.
0060      * @see kirigami::ShadowedRectangle::radius
0061      * @property real radius
0062      */
0063     property alias radius: shadowRectangle.radius
0064 
0065     /**
0066      * @brief This property holds shadow's properties group.
0067      * @see kirigami::ShadowedRectangle::shadow
0068      * @property kirigami::ShadowedRectangle::ShadowGroup shadow
0069      */
0070     property alias shadow: shadowRectangle.shadow
0071 
0072     /**
0073      * @brief This propery holds the border's properties of the image.
0074      * @see kirigami::ShadowedRectangle::border
0075      * @property kirigami::ShadowedRectangle::BorderGroup border
0076      */
0077     property alias border: shadowRectangle.border
0078 
0079     /**
0080      * @brief This propery holds the corner radius properties of the image.
0081      * @see kirigami::ShadowedRectangle::corners
0082      * @property kirigami::ShadowedRectangle::CornersGroup corners
0083      */
0084     property alias corners: shadowRectangle.corners
0085 
0086     /**
0087      * @brief This propery holds the source of the image.
0088      * @brief QtQuick.Image.source
0089      */
0090     property alias source: image.source
0091 
0092     /**
0093      * @brief This property sets whether this image should be loaded asynchronously.
0094      *
0095      * Set this to @c false if you want the main thread to load the image, which
0096      * blocks it until the image is loaded. Setting this to @c true loads the
0097      * image in a separate thread which is useful when maintaining a responsive
0098      * user interface is more desirable than having images immediately visible.
0099      *
0100      * @see QtQuick.Image.asynchronous
0101      * @property bool asynchronous
0102      */
0103     property alias asynchronous: image.asynchronous
0104 
0105     /**
0106      * @brief This property defines what happens when the source image has a different
0107      * size than the item.
0108      * @see QtQuick.Image.fillMode
0109      * @property int fillMode
0110      */
0111     property alias fillMode: image.fillMode
0112 
0113     /**
0114      * @brief This property holds the scaled width and height of the full-frame image.
0115      * @see QtQuick.Image.sourceSize
0116      */
0117     property alias sourceSize: image.sourceSize
0118 //END properties
0119 
0120     Image {
0121         id: image
0122         anchors.fill: parent
0123         visible: shadowRectangle.softwareRendering
0124     }
0125 
0126     Kirigami.ShadowedTexture {
0127         id: shadowRectangle
0128         anchors.fill: parent
0129 
0130         source: image.status === Image.Ready ? image : null
0131     }
0132 }