Skip to content

Commit bff0d43

Browse files
committed
examples: update integrated example
1 parent 95784ba commit bff0d43

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

examples/integrated/live.qml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import QtQuick 2.9
2+
import QtQuick.Controls 2.2
3+
import QtQuick.Layouts 1.3
4+
import QtQuick.Window 2.0
5+
import Qt.labs.settings 1.0
6+
import livecoding 1.0
7+
8+
ApplicationWindow {
9+
id: root
10+
visible: true
11+
title: qsTr("My AppLive Coding")
12+
width: 1024
13+
height: 800
14+
flags: liveCoding.flags
15+
visibility: liveCoding.visibility
16+
17+
Component.onCompleted: {
18+
for (var i = 0; i < Qt.application.screens.length; ++i) {
19+
let screen = Qt.application.screens[i]
20+
if (screen.serialNumber === windowSettings.screen) {
21+
root.screen = screen
22+
return
23+
}
24+
}
25+
}
26+
27+
Component.onDestruction: {
28+
windowSettings.screen = root.screen.serialNumber
29+
}
30+
31+
LiveCodingPanel {
32+
id: liveCoding
33+
anchors.fill: parent
34+
}
35+
36+
Settings {
37+
id: windowSettings
38+
category: "window"
39+
property alias width: root.width
40+
property alias height: root.height
41+
property alias x: root.x
42+
property alias y: root.y
43+
property alias visibility: liveCoding.visibility
44+
property alias flags: liveCoding.flags
45+
property alias hideToolBar: liveCoding.hideToolBar
46+
property string screen: ""
47+
}
48+
}

examples/integrated/main.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ def __init__(self, live, parent=None):
2020
self._engine = QQmlApplicationEngine()
2121
self._engine.addImportPath(PROJECT_PATH)
2222
if live:
23-
start_livecoding_gui(self._engine, PROJECT_PATH, __file__)
23+
start_livecoding_gui(
24+
self._engine, PROJECT_PATH, __file__, live_qml='./live.qml'
25+
) # live_qml is optional and can be used to customize the live coding environment
2426
else:
2527
qml_main = os.path.join(PROJECT_PATH, 'main.qml')
2628
self._engine.load(qml_main)

0 commit comments

Comments
 (0)