diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-08-09 15:14:55 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-08-10 22:24:20 +0000 |
commit | 580f2872f09cf7ad83ec9ae5dca686683a3cac80 (patch) | |
tree | 89b39fbd89e360015fac0c3e041b5ea77702f41e /src/quick/items/qquicktextinput.cpp | |
parent | 5e7720d3fba1865439bf21fd564152b8b9a70f13 (diff) |
TextInput: fix horizontal alignment when implicit resizing is disabled
By default, TextInput updates its implicit width to match the content
width. This implies that when TextInput does not have an explicit width
set, there is no need to handle horizontal alignment.
TextField wants to override the default implicit width, so it disables
the "implicit resizing" feature of TextInput. In this scenario, the
implicit width does not match the content width. Therefore the text
layouting code should also treat the item as if it had an explicit width
set to achieve the correct horizontal alignment.
Task-number: QTBUG-55138
Change-Id: I8c04971a6aff44c6f1734df50153a9788849e98a
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quick/items/qquicktextinput.cpp')
-rw-r--r-- | src/quick/items/qquicktextinput.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 03c6b892c4..63e8505ffa 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -2916,7 +2916,7 @@ void QQuickTextInputPrivate::updateLayout() if (inLayout) // probably the result of a binding loop, but by letting it return; // get this far we'll get a warning to that effect. } - qreal lineWidth = q->widthValid() ? q->width() - q->leftPadding() - q->rightPadding() : INT_MAX; + qreal lineWidth = q->widthValid() || !isImplicitResizeEnabled() ? q->width() - q->leftPadding() - q->rightPadding() : INT_MAX; qreal height = 0; qreal width = 0; do { |