| Home · All Classes · Grouped Classes · Annotated · Functions |
Qtopia can be configured with image codecs builtin, or extened via plugins (QImageIOPlugin). Standard Qtopia configurations include support for PNG, JPEG, SVG image formats.
SVG images are preferred wherever resolution independence is desirable. Almost all images shipped with Qtopia are SVG images since Qtopia runs on a large variety of displays with different resolutions and physical sizes.
Images are normally located in the pics/<appname> directory.
To load an image within Qtopia, use the :image reference, for example to load the foo image:
QImage image(":image/foo").
Icons are a special type of image. They are often required at different (standard) sizes and in different states (enabled vs. disabled). QIcon takes care of loading, scaling and any necessary post-processing of the image. Qtopia also caches rendered icons of standard sizes in the global cache. A standard icon size is one of QStyle::PM_SmallIconSize, QStyle::PM_LargeIconSize, QStyle::PM_ListViewIconSize.
It is recommended that icons be used for standard Qtopia widgets, e.g. QPushButton, QListView, QAction, etc. The Qt API encourages this usage by requiring QIcon parameters, rather than QImage or QPixmap.
In the Qtopia source, SVG icons are located in the pics/icons/scalable/ or pics/<appname>/icons/scalable/ directories. The scalable part of the path is stripped out during installation, so they appear in, e.g. /opt/Qtopia/pics/icons/ on the device.
Standard raster images are placed in pics/icons/<SxS>/ or pics/<appname>/icons/<SxS>/ where <SxS> is the size of the image, e.g. 16x16, 22x22. The size installed is determined by the -iconsize configure parameter.
When installing icons the installation process will first look for an SVG image, then an image of the size specified, and finally scale down a larger image to the desired size. Note that a smaller image will never be scaled up. For example, consider the following files in the source directory:
pics/icons/22x22/foo.png
pics/icons/22x22/bar.png
pics/icons/scalable/bar.svg
If Qtopia is configured with -iconsize 16 the installed image will have:
pics/icons/foo.png
pics/icons/bar.svg
where foo.png is 16x16 pixels in size.
To load an icon within Qtopia, use the :icon reference, for example to load the bar icon:
QIcon icon(":icon/bar").
See also File System Standards, QIcon, and QImage.
| Copyright © 2007 Trolltech | Trademarks | Qtopia 4.2.5 |