diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-10-29 22:25:11 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-10-30 09:51:36 +0000 |
commit | 19e7cc53a7189c5c35a478d06b435433297771c5 (patch) | |
tree | a1b1958cdaf36813b362b943acc4a55ba5294b27 /src/imports/controls/TextArea.qml | |
parent | 390fb0d4a8e4f308b225a86b48205b14633cf0e2 (diff) |
Simplify TextField & TextArea placeholder
Better not expose the extra Text item in the API. Ideally it should
be implemented as a scenegraph node. We might even want to promote
the placeholderText property (and add placeholderColor) to TextInput
and TextEdit in Qt Quick core.
Change-Id: I4f443c77d1c696b87a50ee184f868713dd50316f
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Diffstat (limited to 'src/imports/controls/TextArea.qml')
-rw-r--r-- | src/imports/controls/TextArea.qml | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/imports/controls/TextArea.qml b/src/imports/controls/TextArea.qml index c4c7833d..564bd108 100644 --- a/src/imports/controls/TextArea.qml +++ b/src/imports/controls/TextArea.qml @@ -43,10 +43,10 @@ T.TextArea { implicitWidth: Math.max(contentWidth + leftPadding + rightPadding, background ? background.implicitWidth : 0, - placeholder ? placeholder.implicitWidth + leftPadding + rightPadding : 0) + placeholder.implicitWidth + leftPadding + rightPadding) implicitHeight: Math.max(contentHeight + topPadding + bottomPadding, background ? background.implicitHeight : 0, - placeholder ? placeholder.implicitHeight + topPadding + bottomPadding : 0) + placeholder.implicitHeight + topPadding + bottomPadding) padding: 6 @@ -54,13 +54,14 @@ T.TextArea { selectionColor: Theme.selectionColor selectedTextColor: Theme.selectedTextColor - //! [placeholder] - placeholder: Text { + Text { + id: placeholder x: control.leftPadding y: control.topPadding width: control.width - (control.leftPadding + control.rightPadding) height: control.height - (control.topPadding + control.bottomPadding) + text: control.placeholderText font: control.font color: control.Theme.disabledColor horizontalAlignment: control.horizontalAlignment @@ -68,5 +69,4 @@ T.TextArea { visible: !control.length elide: Text.ElideRight } - //! [placeholder] } |