10import org.kde.kirigami as Kirigami
39 required property string label
44 property int maximumLength: -1
49 property alias fieldActiveFocus: textArea.activeFocus
54 property alias readOnly: textArea.readOnly
66 property alias inputMethodHints: textArea.inputMethodHints
75 property alias placeholderText: textArea.placeholderText
97 property var status: Kirigami.MessageType.Information
105 property string statusMessage: ""
116 signal editingFinished();
129 function insert(position: int, text: string): void {
130 textArea.insert(position, text);
133 onActiveFocusChanged: {
135 textArea.forceActiveFocus();
139 onClicked: textArea.forceActiveFocus()
141 Accessible.role: Accessible.EditableText
143 contentItem: ColumnLayout {
144 spacing: Kirigami.Units.smallSpacing
147 spacing: Kirigami.Units.largeSpacing
151 elide: Text.ElideRight
152 color: root.enabled ? Kirigami.Theme.textColor : Kirigami.Theme.disabledTextColor
156 Accessible.ignored: true
157 Layout.fillWidth: true
164 text: label(root.maximumLength, root.maximumLength)
165 font: Kirigami.Theme.smallFont
167 function label(current: int, maximum: int): string {
168 return i18nc("@label %1 is current text length, %2 is maximum length of text field
", "%1/%2
", current, maximum)
171 visible:root.maximumLength != -1
172 text: metrics.label(textArea.text.length, root.maximumLength)
173 font: Kirigami.Theme.smallFont
174 color: textArea.text.length === root.maximumLength
175 ? Kirigami.Theme.neutralTextColor
176 : Kirigami.Theme.textColor
177 horizontalAlignment: Text.AlignRight
179 Layout.margins: Kirigami.Units.smallSpacing
180 Layout.preferredWidth: metrics.advanceWidth
187 placeholderText: root.placeholderText
189 onTextChanged: root.text = text
190 onEditingFinished: root.editingFinished()
191 activeFocusOnTab: false
192 wrapMode: TextEdit.Wrap
194 Accessible.name: root.label
195 Layout.fillWidth: true
198 Kirigami.InlineMessage {
201 visible: root.statusMessage.length > 0
202 text: root.statusMessage
205 Layout.topMargin: visible ? Kirigami.Units.smallSpacing : 0
206 Layout.fillWidth: true
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:03:50 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.