aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols/material/TextField.qml
diff options
context:
space:
mode:
authorHatem ElKharashy <hatem.elkharashy@qt.io>2023-11-08 14:39:49 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-11-11 16:37:48 +0000
commitc8a95333eb532ad1611f6e2f1a74d96b156cfb16 (patch)
tree2ca6c80518580a928669ad7fca03ba733a6688f0 /src/quickcontrols/material/TextField.qml
parent6353c1637849d5ac17f5514bd430726458037a20 (diff)
Material: respect horizontalAlignment in placeholder text
This allows placeholder text to follow the Alignment set to the TextField or TextArea components when using Material style. The placeholder text will float to the left, right, or center depending on the alignment set, and the arc will be drawn properly in case of Material.Outline container style. Fixes: QTBUG-118856 Pick-to: 6.5 Change-Id: Ic9cede806dc2f6109e7e2c4b2b2fc960d9c6a1b6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 7e678acbb6167218d349c49436499121b2025af5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/quickcontrols/material/TextField.qml')
-rw-r--r--src/quickcontrols/material/TextField.qml1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/quickcontrols/material/TextField.qml b/src/quickcontrols/material/TextField.qml
index d29b247ce1..7186ac9d2b 100644
--- a/src/quickcontrols/material/TextField.qml
+++ b/src/quickcontrols/material/TextField.qml
@@ -69,6 +69,7 @@ T.TextField {
// When the control's size is set larger than its implicit size, use whatever size is smaller
// so that the gap isn't too big.
placeholderTextWidth: Math.min(placeholder.width, placeholder.implicitWidth) * placeholder.scale
+ placeholderTextHAlign: control.effectiveHorizontalAlignment
controlHasActiveFocus: control.activeFocus
controlHasText: control.length > 0
placeholderHasText: placeholder.text.length > 0