-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Change the code that is quoted so that the indenting looks sane - Make it possible to copy and run the first snippet without modification - Make it easier to copy and run the second snippet without modification - Move itemGrab.qml to item sub-directory - Generally tidy up Pick-to: 6.2 6.4 6.5 Change-Id: I608b7a6025b9866c14b84420ae64827965a7519f Reviewed-by: Paul Wicking <paul.wicking@qt.io>
- Loading branch information
1 parent
6de2397
commit f0f9bac
Showing
3 changed files
with
44 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (C) 2014 Jolla Ltd, author: <gunnar.sletta@jollamobile.com> | ||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause | ||
|
||
import QtQuick 2.4 | ||
|
||
Item { | ||
width: 320 | ||
height: 480 | ||
|
||
//! [grab-to-file] | ||
Rectangle { | ||
id: sourceRectangle | ||
width: 100 | ||
height: 100 | ||
gradient: Gradient { | ||
GradientStop { position: 0; color: "steelblue" } | ||
GradientStop { position: 1; color: "black" } | ||
} | ||
|
||
Component.onCompleted: { | ||
sourceRectangle.grabToImage(function(result) { | ||
result.saveToFile("something.png") | ||
}) | ||
} | ||
} | ||
//! [grab-to-file] | ||
|
||
//! [grab-to-image] | ||
Image { | ||
id: image | ||
} | ||
|
||
Component.onCompleted: { | ||
sourceRectangle.grabToImage(function(result) { | ||
image.source = result.url | ||
}, Qt.size(50, 50)) | ||
} | ||
//! [grab-to-image] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters