Home · All Classes · All Functions · Overviews

QML Image Element Reference

[Inherits Item]

The Image element allows you to add bitmaps to a scene. More...

Inherited by AnimatedImage.

Properties

Detailed Description

The Image element supports untransformed, stretched and tiled.

For an explanation of stretching and tiling, see the fillMode property description.

Examples:

Untransformed
 Image { source: "pics/qtlogo.png" }

fillMode: Stretch (default)
 Image {
     width: 160
     height: 160
     source: "pics/qtlogo.png"
 }

fillMode: Tile
 Image {
     fillMode: Image.Tile
     width: 160; height: 160
     source: "pics/qtlogo.png"
 }

fillMode: TileVertically
 Image {
     fillMode: Image.TileVertically
     width: 160; height: 160
     source: "pics/qtlogo.png"
 }

fillMode: TileHorizontally
 Image {
     fillMode: Image.TileHorizontally
     width: 160; height: 160
     source: "pics/qtlogo.png"
 }


Property Documentation

asynchronous : bool

Specifies that images on the local filesystem should be loaded asynchronously in a separate thread. The default value is false, causing the user interface thread to block while the image is loaded. Setting asynchronous to true is useful where maintaining a responsive user interface is more desireable than having images immediately visible.

Note that this property is only valid for images read from the local filesystem. Images loaded via a network resource (e.g. HTTP) are always loaded asynchonously.


fillMode : enumeration

Set this property to define what happens when the image set for the item is smaller than the size of the item.


pixmap : QPixmap

This property holds the QPixmap image to display.

This is useful for displaying images provided by a C++ implementation, for example, a model may provide a data role of type QPixmap.


progress : real

This property holds the progress of image loading, from 0.0 (nothing loaded) to 1.0 (finished).

See also status.


smooth : bool

Set this property if you want the image to be smoothly filtered when scaled or transformed. Smooth filtering gives better visual quality, but is slower. If the image is displayed at its natural size, this property has no visual or performance effect.

Note: Generally scaling artifacts are only visible if the image is stationary on the screen. A common pattern when animating an image is to disable smooth filtering at the beginning of the animation and reenable it at the conclusion.


source : url

Image can handle any image format supported by Qt, loaded from any URL scheme supported by Qt.

The URL may be absolute, or relative to the URL of the component.


status : enum

This property holds the status of image loading. It can be one of:

See also progress.



Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt 4.7.0