Qt Components Hildon  0.20
QML components for Maemo5 with Hildon styling.
 All Classes Functions Properties Groups Pages
Public Slots | Properties | List of all members
ScreenShot Class Reference

Grabs an snapshot from the screen and saves it to a file. More...

Public Slots

bool grab ()
 Takes a screen shot of target, and returns true if the screen shot is successfully saved to fileName.

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.

Detailed Description

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
}
width: parent.width
text: qsTr("Delay")
}
id: spinbox
width: parent.width
minimum: 1
maximum: 20
value: 1
suffix: " " + qsTr("secs")
}
id: pathButton
width: parent.width
text: qsTr("Output folder")
valueText: fileDialog.folder
onClicked: fileDialog.open()
}
Button {
id: screenshotButton
width: parent.width
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.

Property Documentation

int ScreenShot::height
readwrite

The height to be used when scaling the screen shot.

By default, the screen shot is not scaled.

See Also
width, smooth
bool ScreenShot::overwriteExistingFile
readwrite

Whether an existing file will be overwritten when a screen shot is saved.

The default value is false, meaning that the screen shot will be saved to a file with "($NUMBER)" inserted before the file suffix.

bool ScreenShot::smooth
readwrite

Whether smooth scaling should be used when saving the screen shot.

See Also
width, height
object ScreenShot::target
readwrite

The item of which a screen shot will be saved.

The default value is null, meaning the screen shot will be of the entire screen.

int ScreenShot::targetHeight
readwrite

The number of pixels to be grabbed vertically.

The default value is equal to the height of target.

int ScreenShot::targetWidth
readwrite

The number of pixels to be grabbed horizontally.

The default value is equal to the width of target.

int ScreenShot::targetX
readwrite

The x coordinate from where the screen shot will be taken.

The default value is 0.

See Also
targetX
int ScreenShot::targetY
readwrite

The y coordinate from where the screen shot will be taken.

The default value is 0.

See Also
targetY
int ScreenShot::width
readwrite

The width to be used when scaling the screen shot.

By default, the screen shot is not scaled.

See Also
height, smooth