Kirigami2

IconPropertiesGroup.qml
1/*
2 * SPDX-FileCopyrightText: 2017 Marco Martin <mart@kde.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7import QtQuick
8import QtQml
9
10/**
11 * @brief Group of icon properties.
12 *
13 * This is a subset of those used in QQC2, Kirigami.Action still needs the full one as needs 100% api compatibility
14 */
15QtObject {
16 /**
17 * @brief This property holds icon name.
18 *
19 * The icon will be loaded from the platform theme. If the icon is found
20 * in the theme, it will always be used; even if icon.source is also set.
21 * If the icon is not found, icon.source will be used instead.
22 */
23 property string name
24
25 /**
26 * @brief This property holds the icon source.
27 *
28 * The icon will be loaded as a regular image.
29 *
30 * @see QtQuick.Image::source
31 */
32 property var source
34 /**
35 * @brief This property holds the icon tint color.
36 *
37 * The icon is tinted with the specified color, unless the color is set to "transparent".
38 */
39 property color color: Qt.rgba(0, 0, 0, 0)
40
41 /**
42 * This property holds the width of the icon.
43 */
44 property real width
45
46 /**
47 * This property holds the height of the icon.
48 */
49 property real height
50
51 /**
52 * Bind this icon to all matching properties of a Controls icon group.
53 *
54 * This function automatically binds all properties to matching properties
55 * of a controls icon group, since we cannot just reuse the Controls icon
56 * group.
57 *
58 * To use it, you can assign the result to an IconPropertiesGroup, like so:
59 * `icon: icon.fromControlsIcon(control.icon)`.
60 */
61 function fromControlsIcon(icon) {
62 name = Qt.binding(() => icon.name)
63 source = Qt.binding(() => icon.source)
64 color = Qt.binding(() => icon.color)
65 width = Qt.binding(() => icon.width)
66 height = Qt.binding(() => icon.height)
67 return this
68 }
69}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:20 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.