@@ -3,6 +3,7 @@ import QtQuick.Controls
33import QtQuick.Layouts
44
55import Controls 1.0
6+ import Utils 1.0
67
78FloatingPane {
89 id: root
@@ -16,8 +17,8 @@ FloatingPane {
1617
1718
1819 property real slidersPowerValue: 4.0
19- property real gainValue: Math .pow (gainCtrl .value , slidersPowerValue)
20- property real gammaValue: Math .pow (gammaCtrl .value , slidersPowerValue)
20+ property real gainValue: Math .pow (gainCtrl .value , slidersPowerValue). toFixed ( 2 )
21+ property real gammaValue: Math .pow (gammaCtrl .value , slidersPowerValue). toFixed ( 2 )
2122 property alias channelModeValue: channelsCtrl .value
2223 property variant colorRGBA: null
2324 property variant mousePosition: ({x: 0 , y: 0 })
@@ -112,6 +113,7 @@ FloatingPane {
112113
113114 onClicked: {
114115 gainCtrl .value = gainDefaultValue
116+ gainLabel .reset (gainValue)
115117 }
116118 }
117119 ExpressionTextField {
@@ -121,11 +123,19 @@ FloatingPane {
121123 ToolTip .delay : 100
122124 ToolTip .text : " Color Gain (in linear colorspace)"
123125
124- text: gainValue .toFixed (2 )
126+ text: gainValue
127+ decimals: 2
125128 Layout .preferredWidth : textMetrics_gainValue .width
126129 selectByMouse: true
127130 onAccepted: {
128- gainCtrl .value = Math .pow (Number (gainLabel .text ), 1.0 / slidersPowerValue)
131+ if (! gainLabel .hasExprError ) {
132+ if (gainLabel .evaluatedValue <= 0 ) {
133+ gainLabel .evaluatedValue = 0
134+ gainCtrl .value = gainLabel .evaluatedValue
135+ } else {
136+ gainCtrl .value = Math .pow (Number (gainLabel .evaluatedValue ), 1.0 / slidersPowerValue)
137+ }
138+ }
129139 }
130140 }
131141 Slider {
@@ -135,6 +145,7 @@ FloatingPane {
135145 to: 2
136146 value: gainDefaultValue
137147 stepSize: 0.01
148+ onMoved: gainLabel .reset (Math .pow (value, slidersPowerValue))
138149 }
139150 }
140151
@@ -151,6 +162,7 @@ FloatingPane {
151162
152163 onClicked: {
153164 gammaCtrl .value = gammaDefaultValue;
165+ gammaLabel .reset (gammaValue)
154166 }
155167 }
156168 ExpressionTextField {
@@ -160,11 +172,19 @@ FloatingPane {
160172 ToolTip .delay : 100
161173 ToolTip .text : " Apply Gamma (after Gain and in linear colorspace)"
162174
163- text: gammaValue .toFixed (2 )
175+ text: gammaValue
176+ decimals: 2
164177 Layout .preferredWidth : textMetrics_gainValue .width
165178 selectByMouse: true
166179 onAccepted: {
167- gammaCtrl .value = Math .pow (Number (gammaLabel .text ), 1.0 / slidersPowerValue)
180+ if (! gammaLabel .hasExprError ) {
181+ if (gammaLabel .evaluatedValue <= 0 ) {
182+ gammaLabel .evaluatedValue = 0
183+ gammaCtrl .value = gammaLabel .evaluatedValue
184+ } else {
185+ gammaCtrl .value = Math .pow (Number (gammaLabel .evaluatedValue ), 1.0 / slidersPowerValue)
186+ }
187+ }
168188 }
169189 }
170190 Slider {
@@ -174,6 +194,7 @@ FloatingPane {
174194 to: 2
175195 value: gammaDefaultValue
176196 stepSize: 0.01
197+ onMoved: gammaLabel .reset (Math .pow (value, slidersPowerValue))
177198 }
178199 }
179200
0 commit comments