Added plugin object to qml context

This commit is contained in:
2025-03-10 12:04:23 +01:00
parent 4c4d85a78d
commit a170490cbb
6 changed files with 99 additions and 40 deletions

View File

@ -1,12 +1,15 @@
import QtQuick 2.3
import LineItem 1.0
import DemoPlugin 1.0
Rectangle {
id: rr
color: "gray"
property var scale: 0.4
Flickable {
width: parent.width;
height: parent.height
contentWidth: 2500*4; contentHeight: 1500*4
contentWidth: 3000*rr.scale; contentHeight: 2000*rr.scale
flickDeceleration: 10000
leftMargin: Math.max((width - contentWidth)/2,0)
topMargin: Math.max((height - contentHeight)/2,0)
@ -17,36 +20,21 @@ Rectangle {
id: contentRect
anchors.top: parent.top
anchors.left: parent.left
width: parent.width/4
height: parent.height/4
width: parent.width/rr.scale
height: parent.height/rr.scale
transform: Scale {yScale: 4; xScale: 4}
transform: Scale {yScale: rr.scale; xScale: rr.scale}
transformOrigin: Item.TopLeft
Row {
x:0
y:0
spacing: 4
Rectangle {
height: 100
width: 100
color: "green"
Text {
text: "Hello, World!"
}
}
Rectangle {
height: 100
width: 100
color: "red"
Text {
text: "Hello, World!"
}
}
LineItem {
height: 100
width: 100
height: 2000
width: 3000
scale: rr.scale
handler: DemoPlug.demoPlugin
}
}
}