aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/universal/TextField.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-09-01 19:43:20 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-09-05 11:37:56 +0000
commitc7b8289a706f982c1cf5091a4d86606ec758b05d (patch)
tree98b9fab4eecaf006773c5441115c10229ed3d393 /src/imports/controls/universal/TextField.qml
parent588dc30b44c42b63239085ea5f2817eb3a48995a (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/universal/TextField.qml')
-rw-r--r--src/imports/controls/universal/TextField.qml6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/imports/controls/universal/TextField.qml b/src/imports/controls/universal/TextField.qml
index a245ba39..bd496ecc 100644
--- a/src/imports/controls/universal/TextField.qml
+++ b/src/imports/controls/universal/TextField.qml
@@ -41,9 +41,9 @@ import QtQuick.Controls.Universal 2.0
T.TextField {
id: control
- implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
- background ? background.implicitWidth : 0,
- placeholder.implicitWidth + leftPadding + rightPadding)
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0)
+ || contentWidth + leftPadding + rightPadding
implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
background ? background.implicitHeight : 0,
placeholder.implicitHeight + topPadding + bottomPadding)