// Copyright (C) 2024 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only import QtQuick import QtQuick.Templates as T import QtQuick.Controls.impl import QtQuick.Controls.FluentWinUI3.impl T.TextArea { id: control implicitWidth: implicitBackgroundWidth + leftInset + rightInset || Math.max(contentWidth, placeholder.implicitWidth) + leftPadding + rightPadding implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, contentHeight + topPadding + bottomPadding, placeholder.implicitHeight + topPadding + bottomPadding) topPadding: config.topPadding || 0 bottomPadding: config.bottomPadding || 0 leftPadding: config.leftPadding || 0 rightPadding: config.rightPadding || 0 topInset: -config.topInset || 0 bottomInset: -config.bottomInset || 0 leftInset: -config.leftInset || 0 rightInset: -config.rightInset || 0 color: control.palette.text selectionColor: control.palette.highlight selectedTextColor: control.palette.highlightedText placeholderTextColor: control.palette.placeholderText verticalAlignment: Text.AlignVCenter readonly property string __currentState: [ !enabled && "disabled", activeFocus && "focused", enabled && !activeFocus && hovered && "hovered", ].filter(Boolean).join("_") || "normal" readonly property var config: Config.controls.textarea[__currentState] || {} PlaceholderText { id: placeholder x: control.leftPadding y: control.topPadding width: control.width - (control.leftPadding + control.rightPadding) height: control.height - (control.topPadding + control.bottomPadding) text: control.placeholderText font: control.font color: control.placeholderTextColor verticalAlignment: control.verticalAlignment horizontalAlignment: control.horizontalAlignment visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter) elide: Text.ElideRight renderType: control.renderType } background: StyleImage { imageConfig: control.config.background Item{ visible: control.activeFocus width: parent.width height: 2 y: parent.height - height FocusStroke { width: parent.width height: parent.height radius: control.config.background.bottomOffset color: control.palette.accent } } } }