Properties |
|
string | fileName |
| | The file to which the screen shot will be saved.
|
| int | height |
| | The height to be used when scaling the screen shot.
|
| bool | overwriteExistingFile |
| | Whether an existing file will be overwritten when a screen shot is saved.
|
| bool | smooth |
| | Whether smooth scaling should be used when saving the screen shot.
|
| object | target |
| | The item of which a screen shot will be saved.
|
| int | targetHeight |
| | The number of pixels to be grabbed vertically.
|
| int | targetWidth |
| | The number of pixels to be grabbed horizontally.
|
| int | targetX |
| | The x coordinate from where the screen shot will be taken.
|
| int | targetY |
| | The y coordinate from where the screen shot will be taken.
|
| int | width |
| | The width to be used when scaling the screen shot.
|
Grabs an snapshot from the screen and saves it to a file.
import QtQuick 1.0
import org.hildon.components 1.0
import org.hildon.utils 1.0
Window {
id: window
title: qsTr("ScreenShot Example")
visible: true
Column {
id: column
anchors {
left: parent.left
right: parent.right
top: parent.top
}
text: qsTr("Delay")
}
id: spinbox
minimum: 1
maximum: 20
value: 1
suffix: " " + qsTr("secs")
}
id: pathButton
text: qsTr("Output folder")
valueText: fileDialog.folder
onClicked: fileDialog.open()
}
Button {
id: screenshotButton
text: qsTr("Take screenshot")
onClicked: timer.start()
}
}
id: fileDialog
}
Timer {
id: timer
interval: spinbox.value * 1000
onTriggered: screenshot.grab()
}
id: screenshot
fileName: fileDialog.folder +
"/screenshot.png"
}
}
- Examples:
- screenshot.qml.