User Tools

Site Tools


qt:icons

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
qt:icons [2011/05/13 11:38] – [Creating a Qt Resource for the theme] mithatqt:icons [2011/05/13 16:50] – [Caveat] mithat
Line 142: Line 142:
 On X11 systems, Qt lets you access all the icons that are part of the system icon theme using the static function ''QIcon::fromTheme()''((http://doc.qt.nokia.com/4.7/qicon.html#fromTheme)). Icons so accessed will be selected as needed based on the required rendering size. On X11 systems, Qt lets you access all the icons that are part of the system icon theme using the static function ''QIcon::fromTheme()''((http://doc.qt.nokia.com/4.7/qicon.html#fromTheme)). Icons so accessed will be selected as needed based on the required rendering size.
  
-As was the case with QStyle's standardIcon() function, implementation with QIcon::fromTheme() requires a bit of hand-coding.+As was the case with QStyle'''standardIcon()'' function, implementation with ''QIcon::fromTheme()'' requires a bit of hand-coding.
  
 ==== Code implementation ==== ==== Code implementation ====
Line 199: Line 199:
  
 ==== Caveat ==== ==== Caveat ====
-QIcon's determination of the system icon theme is at the time of this writing not reliable under Linux -- at least not under Openbox; GNOME and Xfce are yet to be tested. A possible workaround is to use as yet undefined ''HeroicMeasures()''™ to suss out the actual icon theme and then set it((http://doc.qt.nokia.com/4.7/qicon.html#setThemeName, http://doc.qt.nokia.com/4.7/qicon.html#themeName)) in the constructor:+QIcon's determination of the system icon theme is at the time of this writing not reliable under Linux -- at least not under Xfce, Openbox, Fluxbox, and IceWM; GNOME seems to work as expected((http://bugreports.qt.nokia.com/browse/QTBUG-19268)). A possible workaround is to use as yet undefined ''HeroicMeasures()''™ to suss out the actual icon theme and then set it((http://doc.qt.nokia.com/4.7/qicon.html#setThemeName, http://doc.qt.nokia.com/4.7/qicon.html#themeName)) in the constructor:
 <code cpp-qt> <code cpp-qt>
 QString iconTheme = My::HeroicMeasures(); QString iconTheme = My::HeroicMeasures();
 QIcon::setThemeName(iconTheme);</code> QIcon::setThemeName(iconTheme);</code>
  
 +Until such ''HeroicMeasures()''™ are worked out or the bug is fixed, this method can't really be recommended.
 ===== Custom theme using  QIcon::fromTheme() ===== ===== Custom theme using  QIcon::fromTheme() =====
  
qt/icons.txt · Last modified: 2011/05/13 17:01 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki