add simple log view.
Some checks failed
Build Applications / PullDocker (push) Successful in 3s
Build Applications / Build (push) Failing after 26s
Windows CI / build (push) Failing after 52s

This commit is contained in:
amass 2024-11-05 00:23:54 +08:00
parent 36c0a0226a
commit 8fa26363b7
3 changed files with 38 additions and 1 deletions

View File

@ -35,6 +35,7 @@ qt_add_qml_module(Analyser
resources/successfull.svg
resources/warning.svg
resources/palm-middle.png
QML_FILES qml/LogView.qml
)
target_compile_definitions(Analyser

32
Analyser/qml/LogView.qml Normal file
View File

@ -0,0 +1,32 @@
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()
}
}

View File

@ -53,7 +53,11 @@ Window {
source: "qrc:/qt/qml/Analyser/resources/palm-middle.png"
}
}
Item {
Item {
// LogView {
// id: logBrowser
// anchors.fill: parent
// }
ScrollView {
id: view
anchors.fill: parent