Use QIcon.fromTheme() for icons
See original GitHub issuelike discussed in #950, #2210 advances the icons.
so let’s do it right and use QIcon.fromTheme
. we’ll have to simply
-
put the icons into a freedesktop icon theme spec compatible directory (e.g. like here), and bundle this directory as QResources in
':/icons'
. -
anywhere we want to use an icon, we just need to do
QIcon.fromTheme('document-new')
-
if we carefully choose the icon names to be compatible with linux standard names (e.g. aforementioned
document-new
), it’ll automatically use system icons on linux
this is the best of all worlds:
- simple to implement
- cross platform
- native appearance
- allows us to let users choose their own icon themes on all platforms (see comment below)!
Issue Analytics
- State:
- Created 9 years ago
- Reactions:1
- Comments:34 (30 by maintainers)
Top Results From Across the Web
QIcon Class | Qt GUI 6.4.1
The simplest use of QIcon is to create one from a QPixmap file or ... Using fromTheme() is necessary if you plan on...
Read more >Qt Application use icon from user icon theme in Linux
Qt follows this spec in its implementation, and as mentioned by @eyllanesc QIcon::fromTheme() static method can be used to lookup needed ...
Read more >Using Qt's built-in icons in PyQt & PySide - Python GUIs
If you're not using designer, you can set icons from a theme in your code using the following. python icon = QtGui.QIcon.fromTheme("document-new ...
Read more >Qt 4.8: QIcon Class Reference
QIcon, fromTheme ( const QString & name, const QIcon & fallback = QIcon() ) ... By using custom icon engines, you can customize...
Read more >QIcon::fromTheme uses GTK+'s icon cache in Qt 5.7 - Woboq
This implies a lot of stat() calls on the hard drive. Icon Theme Cache. For the above reasons, desktop environments have been using...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Right on. I’ll leave it installed for easy updates until I can see the icons on the toolbar. Greatly looking forward to using Spyder again. Other than this one appearance issue (which honestly made no sense to me that it was even a problem), it’s by far one of the better Python IDEs in existence.
good points, but i disagree about performance:
Qt renders the SVG icons once for every used size, and caches them. that hardly makes any impact.
also the restrictiveness with one color isn’t a good thing. when you look at the (sparingly used) color in the breeze icon set, you’ll see that it draws attention to the right things and is an improvement in terms of usability (especially for users over the age of 25) and distinction.
i’d rather have all people use it efficiently after 25ms more loading time than older users having to frustratingly search icons all the time.
could you please point me to the bug report about Qt4 having problems with SVG? and how that relates to different platforms?