src/declarative/graphicsitems/qdeclarativetextinput.cpp
changeset 37 758a864f9613
parent 33 3e2da88830cd
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp	Fri Sep 17 08:34:18 2010 +0300
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp	Mon Oct 04 01:19:32 2010 +0300
@@ -51,10 +51,13 @@
 #include <QFontMetrics>
 #include <QPainter>
 
+#ifndef QT_NO_LINEEDIT
+
 QT_BEGIN_NAMESPACE
 
 /*!
     \qmlclass TextInput QDeclarativeTextInput
+    \ingroup qml-basic-visual-elements
     \since 4.7
     \brief The TextInput item displays an editable line of text.
     \inherits Item
@@ -274,8 +277,10 @@
     QPalette p = d->control->palette();
     p.setColor(QPalette::Highlight, d->selectionColor);
     d->control->setPalette(p);
-    clearCache();
-    update();
+    if (d->control->hasSelectedText()) {
+        clearCache();
+        update();
+    }
     emit selectionColorChanged(color);
 }
 
@@ -300,8 +305,10 @@
     QPalette p = d->control->palette();
     p.setColor(QPalette::HighlightedText, d->selectedTextColor);
     d->control->setPalette(p);
-    clearCache();
-    update();
+    if (d->control->hasSelectedText()) {
+        clearCache();
+        update();
+    }
     emit selectedTextColorChanged(color);
 }
 
@@ -430,8 +437,6 @@
 }
 
 /*!
-  \internal
-
   Returns a Rect which encompasses the cursor, but which may be larger than is
   required. Ignores custom cursor delegates.
 */
@@ -559,6 +564,7 @@
 
 /*!
     \qmlclass IntValidator QIntValidator
+    \ingroup qml-basic-visual-elements
 
     This element provides a validator for integer values.
 */
@@ -577,6 +583,7 @@
 
 /*!
     \qmlclass DoubleValidator QDoubleValidator
+    \ingroup qml-basic-visual-elements
 
     This element provides a validator for non-integer numbers.
 */
@@ -615,6 +622,7 @@
 
 /*!
     \qmlclass RegExpValidator QRegExpValidator
+    \ingroup qml-basic-visual-elements
 
     This element provides a validator, which counts as valid any string which
     matches a specified regular expression.
@@ -1227,8 +1235,12 @@
     Q_D(QDeclarativeTextInput);
     if(str.length() < 1)
         return;
+    d->control->setPasswordCharacter(str.constData()[0]);
+    EchoMode echoMode_ = echoMode();
+    if (echoMode_ == Password || echoMode_ == PasswordEchoOnEdit) {
+        updateSize();
+    }
     emit passwordCharacterChanged();
-    d->control->setPasswordCharacter(str.constData()[0]);
 }
 
 /*!
@@ -1537,3 +1549,5 @@
 
 QT_END_NAMESPACE
 
+#endif // QT_NO_LINEEDIT
+