SmartLockerTools/Analyser/qml/LogView.qml

35 lines
648 B
QML
Raw Permalink Normal View History

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