Commit 7fbbe74e authored by Christiaan Janssen's avatar Christiaan Janssen
Browse files

QmlDesigner.PropertyEditor: color widget improvements

parent fb835713
......@@ -102,7 +102,7 @@ QExtGroupBox {
QSpinBox {
maximum: 360
value: colorControl.hue*360;
onValueChanged: if (colorControl.hue*360 !=value)
onValueChanged: if (colorControl.hue !=value/360.0)
colorControl.hue=value/360.0;
}
......@@ -118,7 +118,7 @@ QExtGroupBox {
QSpinBox {
maximum: 255
value: colorControl.saturation*255;
onValueChanged: if (colorControl.saturation*255 !=value)
onValueChanged: if (colorControl.saturation !=value/255.0)
colorControl.saturation=value/255.0;
}
}
......@@ -133,7 +133,7 @@ QExtGroupBox {
QSpinBox {
maximum: 255
value: colorControl.value*255;
onValueChanged: if (colorControl.value*255 !=value)
onValueChanged: if (colorControl.value!=value/255.0)
colorControl.value=value/255.0;
}
......
......@@ -56,8 +56,6 @@ namespace QmlDesigner {
QColor color(m_colorString);
const int pixSize = 8;
QPainter p(this);
QRect r(0, 0, width(), height());
......
......@@ -107,6 +107,7 @@ void setHue(qreal newHue)
m_hue = newHue;
update();
emit hueChanged();
emit colorChanged();
}
qreal hue() const
......@@ -142,12 +143,15 @@ qreal saturation() const
return QColor(m_colorString).hsvSaturationF();
}
qreal setSaturation(qreal newsaturation)
void setSaturation(qreal newsaturation)
{
QColor color(m_colorString);
if (color.hsvSaturationF()==newsaturation) return;
color.setHsvF(color.hsvHueF(),newsaturation,color.valueF());
m_colorString=color.name();
update();
emit saturationChanged();
emit colorChanged();
}
qreal value() const
......@@ -155,12 +159,15 @@ qreal value() const
return QColor(m_colorString).valueF();
}
qreal setValue(qreal newvalue)
void setValue(qreal newvalue)
{
QColor color(m_colorString);
if (color.valueF()==newvalue) return;
color.setHsvF(color.hsvHueF(),color.hsvSaturationF(),newvalue);
m_colorString=color.name();
update();
emit valueChanged();
emit colorChanged();
}
signals:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment