Example:
Rectangle{
id:root
widht:640
height: 480
ToTexture{ id: toTexture} //a new type created by c++
MouseArea{
anchors.fill: parent
onClicked: {
toTexture.saveAsTexture(root) //this function will transfer the root item to texture and save it into QImage
}
}
}
Rectangle{
id:root
widht:640
height: 480
ToTexture{ id: toTexture} //a new type created by c++
MouseArea{
anchors.fill: parent
onClicked: {
toTexture.saveAsTexture(root) //this function will transfer the root item to texture and save it into QImage
}
}
}
To copy to clipboard, switch view to plain text mode
The problem is, how could I design a new type like “ToTexture� The example of “ Scene Graph – OpenGL Under QML.†show us how to render a qml scene, but I can’t find an example show us how to transfer the qml scene to a texture.
Bookmarks