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 StatusQ.Core.Utils 0.1
Pane {
Item {
property string name
property var model
readonly property var rootModel: model
@ -52,36 +52,6 @@ Pane {
ColumnLayout {
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 {
visible: listView.count

View File

@ -8,9 +8,7 @@ import Qt.labs.settings 1.0
import AppLayouts.Wallet.stores 1.0 as WalletStores
Component {
ColumnLayout {
spacing: 0
Settings {
@ -73,7 +71,7 @@ Component {
implicitHeight: delegateRow.implicitHeight
readonly property var contextPropertyValue:
MonitorUtils.contextPropertyBindingHelper(name, root).value
MonitorUtils.contextPropertyBindingHelper(name, this).value
Row {
id: delegateRow
@ -98,6 +96,7 @@ Component {
onClicked: {
inspectionStackView.clear()
headerModel.clear()
const props = {
name: name,
@ -105,6 +104,7 @@ Component {
}
inspectionStackView.push(inspectionList, props)
headerModel.append({ name })
}
}
}
@ -120,12 +120,12 @@ Component {
Component {
id: inspectionList
Pane {
id: inspectionPanel
ListView {
property var objectForInspection
property string name
ScrollBar.vertical: ScrollBar {}
onObjectForInspectionChanged: {
inspectionModel.clear()
@ -181,23 +181,7 @@ Component {
inspectionModel.append(items)
}
ColumnLayout {
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
clip: true
@ -249,9 +233,7 @@ Component {
anchors.fill: parent
onClicked: {
if (!isModel)
return
if (isModel) {
const props = {
name: name,
model: objectForInspection[name]
@ -259,6 +241,16 @@ Component {
inspectionStackView.push(modelInspectionComponent,
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 {
id: inspectionStackView
SplitView.fillHeight: true
SplitView.minimumWidth: 100
Layout.fillWidth: true
Layout.fillHeight: true
}
}
}
}

View File

@ -1,6 +1,6 @@
pragma Singleton
import QtQml 2.14
import QtQml 2.15
import Monitoring 1.0
@ -39,7 +39,7 @@ QtObject {
function contextPropertyBindingHelper(name, parent) {
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}`)
}
}