1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-26 04:33:06 +01:00
ScreenPlay/ScreenPlayWidget/main.qml

101 lines
2.2 KiB
QML
Raw Normal View History

2018-03-08 22:03:05 +01:00
import QtQuick 2.9
import net.aimber.screenplaysdk 1.0
2018-03-23 14:49:52 +01:00
import QtQuick.Window 2.3
2018-04-18 18:39:25 +02:00
import QtQuick.Controls 2.3
2018-03-08 22:03:05 +01:00
Window {
id: mainWindow
visible: true
width: 250
2018-03-23 14:49:52 +01:00
height: 250
flags: Qt.SplashScreen | Qt.ToolTip | Qt.SplashScreen
2018-03-08 22:03:05 +01:00
2018-03-21 18:56:58 +01:00
ScreenPlaySDK {
id: spSDK
contentType: "ScreenPlayWindow"
2018-03-23 14:49:52 +01:00
appID: backend.appID
2018-03-21 18:56:58 +01:00
onIncommingMessageError: {
}
onIncommingMessage: {
var obj2 = 'import QtQuick 2.9; Item {Component.onCompleted: sceneLoader.item.'
+ key + ' = ' + value + '; }'
var newObject = Qt.createQmlObject(obj2.toString(), root, "err")
newObject.destroy(10000)
}
onSdkConnected: {
}
onSdkDisconnected: {
2018-03-23 14:49:52 +01:00
Qt.quit()
2018-03-21 18:56:58 +01:00
}
}
Connections {
2018-03-23 14:49:52 +01:00
target: backend
2018-03-21 18:56:58 +01:00
onSetWidgetSource: {
loader.source = Qt.resolvedUrl("file:///" + source)
print(loader.source)
}
}
2018-03-08 22:03:05 +01:00
Loader {
2018-03-21 18:56:58 +01:00
id: loader
2018-03-08 22:03:05 +01:00
anchors.fill: parent
asynchronous: true
2018-03-23 14:49:52 +01:00
onStatusChanged: {
if (loader.status === Loader.Ready) {
}
}
}
2018-04-18 18:39:25 +02:00
Connections{
target: loader.item
ignoreUnknownSignals: true
onSizeChanged:{
print(size)
mainWindow.width = size.width
mainWindow.height = size.height
}
}
2018-03-23 14:49:52 +01:00
MouseArea {
property point clickPos: "1,1"
anchors.fill: parent
2018-04-18 18:39:25 +02:00
acceptedButtons: Qt.LeftButton | Qt.RightButton
2018-03-23 14:49:52 +01:00
z:99
onPressed: {
clickPos = Qt.point(mouse.x, mouse.y)
}
onPositionChanged: {
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
var new_x = mainWindow.x + delta.x
var new_y = mainWindow.y + delta.y
mainWindow.x = new_x
mainWindow.y = new_y
}
2018-04-18 18:39:25 +02:00
onClicked: {
if (mouse.button === Qt.RightButton) {
contextMenu.popup()
}
}
}
Menu {
id: contextMenu
MenuItem {
text: qsTr("Close")
onClicked: {
Qt.quit();
}
}
2018-03-08 22:03:05 +01:00
}
}