Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
visual.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
/*!
4
\page qtquick-usecase-visual.html
5
\title Visual types
6
\keyword Use Case - Visual Elements In QML
7
\brief Example of how to display visual item types in a QML application
8
9
\section1 The Rectangle type
10
11
For the most basic of visuals, \l {Qt Quick} provides a \l Rectangle type to
12
draw rectangles. These rectangles can be colored with a color or a vertical
13
gradient. The \l Rectangle type can also draw borders on the rectangle.
14
15
For drawing custom shapes beyond rectangles, see the \l Canvas type or display
16
a pre-rendered image using the \l Image type.
17
18
\snippet qmlapp/usecases/visual-rects.qml 0
19
\image qmlapp/qml-uses-visual-rectangles.png
20
21
\section1 The Image type
22
23
\l {Qt Quick} provides an \l Image type which may be used to display images.
24
The \l Image type has a \l {Image::}{source} property whose value can be a
25
remote or local URL, or the URL of an image file embedded in a compiled
26
resource file.
27
28
\snippet qmlapp/usecases/visual.qml image
29
30
For more complex images there are other types similar to \l Image.
31
\l BorderImage draws an image with grid scaling, suitable for images used as
32
borders. \l AnimatedImage plays animated .gif and .mng images. \l AnimatedSprite
33
and \l SpriteSequence play animations comprised of multiple frames stored
34
adjacently in a non-animated image format.
35
36
For displaying video files and camera data, see the
37
\l {qtmultimedia-index.html}{Qt Multimedia} module.
38
39
\section1 Shared Visual Properties
40
41
All visual items provided by \l {Qt Quick} are based on the Item type, which
42
provides a common set of attributes for visual items, including opacity and
43
transform attributes.
44
45
\section2 Opacity and Visibility
46
47
The QML object types provided by Qt Quick have built-in support for
48
\l{Item::opacity}{opacity}. Opacity can be animated to allow smooth transitions
49
to or from a transparent state. Visibility can also be managed with the
50
\l{Item::visible}{visible} property more efficiently, but at the cost of not
51
being able to animate it.
52
53
\snippet qmlapp/usecases/visual-opacity.qml 0
54
\image qmlapp/qml-uses-visual-opacity.png
55
56
\section2 Transforms
57
58
Qt Quick types have built-in support for transformations. If you wish to have
59
your visual content rotated or scaled, you can set the \l Item::rotation or
60
\l Item::scale property. These can also be animated.
61
62
\snippet qmlapp/usecases/visual-transforms.qml 0
63
\image qmlapp/qml-uses-visual-transforms.png
64
65
For more complex transformations, see the \l Item::transform property.
66
67
*/
qtdeclarative
src
quick
doc
src
getting-started
visual.qdoc
Generated on
for Qt by
1.14.0