qtqmlqtquick2snapshotapplication-design

Taking snapshot of a QML view


I want to take the snapshot of a QML view and save it somewhere on the disk.

Is this possible?

For simplicity, assume the view is a Calendar

    Calendar
    {
        id: calendar
        anchors.fill: parent
    }

Solution

  • Yes, it is quite easy:

    calendar.grabToImage(function(result) { result.saveToFile("something.png") });