The Qt Extended resource system allows application programmers to access common application resources such as images, icons and sounds without having to concern themselves with the exact installation location or file types. The Qt Extended resource system is built on top of the Qt for Embedded Linux resource model.
Rather than accessing resource files directly from disk, applications should use resource syntax inplace of a regular file name. For example, the following lines refer to the same image:
When Qt Extended detects the use of the special ":" prefix, searches in various locations - depending on the resource type - and for various file types to locate the actual resource. In addition to improving the efficiency of reference for the programmer, the Qt Extended resource system improves the efficiency of access for the system. Using a special file, known as a resource database, Qt Extended can bundle many separate images and icons into a single archive that is both quick to access and efficiently shared across processes.
Resource databases are only supported in the Qtopia 4.2 series and later.
The specifics for each resource type are outlined below. Note that the <app name> may also be specified by refering to a service rather than the application which might provide the service - for example "service/Contacts/" rather than "addressbook/".
Images
When requesting an image, applications use a "filename" of the form <path> := :image/[i18n/][<app name>/]<image>. For each search directory listed in the $QTOPIA_PATHS environment variable, the following sub-locations are tried:
pics/<QApplication::applicationName()>/qtopia.rdb#<app name>/<image>
pics/qtopia.rdb#<QApplication::applicationName()>/<app name>/<image>
pics/<app name>/qtopia.rdb#<image>
pics/qtopia.rdb#<app name>/<image>
i18n only: pics/<QApplication::applicationName()>/<app name>/i18n/<language>_<locale>/<image>.<image extension>
i18n only: pics/<app name>/i18n/<language>_<locale>/<image>.<image extension>
i18n only: pics/<QApplication::applicationName()>/<app name>/i18n/<language>/<image>.<image extension>
i18n only: pics/<app name>/i18n/<language>/<image>.<image extension>
i18n only: pics/<QApplication::applicationName()>/<app name>/i18n/en_US/<image>.<image extension>
i18n only: pics/<app name>/i18n/en_US/<image>.<image extension>
pics/<QApplication::applicationName()>/<app name>/<image>.<image extension>
pics/<app name>/<image>.<image extension>
In the listing above, <language> and <locale> correspond to the current language and locale selections. The supported <image extensions> are currently "pic", "svg", "png", "jpg", "mng" and no extension.
For example, in the "addressbook" application
QPixmap pix(":image/email");
More information on image translation can be found in the Internationalization guide.
Themes can override images by specifying an IconPath. See Images and Icons#installing-custom-icons.
See Images and Icons for more information on images in Qtopia.
Icons
When requesting an icon, applications use a "filename" of the form <path> := :icon/[i18n/][<app name>/]<icon>. For each search directory listed in the $QTOPIA_PATHS environment variable, the following sub-locations are tried:
pics/<QApplication::applicationName()>/qtopia.rdb#<app name>/icons/<icon>
pics/qtopia.rdb#<QApplication::applicationName()>/<app name>/icons/<icon>
pics/<app name>/qtopia.rdb#icons/icon
pics/qtopia.rdb#<app name>/icons/icon
pics/<QApplication::applicationName()>/<app name>/icons/i18n/<language>_<locale>/icon.<icon extension>
i18n only: pics/<app name>/icons/i18n/<language>_<locale>/icon.<icon extension>
i18n only: pics/<QApplication::applicationName()>/<app name>/icons/i18n/<language>/icon.<icon extension>
i18n only: pics/<app name>/icons/i18n/<language>/icon.<icon extension>
i18n only: pics/<QApplication::applicationName()>/<app name>/icons/i18n/en_US/icon.<icon extension>
i18n only: pics/<app name>/icons/i18n/en_US/icon.<icon extension>
pics/<QApplication::applicationName()>/icons/<app name>/icon>.<icon extension>
pics/<app name>/icons/<icon>.<icon extension>
If none found, search for :image/[i18n/][<app name>/]<icon> as though the icon was requested as an image
In the listing above, <language> and <locale> correspond to the current language and locale. The supported <icon extensions> are currently "pic", "svg", "png", "jpg", "mng" and no extension.
More information on icon translation can be found in the Internationalization guide.
Themes can override images by specifying an IconPath. See Images and Icons#installing-custom-icons.
See Images and Icons for more information on icons in Qtopia.
Sounds
When requesting a sound, applications use a "filename" of the form <path> := :sound/<sound>. For each search directory listed in the $QTOPIA_PATHS environment variable, the following sub-locations are tried:
sounds/<QApplication::applicationName()>/<sound>.wav
sounds/<sound>.wav