aboutsummaryrefslogtreecommitdiffstats
path: root/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Controls/IconSection.qml
blob: fd63cfef6b7789009ea0adb7f0e1921d81cceb66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0

import QtQuick 2.15
import QtQuick.Layouts 1.15
import HelperWidgets 2.0
import StudioTheme 1.0 as StudioTheme

Section {
    id: root

    property bool blockedByContext: backendValues.display.enumeration === "TextOnly"

    caption: qsTr("Icon")
    width: parent.width

    SectionLayout {
        // We deliberately kept the "name" property out as it is only properly supported by linux
        // based operating systems out of the box.

        PropertyLabel {
            text: qsTr("Source")
            blockedByTemplate: !backendValues.icon_source.isAvailable
            enabled: !root.blockedByContext
        }

        SecondColumnLayout {
            UrlChooser {
                backendValue: backendValues.icon_source
                enabled: backendValues.icon_source.isAvailable && !root.blockedByContext
            }

            ExpandingSpacer {}
        }

        PropertyLabel {
            text: qsTr("Color")
            blockedByTemplate: !backendValues.icon_color.isAvailable
            enabled: !root.blockedByContext
        }

        ColorEditor {
            backendValue: backendValues.icon_color
            supportGradient: false
            enabled: backendValues.icon_color.isAvailable && !root.blockedByContext
        }

        PropertyLabel {
            text: qsTr("Size")
            blockedByTemplate: !backendValues.icon_width.isAvailable
            enabled: !root.blockedByContext
        }

        SecondColumnLayout {
            SpinBox {
                implicitWidth: StudioTheme.Values.twoControlColumnWidth
                               + StudioTheme.Values.actionIndicatorWidth
                backendValue: backendValues.icon_width
                maximumValue: 0xffff
                minimumValue: 0
                decimals: 0
                enabled: backendValues.icon_width.isAvailable && !root.blockedByContext
            }

            Spacer { implicitWidth: StudioTheme.Values.controlLabelGap }

            ControlLabel {
                //: The width of the object
                text: qsTr("W", "width")
                tooltip: qsTr("Width")
                enabled: backendValues.icon_width.isAvailable && !root.blockedByContext
            }

            Spacer { implicitWidth: StudioTheme.Values.controlGap }

            SpinBox {
                implicitWidth: StudioTheme.Values.twoControlColumnWidth
                               + StudioTheme.Values.actionIndicatorWidth
                backendValue: backendValues.icon_height
                maximumValue: 0xffff
                minimumValue: 0
                decimals: 0
                enabled: backendValues.icon_height.isAvailable && !root.blockedByContext
            }

            Spacer { implicitWidth: StudioTheme.Values.controlLabelGap }

            ControlLabel {
                //: The height of the object
                text: qsTr("H", "height")
                tooltip: qsTr("Height")
                enabled: backendValues.icon_height.isAvailable && !root.blockedByContext
            }
/*
            TODO QDS-4836
            Spacer { implicitWidth: StudioTheme.Values.controlGap }

            LinkIndicator2D {}
*/
            ExpandingSpacer {}
        }

        PropertyLabel {
            text: qsTr("Cache")
            tooltip: qsTr("Whether the icon should be cached.")
            blockedByTemplate: !backendValues.icon_cache.isAvailable
            enabled: !root.blockedByContext
        }

        SecondColumnLayout {
            CheckBox {
                text: backendValues.icon_cache.valueToString
                implicitWidth: StudioTheme.Values.twoControlColumnWidth
                               + StudioTheme.Values.actionIndicatorWidth
                backendValue: backendValues.icon_cache
                enabled: backendValues.icon_cache.isAvailable && !root.blockedByContext
            }

            ExpandingSpacer {}
        }

    }
}