Details
-
Bug
-
Resolution: Won't Do
-
P2: Important
-
None
-
5.0.0
Description
Currently in Qt5 there is no way how to set a path to a platform plugin in a
portable way for a deployment environment - due to restriction that platform plugin needs to be found already during creation of QApplication object.
Proposed solution is:
static void init() { QString plugindir; #ifdef Q_OS_MAC plugindir=QCoreApplication::applicationDirPath()+"/../../Plug-Ins"; // MyApp.app/Contents/MacOS/../../Plug-Ins #elif defined Q_OS_WIN plugindir=QCoreApplication::applicationDirPath()+"\\plugins"; // MyApp\bin\plugins #elif defined Q_OS_LINUX plugindir=QCoreApplicaton::applicationDirPath()+"/../plugins"; // MyApp/plugins #endif putenv( "QT_PLUGIN_PATH", plugindir ); } int main(int argc, char *argv[] ) { init(); QApplication a(argc, argv); …. }
If someone moves the whole application structure (Mac OS bundle for example), then plugin path still would be resolved correctly.
This would require QCoreApplication::applicationDirPath() to be truly static. Currently it depends on QCoreApplication instance. Its easy to remove that requirement in applicationDirPath() and applicationFilePath() [which is called by applicationDirPath() ].
The issue is that we can't remove dependency to "self" in QCoreApplication::arguments(), which is called from applicationFilePath() (for blackberry and Q_OS_UNIX). It would be possible to make it truly static
for Mac, Win, Linux.
Attachments
Issue Links
- is duplicated by
-
QTBUG-29503 OSX: QGuiApplication fails to find system plugin (cocoa) if frameworks were deployed with macdeployqt
- Closed
- relates to
-
QTBUG-14150 Relocatable Qt project
- Closed
-
QTBUG-15234 Qt hard-codes paths in libraries/binaries
- Closed