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