question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use QIcon.fromTheme() for icons

See original GitHub issue

like discussed in #950, #2210 advances the icons.

so let’s do it right and use QIcon.fromTheme. we’ll have to simply

  1. put the icons into a freedesktop icon theme spec compatible directory (e.g. like here), and bundle this directory as QResources in ':/icons'.

  2. anywhere we want to use an icon, we just need to do

    QIcon.fromTheme('document-new')
    
  3. 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:

  1. simple to implement
  2. cross platform
  3. native appearance
  4. allows us to let users choose their own icon themes on all platforms (see comment below)!

Issue Analytics

  • State:open
  • Created 9 years ago
  • Reactions:1
  • Comments:34 (30 by maintainers)

github_iconTop GitHub Comments

1reaction
blooaliencommented, Jul 10, 2017

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.

1reaction
flying-sheepcommented, Mar 13, 2015

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found