diff --git a/Analyser/CMakeLists.txt b/Analyser/CMakeLists.txt index c762a7b..66c7783 100644 --- a/Analyser/CMakeLists.txt +++ b/Analyser/CMakeLists.txt @@ -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 diff --git a/Analyser/qml/LogView.qml b/Analyser/qml/LogView.qml new file mode 100644 index 0000000..9bbafa4 --- /dev/null +++ b/Analyser/qml/LogView.qml @@ -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() + } +} diff --git a/Analyser/qml/Main.qml b/Analyser/qml/Main.qml index 37a4627..521ebd2 100644 --- a/Analyser/qml/Main.qml +++ b/Analyser/qml/Main.qml @@ -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