Important: Please read the Qt Code of Conduct -

Qt5 strange QIcon behaviour

  • I'm developing a set of libraries, implementing some common features (like settings dialogs, etc). There's a method, setThemedIconsEnabled, which, well, sets whether to use icons from the system (default) theme, or to search for appropriate icons in some special folders.
    Now, the issue: when themed icons are used, everything is fine, but if I try to use some custom icons, very strange things happen. For example, I click an action in a toolbar, which should add a new document - everything is OK. Then, I click another action, which should execute some dialog - the application crashes. Note, that everything is fine if themed icons are used, so the problem is not caused by the dialog related code. I'm having this issue when using .svgz icons only (the icons are displayed correctly, by the way).
    One more example. When I use .png icons, I'm able to call the dialog, but if I try to open some menu after executing the dialog, the application crashes again. Opening menus before calling the dialog works perfect. And it's not as funny as it may seem to be. Note, that the menus code and the dialog code are absolutely not related.
    I'm having those issues on Linux only (Ubuntu 12.04 32 bit). On Windows XP everything works fine. No crashes either with .png or .svgz icons. So, it seems to me, that it is a Qt bug.
    There are no debug messages, the application just crashes silently. Maybe the Valgring output will be useful:
    ! output)!

  • I've added some missing .png icons (two, to be exact). Now the problem looks like this: everything is OK if I use themed icons or custom .png icons, but the app crashes if I use .svgz icons. (In the second exampe above, the crash definitely was caused by an .svgz icon in the menu)
    So, the problem comes from SVG support module, i think. Any ideas how to fix that?

Log in to reply