SmartLockerTools/Analyser/qml/LogView.qml

33 lines
591 B
QML
Raw Normal View History

2024-11-05 00:23:54 +08:00
import QtQuick
ListView {
id: root
model: ListModel {
id: logModel
ListElement {
message: ""
}
}
delegate: Text {
width: ListView.view.width
text: message
wrapMode: Text.Wrap
}
function append(message){
let item = {
message: message
};
logModel.append(item)
if(root.atYEnd){
Qt.callLater(()=>{
root.positionViewAtEnd() })
}
}
function clear(){
logModel.clear()
}
}