PDA

View Full Version : Deploying a Qt app



drave
15th June 2010, 15:42
Err ! How ?

I have an app in "c:\Program Files\MyApp" with all the qt dll's and plugins in subdirectors below that.

I created a qt.conf with
[Paths]
Prefix = c:\Program Files\MyApp

and put that in my app directory, but this not picked up. QT insists that plugins should be where they are on my dev machine ie. "c:\Qt\2010.02.1\qt"

whats the problem?

thanks

tbscope
15th June 2010, 17:28
Here's your problem:

Prefix = c:\Program Files\MyApp

But I don't know how you can solve it, after looking in the documentation, it doesn't say how you can escape spaces.
Did you try putting the path between quotes?

squidge
15th June 2010, 18:41
I find you can use quotes and that you need to double up on the slashes, but I've not actually tried with spaces.

eg.


[Paths]
Prefix = "c:\\Qt\\2009.03-vstudio-static\\qt\\"


(Without the double slashing, it seems to concat all the seperate path parts together)

drave
15th June 2010, 19:21
well i tried that but it still didnt work (double backslash and quotes)

ive now found the "qApp->addLibraryPath" call which seems to do the trick, but the qt.conf way would be better

sirius
15th June 2010, 21:06
From the QDir doc:
Qt uses "/" as a universal directory separator in the same way that "/" is used as a path separator in URLs. If you always use "/" as a directory separator, Qt will translate your paths to conform to the underlying operating system.

Maybe this applies to qt.conf too? Try
Prefix = c:/Program Files/MyApp or
Prefix = "c:/Program Files/MyApp"

sirius
15th June 2010, 21:14
Btw, have you read doc:qt-conf.html?


On Windows and X11, the Prefix is relative to the directory containing the application executable (QCoreApplication::applicationDirPath()). On Mac OS X, the Prefix is relative to the Contents in the application bundle. For example, application.app/Contents/plugins/ is the default location for loading Qt plugins.

When I deploy applications on Windows I put the Qt DLLs in the same directory as the app, and the plugin DLLs in a subfolder called plugins. No qt.conf needed. How's your directory structure?

drave
21st June 2010, 17:35
Hi apologies for the delay but i had to be away, anyway ....

My current setup has exe,dlls and qt.conf in "c:\myapp" with a subfolder called plugins,as you say. if i do not use qt.conf (i previously had a stupid syntax error) or qApp->addLibraryPath then the app cannot find the sqlite driver in plugins\sqldrivers and
QLibraryInfo::location(QLibraryInfo::PrefixPath) has a value of "c:\qt\2010\qt"
QLibraryInfo::location(QLibraryInfo::PluginsPath) has a value of "c:\qt\2010\qt\plugins"

how do you get away without a qt.conf ?

squidge
21st June 2010, 17:52
By default the plugins path is just "Plugins". So the Plugins directory is a sub-dir of wherever the application is and so a qt.conf is not required.

Unless you modified the default when you rebuilt the library.

Regardless, you can always use something like setLibraryPaths() (or addLibraryPath())