wwWidgets Home · All Classes · Main Classes · Grouped Classes · Functions

Use of icons

Icon themes

Since version 4.6 of Qt it is possible to use standard (according to freedesktop.org) themes for icons. When supported, wwWidgets tries to pick up appropriate icons from the icon theme before using custom icons. Therefore it is possible to substitute most icons in the set by using an own icon theme.

On systems where icon themes are preinstalled (i.e. Linux) - usually in /usr/share/icons, everything works out of the box. On other systems (i.e. Windows) to use icon themes it is required that an icon theme is installed in the system and the path to the theme is set using QIcon::setThemeSearchPaths() static call. To use another theme, QIcon::setThemeName() can be used.

Qt provides a fallback mechanism that allows to embed icon themes directly in the application binary by placing the theme under the :/icons resource directory. More information on icon themes can be found in Qt documentation and standards.freedesktop.org.

 int main(int argc, char **argv){
   QApplication app(argc, argv);
   QStringList iconThemes;
   iconThemes << QApplication::applicationDirPath()+"/icons";
   QIcon::setThemeSearchPaths(iconThemes);
   QwwFileChooser chooser;
   chooser.show();
   return app.exec();
 }


Copyright © 2007-2010 Witold Wysota Trademarks
wwWidgets 1.0.0