~bzoltan/kubuntu-packaging/decouple_cmake_plugin

« back to all changes in this revision

Viewing changes to share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorEditor.qml

  • Committer: Timo Jyrinki
  • Date: 2013-12-02 09:16:15 UTC
  • mfrom: (1.1.29)
  • Revision ID: timo.jyrinki@canonical.com-20131202091615-xbj1os1f604ber1m
New upstream release candidate.

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
    id: colorEditor
65
65
 
66
66
    onColorChanged: {
 
67
        if (!gradientLine.isCompleted)
 
68
            return;
67
69
        textField.text = gradientLine.colorToString(color);
68
 
        gradientLine.currentColor = color
69
 
        //Delay setting the color to keep ui responsive
70
 
        colorEditorTimer.restart()
 
70
 
 
71
        if (supportGradient && gradientLine.visible)
 
72
            gradientLine.currentColor = color
 
73
 
 
74
        if (buttonRow.checkedIndex !== 1)
 
75
            //Delay setting the color to keep ui responsive
 
76
            colorEditorTimer.restart()
71
77
    }
72
78
 
73
79
    GradientLine {
 
80
        property bool isCompleted: false
74
81
        visible: buttonRow.checkedIndex === 1
75
82
        id: gradientLine
76
83
 
77
84
        width: parent.width
78
85
 
79
86
        onCurrentColorChanged: {
 
87
            if (supportGradient && gradientLine.visible)
 
88
                colorEditor.color = gradientLine.currentColor
 
89
        }
 
90
 
 
91
        onHasGradientChanged: {
 
92
            print("hasGradient")
 
93
             if (!supportGradient)
 
94
                 return
 
95
 
 
96
            if (gradientLine.hasGradient)
 
97
                buttonRow.initalChecked = 1
 
98
            else
 
99
                buttonRow.initalChecked = 0
 
100
            buttonRow.checkedIndex = buttonRow.initalChecked
 
101
        }
 
102
 
 
103
        Component.onCompleted: {
80
104
            colorEditor.color = gradientLine.currentColor
 
105
            isCompleted= true
81
106
        }
82
107
    }
83
108
 
105
130
 
106
131
            LineEdit {
107
132
                id: textField
108
 
                inputMask: "\\#hhHHHHHH"
 
133
                inputMask: "\\#HHHHHHhh"
 
134
                showTranslateCheckBox: false
 
135
 
 
136
                backendValue: colorEditor.backendendValue
109
137
 
110
138
                onAccepted: {
111
 
                    colorEditor.color = text
 
139
                    colorEditor.color = textField.text
112
140
                }
113
141
                Layout.preferredWidth: 80
114
142
            }
124
152
 
125
153
                ButtonRowButton {
126
154
                    iconSource: "images/icon_color_solid.png"
 
155
                    onClicked: {
 
156
                        colorEditor.backendendValue.resetValue()
 
157
                        gradientLine.deleteGradient()
 
158
                    }
127
159
 
128
160
                }
129
161
                ButtonRowButton {
130
162
                    visible: supportGradient
131
163
                    iconSource: "images/icon_color_gradient.png"
 
164
                    onClicked: {
 
165
                        colorEditor.backendendValue.resetValue()
 
166
                        gradientLine.addGradient()
 
167
                    }
132
168
 
133
169
                }
134
170
                ButtonRowButton {
135
171
                    iconSource: "images/icon_color_none.png"
136
 
 
137
 
                }
138
 
 
139
 
                onToggled: {
140
 
                    if (index === 0) {
141
 
                        colorEditor.color = "#ffffff"
142
 
                    }
143
 
 
144
 
                    if (index === 2) {
 
172
                    onClicked: {
145
173
                        colorEditor.color = "#00000000"
 
174
                        gradientLine.deleteGradient()
146
175
                    }
 
176
 
147
177
                }
148
 
 
149
178
            }
150
179
 
151
180
            ExpandingSpacer {