Qt-interest Archive, January 2007
RE: how to make QT load plugin from your application directory instead of default path
Message 1 in thread
Hi,
Thanks for the help. I tried to set path using appDir/plugins like you say and Qt couldn't load the plugin file. So I tried appDir/accessible and it works on some machines. On some other machine, it says Failed to load library: accessible/qtwidgets100.dll Error code 193. Do you know what can be the possible cause?
Thanks
Thi
-----Original Message-----
From: alexandre.raczynski@technog [mailto:alexandre.raczynski@xxxxxxxxxxxxxx]
Sent: December 20, 2006 10:15 PM
To: qt-interest@xxxxxxxxxxxxx
Subject: Re: how to make QT load plugin from your application directory instead of default path
Thi Nguyen -X (thingu - Aries Technology at Cisco) a écrit :
> hi,
> I created my custom accessible plugin for my application running on
> window. I put it in this directory appDir/plugins/accessible. I also
> tried QApplication::addDirectoryPath("appDir/plugins/accessible") to
> make it load my plugin. Yet, Qt keeps loading the accessible plugin
> from the default path QDIR/plugins/accessible. Can anyone show me how
> to handle this?
> This is qt3.3.4, window platform.
> Thanks
You must not add "appDir/plugins/accessible" but "appDir/plugins".
Qt will check for "accessible" folder and other Qt plugins folders like "imageformats", "codecs", iconengines" and so on...
Here is a quick example how to overwrite library paths to avoid Qt to
look into its installation folder and to load only your Qt plugins:
//--------------------------------------------------------------------------
// Setup library paths to :
// - applicationPath
// - applicationPath/plugins (for Qt plugins)
//--------------------------------------------------------------------------
QStringList l_libPaths;
// Build plugins path
QDir l_pluginsPath(qApp->applicationDirPath());
l_pluginsPath.mkdir("plugins");
l_pluginsPath.cd("plugins");
// Set library paths
l_libPaths << l_pluginsPath.path() << qApp->applicationDirPath();
qApp->setLibraryPaths(l_libPaths);
//--------------------------------------------------------------------------
--
[ signature omitted ]