diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-09-01 19:43:20 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-09-05 11:37:56 +0000 |
commit | c7b8289a706f982c1cf5091a4d86606ec758b05d (patch) | |
tree | 98b9fab4eecaf006773c5441115c10229ed3d393 /src/imports/controls/material | |
parent | 588dc30b44c42b63239085ea5f2817eb3a48995a (diff) |
TextField: improve the implicit size calculation
In general, we don't want TextField to grow while typing, but if there
is no background nor placeholder, use content width as a fallback. Also
take content height into account while calculating the implicit height.
Task-number: QTBUG-55684
Change-Id: Iee0eff6861c3573045036a06d7e53f7fc313fbe8
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/controls/material')
-rw-r--r-- | src/imports/controls/material/TextField.qml | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/imports/controls/material/TextField.qml b/src/imports/controls/material/TextField.qml index 9c576ca6..580b43bd 100644 --- a/src/imports/controls/material/TextField.qml +++ b/src/imports/controls/material/TextField.qml @@ -42,9 +42,11 @@ T.TextField { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, - placeholder.implicitWidth + leftPadding + rightPadding) - implicitHeight: Math.max(background ? background.implicitHeight : 0, - placeholder.implicitHeight + 1 + topPadding + bottomPadding) + placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0) + || contentWidth + leftPadding + rightPadding + implicitHeight: Math.max(contentHeight + topPadding + bottomPadding, + background ? background.implicitHeight : 0, + placeholder.implicitHeight + topPadding + bottomPadding) topPadding: 8 bottomPadding: 16 |