[Qt-interest] svg plugin not loaded
Andrew Maclean
andrew.amaclean at gmail.com
Fri Dec 4 02:56:38 CET 2009
Sorry my hint didn't help. I don't think I can offer nay other advice.
Andrew
On Fri, Dec 4, 2009 at 10:41 AM, Bryce Allen <qt at bda.ath.cx> wrote:
> Thanks Andrew - unfortunately this has not fixed the problem. I finally
> got QT_DEBUG_PLUGINS=1 to display output (I think using CONFIG +=
> console), and the correct DLLs are found but they fail to load, so the
> problem has nothing to do with paths.
>
> Strangely if I use a debug exe and dlls, and run the exe from cygwin,
> the svg icon plugin loads and the icons show up. In all other
> cases the svg icon plugin fails to load. Specifically qsvgicon4.dll (or
> qsvgicond4.dll for debug).
>
> I use the following code to make sure that the qt directory is not
> used, because I want the app to work on any machine without Qt
> installed:
>
> QStringList pathList;
> pathList.append(qApp->applicationDirPath());
> qApp->setLibraryPaths(pathList);
>
> I copied the executable built by Qt Designer to a separate
> directory, and copied dlls from the qt subdirectory of the
> qt designer install path, eg C:\Qt\2009.05\qt\bin and
> C:\Qt\2009.05\qt\plugins.
>
> >From cygwin using a debug build and debug dlls, which actually works, I
> get this:
>
> QFactoryLoader::QFactoryLoader() looking at
> "C:/.../systray/iconengines/qsvgicond.dll"
> keys ("svg", "svgz", "svg.gz")
>
> When running the same executable from cmd, I get this:
>
> QFactoryLoader::QFactoryLoader() looking at
> "C:/.../systray/iconengines/qsvgicond.dll"
> keys ("svg", "svgz", "svg.gz")
> QFactoryLoader::QFactoryLoader() looking at
> "C:/.../systray/iconengines/qsvgicond.dll"
> "Cannot load library C:/../systray/iconengines/qsvgicond4.dll: The
> specified module could not be found." could not load
>
> Note that the paths to qsvgicond4.dll are the same in both lines. Not
> sure why it is examining the same dll twice, but this happens for the
> other builds also.
>
> When using a release build and release dlls under cmd, I get two
> "The specified module could not be found" errors when it tries to load
> qsvgicon4.dll. Under cygwin I get two "The specified procedure could not
> be found." errors instead.
>
> I am using the LGPL qt creater, version 2009.05 (1.30, qt 4.6.0). I had
> the same problem with 2009.04, although I'm not sure if the
> QT_DEBUG_PLUGIN output is the same since I got that working after
> upgrading to .05.
>
> Any ideas?
>
> Thanks,
> Bryce
>
> On Tue, 1 Dec 2009 15:11:12 +1100
> Andrew Maclean <andrew.amaclean at gmail.com> wrote:
>> Create a directory called plugins/imageformats (in the same directory
>> as your executable) with the svg plugins in it.
>> Then in your code
>>
>> Create a function like this:
>>
>> //! Find and load a translation file.
>> /*!
>> *
>> * @param translator - the translator.
>> */
>> void PluginLoader(QDir & pluginsDir)
>> {
>> // Plugins
>> pluginsDir = QDir(qApp->applicationDirPath());
>>
>> #if defined(Q_OS_WIN)
>> if (pluginsDir.dirName().toLower() == "debug" ||
>> pluginsDir.dirName().toLower() == "release")
>> pluginsDir.cdUp();
>> #elif defined(Q_OS_MAC)
>> if (pluginsDir.dirName() == "MacOS")
>> {
>> pluginsDir.cdUp();
>> pluginsDir.cdUp();
>> pluginsDir.cdUp();
>> }
>> #endif
>> pluginsDir.setPath( pluginsDir.absolutePath() + "/plugins");
>> }
>>
>> and in main:
>> QDir pluginsDir;
>> PluginLoader(pluginsDir);
>> QStringList libPaths;
>> // Append the local plugin path to the qApp library paths
>> if ( pluginsDir.exists() )
>> {
>> libPaths << pluginsDir.absolutePath() << qApp->libraryPaths();
>> qApp->setLibraryPaths(libPaths);
>> }
>>
>>
>> This should append the plugins path to wherever you put it.
>>
>> I hope this helps.
>>
>> Regards
>> Andrew
>>
>>
>> On Tue, Dec 1, 2009 at 10:19 AM, Bryce Allen <qt at bda.ath.cx> wrote:
>> > I am trying to run the systray example on a Windows XP machine
>> > without qt installed by placing the proper DLLs in the application
>> > directory. I built the app with Qt Creater 1.2.1 (qt 4.5.3) and
>> > release build config, and my app dir looks like this:
>> >
>> > systray.exe
>> > QtCore4.dll
>> > QtGui4.dll
>> > QtXml4.dll
>> > iconengines\qsvgicon4.dll
>> > imageformats\qsvg4.dll
>> >
>> > I have read the documentation and some relevant posts in the
>> > archives, and this looks like the correct locations for the dlls.
>> > However when I run the app the svg icons are missing. I tried
>> > setting QT_DEBUG_PLUGINS=1 and running systray.exe from cmd, but no
>> > debug info is displayed.
>> >
>> > I also checked QImageReader::supportedImageFormats() and svg is not
>> > in the list, so it appears that it's really a problem with loading
>> > the svg plugin and not with finding the image data. Any ideas?
>> >
>> > Thanks,
>> > Bryce
>> > _______________________________________________
>> > Qt-interest mailing list
>> > Qt-interest at trolltech.com
>> > http://lists.trolltech.com/mailman/listinfo/qt-interest
>> >
>>
>>
>>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
--
___________________________________________
Andrew J. P. Maclean
Centre for Autonomous Systems
The Rose Street Building J04
The University of Sydney 2006 NSW
AUSTRALIA
Ph: +61 2 9351 3283
Fax: +61 2 9351 7474
URL: http://www.acfr.usyd.edu.au/
___________________________________________
More information about the Qt-interest-old
mailing list