summaryrefslogtreecommitdiff
path: root/src/controls/TextField.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-11-02 13:08:25 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-11-02 16:20:06 +0000
commit1adb58bb6d31234dc9e05ce95b60aa1be7c75373 (patch)
treea34a9bfc639583f1b4fa6551ccce3be1c253a2de /src/controls/TextField.qml
parent42c04ed29c36eec70cdce58e5c2d19faec62d039 (diff)
downloadqtquickcontrols-1adb58bb6d31234dc9e05ce95b60aa1be7c75373.tar.gz
TextField: hide placeholder text when h-centered & focused
The same was done to QLineEdit in qtbase commit a2666d3. A quote from the commit message: A blinking cursor in the middle over horizontally centered placeholder text looks bad. Thus, horizontally centered content is now considered as an exception and the placeholder text is hidden when the line edit is focused. Change-Id: I2230b9a2254c79676f9fdc308927092e1af4db49 Task-number: QTBUG-49147 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/controls/TextField.qml')
-rw-r--r--src/controls/TextField.qml2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/controls/TextField.qml b/src/controls/TextField.qml
index 0c8a0df6..c5d5d2b5 100644
--- a/src/controls/TextField.qml
+++ b/src/controls/TextField.qml
@@ -625,7 +625,7 @@ Control {
font: textInput.font
horizontalAlignment: textInput.horizontalAlignment
verticalAlignment: textInput.verticalAlignment
- opacity: textInput.displayText.length ? 0.0 : 1.0
+ opacity: !textInput.displayText && (!textInput.activeFocus || textInput.horizontalAlignment !== Qt.AlignHCenter) ? 1.0 : 0.0
color: __panel ? __panel.placeholderTextColor : "darkgray"
clip: contentWidth > width;
elide: Text.ElideRight