Fix TextInput not reacting to text color change.
authorAndrew den Exter <andrew.den-exter@nokia.com>
Mon, 12 Dec 2011 04:50:01 +0000 (14:50 +1000)
committerQt by Nokia <qt-info@nokia.com>
Mon, 12 Dec 2011 07:20:32 +0000 (08:20 +0100)
Trigger a relayout with the new color when the color property is
changed.

Task-number: QTBUG-22402

Change-Id: I2dc190e097e878ac498fd04c2800a6e11947527c
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
src/quick/items/qquicktextinput.cpp

index b389329..8fc2fee 100644 (file)
@@ -259,6 +259,7 @@ void QQuickTextInput::setColor(const QColor &c)
     Q_D(QQuickTextInput);
     if (c != d->color) {
         d->color = c;
+        d->textLayoutDirty = true;
         update();
         emit colorChanged(c);
     }
@@ -286,8 +287,10 @@ void QQuickTextInput::setSelectionColor(const QColor &color)
     QPalette p = d->control->palette();
     p.setColor(QPalette::Highlight, d->selectionColor);
     d->control->setPalette(p);
-    if (d->control->hasSelectedText())
+    if (d->control->hasSelectedText()) {
+        d->textLayoutDirty = true;
         update();
+    }
     emit selectionColorChanged(color);
 }
 /*!
@@ -311,8 +314,10 @@ void QQuickTextInput::setSelectedTextColor(const QColor &color)
     QPalette p = d->control->palette();
     p.setColor(QPalette::HighlightedText, d->selectedTextColor);
     d->control->setPalette(p);
-    if (d->control->hasSelectedText())
+    if (d->control->hasSelectedText()) {
+        d->textLayoutDirty = true;
         update();
+    }
     emit selectedTextColorChanged(color);
 }