diff --git a/src/plugins/qmldesigner/components/propertyeditor/colorwidget.cpp b/src/plugins/qmldesigner/components/propertyeditor/colorwidget.cpp
index fccf722253c0322ed1a0286e3f683211303d06cc..c4b12b7e25f218243ee3fd81e0f96b5b6739638e 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/colorwidget.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/colorwidget.cpp
@@ -48,144 +48,140 @@ QML_DEFINE_TYPE(Bauhaus,1,0,ColorBox,QmlDesigner::ColorBox);
 
 namespace QmlDesigner {
 
-void ColorButton::paintEvent(QPaintEvent *event)
-{
-    QToolButton::paintEvent(event);
-    if (!isEnabled())
-        return;
-
-    QColor color(m_colorString);
-
-    const int pixSize = 8;
-
-    QPainter p(this);
-
-    QRect r(0, 0, width(), height());
-    if (isEnabled())
-        p.setBrush(color);
-    else
-        p.setBrush(Qt::transparent);
-    p.setPen(Qt::black);
-    p.drawRect(r);
-
-    QVector<QPointF> points;
-    if (isChecked()) {
-        points.append(QPointF(2, 3));
-        points.append(QPointF(8, 3));
-        points.append(QPointF(5, 9));
-    } else {
-        points.append(QPointF(8, 6));
-        points.append(QPointF(2, 9));
-        points.append(QPointF(2, 3));
+    void ColorButton::paintEvent(QPaintEvent *event)
+    {
+        QToolButton::paintEvent(event);
+        if (!isEnabled())
+            return;
+
+        QColor color(m_colorString);
+
+        const int pixSize = 8;
+
+        QPainter p(this);
+
+        QRect r(0, 0, width(), height());
+        if (isEnabled())
+            p.setBrush(color);
+        else
+            p.setBrush(Qt::transparent);
+        p.setPen(Qt::black);
+        p.drawRect(r);
+
+        QVector<QPointF> points;
+        if (isChecked()) {
+            points.append(QPointF(2, 3));
+            points.append(QPointF(8, 3));
+            points.append(QPointF(5, 9));
+        } else {
+            points.append(QPointF(8, 6));
+            points.append(QPointF(2, 9));
+            points.append(QPointF(2, 3));
+        }
+        p.setPen("#707070");
+        p.setBrush(Qt::white);
+        p.drawPolygon(points);
     }
-    p.setPen("#707070");
-    p.setBrush(Qt::white);
-    p.drawPolygon(points);
-}
 
 
-void HueControl::setCurrent(int y)
-{
-       QColor oldColor(m_colorString);
-       oldColor.toHsv();
-       QColor newColor;
-       newColor.setHsvF(qreal(y) / 120.0, oldColor.hsvSaturationF(), oldColor.valueF());
+    void HueControl::setCurrent(int y)
+    {
+        QColor oldColor(m_colorString);
+        oldColor.toHsv();
+        QColor newColor;
+        newColor.setHsvF(qreal(y) / 120.0, oldColor.hsvSaturationF(), oldColor.valueF());
 
-       QString newColorStr = QVariant(newColor).toString();
-       setColor(newColorStr);
-       setHue(qreal(y) / 120.0);
-}
-
-void HueControl::paintEvent(QPaintEvent *event)
-{
-    QWidget::paintEvent(event);    
+        QString newColorStr = QVariant(newColor).toString();
+        setColor(newColorStr);
+        setHue(qreal(y) / 120.0);
+    }
 
-    QColor color(m_colorString);
-    color.toHsv();
+    void HueControl::paintEvent(QPaintEvent *event)
+    {
+        QWidget::paintEvent(event);
 
-    QPainter p(this);
+        QPainter p(this);
 
-    int height = 120;
+        int height = 120;
 
-    if (m_cache.isNull()) {
-        m_cache = QPixmap(10, height);
+        if (m_cache.isNull()) {
+            m_cache = QPixmap(10, height);
 
-        QPainter cacheP(&m_cache);
+            QPainter cacheP(&m_cache);
 
-        for (int i = 0; i < height; i++)
-        {
-            QColor c;
-            c.setHsvF(qreal(i) / 120.0, 1,1.0);
-            cacheP.fillRect(0, i, 10, i + 1, c);
+            for (int i = 0; i < height; i++)
+            {
+                QColor c;
+                c.setHsvF(qreal(i) / 120.0, 1,1.0);
+                cacheP.fillRect(0, i, 10, i + 1, c);
+            }
         }
-    }
 
-    p.drawPixmap(10, 5, m_cache);
+        p.drawPixmap(10, 5, m_cache);
 
-    QVector<QPointF> points;
+        QVector<QPointF> points;
 
-    int y = hue() * 120 + 5;
+        int y = hue() * 120 + 5;
 
-    points.append(QPointF(15, y));
-    points.append(QPointF(25, y + 5));
-    points.append(QPointF(25, y - 5));
+        points.append(QPointF(15, y));
+        points.append(QPointF(25, y + 5));
+        points.append(QPointF(25, y - 5));
 
-    p.setPen(Qt::black);
-    p.setBrush(QColor("#707070"));
-    p.drawPolygon(points);
-}
+        p.setPen(Qt::black);
+        p.setBrush(QColor("#707070"));
+        p.drawPolygon(points);
+    }
 
-void ColorBox::setCurrent(int x, int y)
-{
+    void ColorBox::setCurrent(int x, int y)
+    {
 
-      QColor oldColor(m_colorString);
-       oldColor.toHsv();
-       QColor newColor;
-       newColor.setHsvF(hue(), qreal(x) / 120, 1.0 - qreal(y) / 120);
+        QColor oldColor(m_colorString);
+        oldColor.toHsv();
+        QColor newColor;
+        newColor.setHsvF(hue(), qreal(x) / 120, 1.0 - qreal(y) / 120);
 
-       QString newColorStr = QVariant(newColor).toString();
-       setColor(newColorStr);
-}
+        QString newColorStr = QVariant(newColor).toString();
+        setColor(newColorStr);
+    }
 
-void ColorBox::paintEvent(QPaintEvent *event)
-{
-    QWidget::paintEvent(event);
+    void ColorBox::paintEvent(QPaintEvent *event)
+    {
+        QWidget::paintEvent(event);
 
-    QPainter p(this);
-    QColor color(m_colorString);
+        QPainter p(this);
+        QColor color(m_colorString);
 
-    if (m_hue != (m_lastHue) || (m_cache.isNull())) {
-        m_lastHue = m_hue;
-        m_cache = QPixmap(120, 120);
+        if (m_hue != (m_lastHue) || (m_cache.isNull())) {
+            m_lastHue = m_hue;
+            m_cache = QPixmap(120, 120);
 
-        
-        color.toHsv();
+            color.toHsv();
 
-        int height = 120;
-        int width = 120;
+            int height = 120;
+            int width = 120;
 
-        QPainter chacheP(&m_cache);
+            QPainter chacheP(&m_cache);
 
-        if (color.hsvHueF() < 0)
-            color.setHsvF(hue(), color.hsvSaturationF(), color.valueF());
+            if (color.hsvHueF() < 0)
+                color.setHsvF(hue(), color.hsvSaturationF(), color.valueF());
 
-        for (int y = 0; y < height; y++)
-            for (int x = 0; x < width; x++)
-            {
+            for (int y = 0; y < height; y++)
+                for (int x = 0; x < width; x++)
+                {
                 QColor c;
                 c.setHsvF(color.hsvHueF(), qreal(x) / 120, 1.0 - qreal(y) / 120);
                 chacheP.setPen(c);
                 chacheP.drawPoint(x ,y);
             }
-    }
+        }
 
-    p.drawPixmap(5, 5, m_cache);
+        p.drawPixmap(5, 5, m_cache);
 
-    int x = color.hsvSaturationF() * 120 + 5;
-    int y = 120 - color.valueF() * 120 + 5;
+        int x = color.hsvSaturationF() * 120 + 5;
+        int y = 120 - color.valueF() * 120 + 5;
 
-    p.setPen(Qt::white);
-    p.drawEllipse(x - 2, y - 2, 4, 4);
-}
+        p.setPen(Qt::white);
+        p.drawEllipse(x - 2, y - 2, 4, 4);
+    }
 
 }
diff --git a/src/plugins/qmldesigner/components/propertyeditor/colorwidget.h b/src/plugins/qmldesigner/components/propertyeditor/colorwidget.h
index 51e317981fa18e57c9b9b82e0bb6f3e2349d22be..01e2721559e7a39b9bf02500d5ada5f3672e8b21 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/colorwidget.h
+++ b/src/plugins/qmldesigner/components/propertyeditor/colorwidget.h
@@ -190,6 +190,10 @@ void setHue(qreal newHue)
         return;
 
     m_hue = newHue;
+    QColor color(m_colorString);
+    color.toHsv();
+    color.setHsvF(newHue, color.hsvSaturationF(), color.valueF());
+    m_colorString = color.name();
     update();
     emit hueChanged();
 }
@@ -205,6 +209,8 @@ void setColor(const QString &colorStr)
         return;
 
     m_colorString = colorStr;
+    QColor color(m_colorString);
+    m_hue = color.hueF();
     update();
     emit colorChanged();
 }