QT: Successful portable app with SVG icons
Posted by mholmes on 26 Nov 2009 in Activity log
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
- 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:[Paths] 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.
This entry was posted by Martin and filed under Activity log.