How to Grab Image and Show in next Slide?
Solved
QML and Qt Quick
-
I want to take a screenshot and show it in next stack view slide, I do this the image is save but not showing in other page, How can I fix it?
SecondPage.qml:
Button { id: button x: 613 y: 628 text: qsTr("click me!") background: Rectangle { radius: 20 color: "red" } onClicked:{ chartPage.grabToImage(function(result) { screenshoot.source = result.url; result.saveToFile("test.png"); console.log("file has been saved"); }, Qt.size(chartPage.width, chartPage.height)); stackView.push(["qrc:/ThirdPage.qml"]) } }
ThirdPage.qml:
Page { width: Screen.width height: Screen.height visible: true property alias screenshoot: screenshoot Image { id: screenshoot } }
-
try something like this:
Page { property alias url: screenshoot.source Image { id: screenshoot Component.onCompleted: console.debug("my source is:", source) } }
// pass url als property to the pushed view stackView.push( "qrc:/ThirdPage.qml", {"url" : "your/image/url"} )