File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed
Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import QtQuick.Layouts
55import QtQuick.Controls
66import ScratchCPP.Render
77
8+ import "internal"
9+
810ProjectScene {
911 property string fileName
1012 property int stageWidth: 480
@@ -64,6 +66,21 @@ ProjectScene {
6466 else
6567 clones .model .remove (i);
6668 }
69+
70+ onMonitorAdded : (monitorModel )=> monitors .model .append ({" monitorModel" : monitorModel})
71+
72+ onMonitorRemoved : (monitorModel )=> {
73+ // TODO: Removing the monitor from C++ would probably be faster
74+ let i;
75+
76+ for (i = 0 ; i < monitors .model .count ; i++ ) {
77+ if (monitors .model .get (i).monitorModel === monitorModel)
78+ break ;
79+ }
80+
81+ if (i !== monitors .model .count )
82+ monitors .model .remove (i);
83+ }
6784 }
6885
6986 function start () {
@@ -130,6 +147,35 @@ ProjectScene {
130147 onMouseReleased: root .handleMouseRelease ()
131148 }
132149
150+ Component {
151+ id: renderedValueMonitor
152+
153+ ValueMonitor {
154+ model: parent .model
155+ scale: root .stageScale
156+ transformOrigin: Item .TopLeft
157+ x: model .x * scale
158+ y: model .y * scale
159+ }
160+ }
161+
162+ Component {
163+ id: renderedMonitor
164+
165+ Loader {
166+ readonly property MonitorModel model: monitorModel
167+ sourceComponent: monitorModel ? (monitorModel .type === MonitorModel .Value ? renderedValueMonitor : null ) : null
168+ active: sourceComponent != null
169+ z: loader .sprites .length + loader .clones .length + 1 // above all sprites
170+ }
171+ }
172+
173+ Repeater {
174+ id: monitors
175+ model: ListModel {}
176+ delegate: renderedMonitor
177+ }
178+
133179 Loader {
134180 anchors .fill : parent
135181 active: showLoadingProgress && loading
You can’t perform that action at this time.
0 commit comments