QT: Successful portable app with SVG icons


Permalink 02:25:21 pm, by mholmes, 284 words, 2462 views   English (CA)
Categories: Activity log; Mins. worked: 180

QT: Successful portable app with SVG icons

Finally figured out how to get a Windows executable compiled on one Windows machine to run correctly (with SVG icons) on another Windows VM without QT installed. Here are the steps:

  • Build for release, and take the exe in the release folder of the project.
  • Copy the following files from c:\Qt\[release_date]\qt\bin\ (NOT the \bin\ which is one folder further up the tree):
    • mingwm10.dll
    • QtCore4.dll
    • QtGui4.dll
    • QtSvg4.dll
    into the same folder as the executable. (Make sure you don't get the versions with "d" included; these are the debug versions.) You may need other dlls depending on what you're using.
  • Take the \plugins\imageformats folder from the same location, and copy it into a \plugins\ folder alongside the executable. (This is all that's needed for my simple SVG test app; you may need other plugins too.)
  • Create a text file called qt.conf in the same folder as the executable, and put this in it:
    Plugins = plugins/
    This tells the QT code to look for plugins in this subfolder of the main app. Otherwise it will look for a full QT installation on the target machine, and not find it. Plugins seem to be late-binding, and the app is able to fail gracefully (by not displaying SVG icons) if it can't find the plugins.

This works for an exe compiled on 64-bit Windows 7 or on 32-bit Windows XP, running on a separate 32-bit XP system.

I now have a clean XP VM provided by Greg, with only QT on it, for this kind of task. Now I need to see if I can make a Linux app portable in the same way; then it's Mac time.


No Pingbacks for this post yet...

Professional Development

This blog is used to record research and learning we do which is not part of a specific project, such as learning a new programming language in anticipation of using it for future projects, or installing and testing development tools that may be useful.


XML Feeds