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/12 12:28] mithatqt:icons [2011/05/13 16:47] – [System theme using QIcon::fromTheme()] mithat
Line 96: Line 96:
 }</code> }</code>
  
-If you have more than a handful of such icons, you will probably want to write a [[MainWindow-buildIcon|helper function]] to reduce the repeated data entry.+If you have more than a handful of such icons, you will probably want to write a [[MainWindow-buildIcon|support method]] to reduce the repeated data entry.
  
 ==== Pros ==== ==== Pros ====
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 272: Line 272:
 Note that in the set of icons I drew from, there were no 48x48 icons. To maintain best compatibility with Windows OSes, you ideally should include 48x48 icons as well((See http://msdn.microsoft.com/en-us/library/ms997636.aspx for a discussion of Windows XP icons and http://msdn.microsoft.com/en-us/library/aa511280.aspx for Windows 7.)). Note that in the set of icons I drew from, there were no 48x48 icons. To maintain best compatibility with Windows OSes, you ideally should include 48x48 icons as well((See http://msdn.microsoft.com/en-us/library/ms997636.aspx for a discussion of Windows XP icons and http://msdn.microsoft.com/en-us/library/aa511280.aspx for Windows 7.)).
  
-The pros and cons associated with this approach are essentially identical to [[#Explicitly build and bind icons at runtime]] above, but there is one important difference: you cannot combine this approach with [[#Custom theme using  QIcon::fromTheme()]] because the setting of icon themes is dynamic: the last theme name you set is the theme with which all icons will be rendered. +The pros and cons associated with this approach are essentially identical to [[#Explicitly build and bind icons at runtime]] above, but there is one important difference: you cannot combine this approach with [[#Custom theme using  QIcon::fromTheme()]] because the setting of icon themes is [[MainWindow-setActionIcon|dynamic]]: the last theme name you set is the theme with which all icons will be rendered. 
  
 ==== Code implementation ==== ==== Code implementation ====
qt/icons.txt · Last modified: 2011/05/13 17:01 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki