Files
logos-chat-ui/components/MessageView.qml
osmaczko 9d637f5e36 chore: port QML chat UI to drive the rust-bindings-exploration chat_module
Replaces the QML+C++-backend implementation (master) with a pure-QML port that
talks to the Rust chat_module exclusively via logos.callModule.

Note: pure QML is for the sake of simplicity for POC. It'll be reworked
back to QML+C++ properly as followup.
2026-05-07 15:32:54 +02:00

56 lines
1.5 KiB
QML

import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
// Scrollable message bubble view for the active conversation.
Item {
id: root
property var messages: [] // array of {from_self, content, timestamp} objects
ListView {
id: list
anchors.fill: parent
anchors.margins: 8
spacing: 6
clip: true
model: root.messages
delegate: Item {
width: list.width
height: bubble.implicitHeight + 8
readonly property bool isSelf: modelData.from_self
Rectangle {
id: bubble
color: isSelf ? "#0078d7" : "#f0f0f0"
radius: 10
width: Math.min(msgText.implicitWidth + 20, list.width * 0.75)
implicitHeight: msgText.implicitHeight + 12
anchors.right: isSelf ? parent.right : undefined
anchors.left: isSelf ? undefined : parent.left
Text {
id: msgText
anchors {
left: parent.left; right: parent.right
top: parent.top; bottom: parent.bottom
margins: 6
}
text: modelData.content
color: isSelf ? "#fff" : "#222"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
font.pixelSize: 14
}
}
}
onCountChanged: positionViewAtEnd()
ScrollBar.vertical: ScrollBar {}
}
}