summaryrefslogtreecommitdiff
path: root/src/quickcontrols/material/TextArea.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/quickcontrols/material/TextArea.qml')
-rw-r--r--src/quickcontrols/material/TextArea.qml7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/quickcontrols/material/TextArea.qml b/src/quickcontrols/material/TextArea.qml
index 58eef10231..4a975295a5 100644
--- a/src/quickcontrols/material/TextArea.qml
+++ b/src/quickcontrols/material/TextArea.qml
@@ -16,6 +16,10 @@ T.TextArea {
implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
implicitBackgroundHeight + topInset + bottomInset)
+ // If we're clipped, or we're in a Flickable that's clipped, set our topInset
+ // to half the height of the placeholder text to avoid it being clipped.
+ topInset: clip || (parent?.parent as Flickable && parent?.parent.clip) ? placeholder.largestHeight / 2 : 0
+
leftPadding: Material.textFieldHorizontalPadding
rightPadding: Material.textFieldHorizontalPadding
// Need to account for the placeholder text when it's sitting on top.
@@ -23,7 +27,8 @@ T.TextArea {
? Material.textFieldVerticalPadding + placeholder.largestHeight
// When the condition above is not met, the text should always sit in the middle
// of a default-height TextArea, which is just near the top for a higher-than-default one.
- : (implicitBackgroundHeight - placeholder.largestHeight) / 2
+ // Account for any topInset as well, otherwise the text will be too close to the background.
+ : ((implicitBackgroundHeight - placeholder.largestHeight) / 2) + topInset
bottomPadding: Material.textFieldVerticalPadding
color: enabled ? Material.foreground : Material.hintTextColor