aboutsummaryrefslogtreecommitdiffstats
path: root/jetting-interface/DebugConsole.qml
blob: 9a5a9ffff73d7429a5ea7b8802cac0edc8206aa0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
pragma ComponentBehavior: Bound

import QtQuick
import QtQuick.Controls

Rectangle {
    id: debugRoot

    function appendLog(msg: string): void {
        let ts = new Date().toLocaleTimeString(Qt.locale(), "HH:mm:ss.zzz");
        debugLog.text += "[" + ts + "] " + msg + "\n";
        debugLog.cursorPosition = debugLog.text.length;
    }

    border.color: "#444"
    color: "#1e1e1e"
    radius: 4

    ScrollView {
        anchors.fill: parent
        anchors.margins: 4

        TextArea {
            id: debugLog

            background: null
            color: "#cccccc"
            font.family: "monospace"
            font.pointSize: 9
            readOnly: true
            wrapMode: TextEdit.Wrap
        }
    }
}