Monitoring Tool: possibility of nested objects inspection

This commit is contained in:
Michał Cieślak 2024-10-31 23:52:08 +01:00 committed by Michał
parent 27ececad63
commit e3238b3fd2
3 changed files with 128 additions and 119 deletions

View File

@ -5,7 +5,7 @@ import QtQuick.Layouts 1.15
import Monitoring 1.0 import Monitoring 1.0
import StatusQ.Core.Utils 0.1 import StatusQ.Core.Utils 0.1
Pane { Item {
property string name property string name
property var model property var model
readonly property var rootModel: model readonly property var rootModel: model
@ -52,36 +52,6 @@ Pane {
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
RowLayout {
Layout.fillWidth: true
visible: showControls
RoundButton {
text: "⬅️"
onClicked: {
inspectionStackView.pop(StackView.Immediate)
}
}
TextInput {
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
text: name
font.pixelSize: 20
font.bold: true
selectByMouse: true
readOnly: true
}
}
MenuSeparator {
Layout.fillWidth: true
}
Label { Label {
visible: listView.count visible: listView.count

View File

@ -8,9 +8,7 @@ import Qt.labs.settings 1.0
import AppLayouts.Wallet.stores 1.0 as WalletStores import AppLayouts.Wallet.stores 1.0 as WalletStores
Component { Component {
ColumnLayout { ColumnLayout {
spacing: 0 spacing: 0
Settings { Settings {
@ -73,7 +71,7 @@ Component {
implicitHeight: delegateRow.implicitHeight implicitHeight: delegateRow.implicitHeight
readonly property var contextPropertyValue: readonly property var contextPropertyValue:
MonitorUtils.contextPropertyBindingHelper(name, root).value MonitorUtils.contextPropertyBindingHelper(name, this).value
Row { Row {
id: delegateRow id: delegateRow
@ -98,6 +96,7 @@ Component {
onClicked: { onClicked: {
inspectionStackView.clear() inspectionStackView.clear()
headerModel.clear()
const props = { const props = {
name: name, name: name,
@ -105,6 +104,7 @@ Component {
} }
inspectionStackView.push(inspectionList, props) inspectionStackView.push(inspectionList, props)
headerModel.append({ name })
} }
} }
} }
@ -120,12 +120,12 @@ Component {
Component { Component {
id: inspectionList id: inspectionList
Pane { ListView {
id: inspectionPanel
property var objectForInspection property var objectForInspection
property string name property string name
ScrollBar.vertical: ScrollBar {}
onObjectForInspectionChanged: { onObjectForInspectionChanged: {
inspectionModel.clear() inspectionModel.clear()
@ -181,23 +181,7 @@ Component {
inspectionModel.append(items) inspectionModel.append(items)
} }
ColumnLayout {
anchors.fill: parent anchors.fill: parent
anchors.margins: 5
Label {
text: name
font.pixelSize: 20
font.bold: true
}
MenuSeparator {
Layout.fillWidth: true
}
ListView {
Layout.fillWidth: true
Layout.fillHeight: true
spacing: 5 spacing: 5
clip: true clip: true
@ -249,9 +233,7 @@ Component {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
if (!isModel) if (isModel) {
return
const props = { const props = {
name: name, name: name,
model: objectForInspection[name] model: objectForInspection[name]
@ -259,6 +241,16 @@ Component {
inspectionStackView.push(modelInspectionComponent, inspectionStackView.push(modelInspectionComponent,
props, StackView.Immediate) props, StackView.Immediate)
headerModel.append({ name })
} else if (type !== "function") {
const props = {
name: name,
objectForInspection: objectForInspection[name]
}
inspectionStackView.push(inspectionList, props, StackView.Immediate)
headerModel.append({ name })
}
} }
} }
} }
@ -274,14 +266,61 @@ Component {
} }
} }
} }
Pane {
SplitView.fillHeight: true
SplitView.minimumWidth: 100
ColumnLayout {
anchors.fill: parent
RowLayout {
Layout.fillWidth: true
Layout.fillHeight: false
RoundButton {
text: "⬅️"
visible: headerRepeater.count > 1
onClicked: {
inspectionStackView.pop(StackView.Immediate)
headerModel.remove(headerModel.count - 1)
} }
} }
Repeater {
id: headerRepeater
model: ListModel {
id: headerModel
}
delegate: TextInput {
readonly property bool last: headerRepeater.count - 1 === index
text: model.name + (last ? "" : " -> ")
font.pixelSize: 20
font.bold: true
selectByMouse: true
readOnly: true
}
}
}
MenuSeparator {
visible: headerRepeater.count
Layout.fillWidth: true
}
StackView { StackView {
id: inspectionStackView id: inspectionStackView
SplitView.fillHeight: true Layout.fillWidth: true
SplitView.minimumWidth: 100 Layout.fillHeight: true
}
}
} }
} }

View File

@ -1,6 +1,6 @@
pragma Singleton pragma Singleton
import QtQml 2.14 import QtQml 2.15
import Monitoring 1.0 import Monitoring 1.0
@ -39,7 +39,7 @@ QtObject {
function contextPropertyBindingHelper(name, parent) { function contextPropertyBindingHelper(name, parent) {
return Qt.createQmlObject( return Qt.createQmlObject(
`import QtQml 2.14; QtObject { readonly property var value: ${name} }`, `import QtQml 2.15; QtObject { readonly property var value: ${name} }`,
parent, `ctxPropHelperSnippet_${name}`) parent, `ctxPropHelperSnippet_${name}`)
} }
} }