feat(ai): auto-resize input with scroll

This commit is contained in:
LilFishyChan
2026-03-27 10:51:50 +08:00
parent 01562ca544
commit ae9de61b72
@@ -504,10 +504,17 @@ Inline w/ backslash and round brackets \\(e^{i\\pi} + 1 = 0\\)
} }
spacing: 0 spacing: 0
StyledTextArea { // The actual TextArea ScrollView {
id: messageInputField id: inputScrollView
wrapMode: TextArea.Wrap
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: Math.min(root.height * 3/5, messageInputField.height)
clip: true
ScrollBar.vertical.policy: ScrollBar.AsNeeded
StyledTextArea { // The actual TextArea (inside ScrollView to enable scrolling)
id: messageInputField
anchors.fill: parent
wrapMode: TextArea.Wrap
padding: 10 padding: 10
color: activeFocus ? Appearance.m3colors.m3onSurface : Appearance.m3colors.m3onSurfaceVariant color: activeFocus ? Appearance.m3colors.m3onSurface : Appearance.m3colors.m3onSurfaceVariant
placeholderText: Translation.tr('Message the model... "%1" for commands').arg(root.commandPrefix) placeholderText: Translation.tr('Message the model... "%1" for commands').arg(root.commandPrefix)
@@ -686,10 +693,10 @@ Inline w/ backslash and round brackets \\(e^{i\\pi} + 1 = 0\\)
} }
} }
} }
}
RippleButton { // Send button RippleButton { // Send button
id: sendButton id: sendButton
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignBottom
Layout.rightMargin: 5 Layout.rightMargin: 5
implicitWidth: 40 implicitWidth: 40
implicitHeight: 40 implicitHeight: 40