[PyQt] QLibraryInfo and images

Scott Frankel frankel at circlesfx.com
Tue Oct 13 18:23:02 BST 2009

Hi David,

Thanks for considering my question.

On Oct 5, 2009, at 5:58 PM, David Boddie wrote:

> On Thu, 1 Oct 2009 23:04:49 -0700, Scott Frankel wrote:
>> Can a qt.conf file be used to specify an images directory using the
>> QLibraryInfo.LibraryLocation enum?
> Maybe you could use the Data entry for images:
>  http://doc.trolltech.com/4.5/qt-conf.html

That's exactly what I'd thought, but didn't get positive results.   
Though it could be due to incorrect syntax.  For example, web  
searching turned up the following tip that helped resolve my "cannot  
move to target thread error"
Create a file dist/<application.app>/Contents/Resources/qt.conf
with contents as follows:

Is there an analogous term, qt_plugpath, for data directory  
declarations?  I haven't been able to find a reference to either in  
any of the trolltech/nokia doc pages or the Qt Assistant.  qt_plugpath  
seems to work; but I'd feel more comfortable if I could find an  
official reference to it ;)

>> I wonder if I'm barking up the right tree.  My app displays images
>> that have been compiled as resources (.png, .tif, or .jpg) without
>> issue on Fedora and Windows.  But it doesn't display them on OSX.
>> (Note that I'm using a qt.conf file in my OSX app bundle to locate a
>> plugins dir.)
> So, I guess you're packaging your application along with Qt and PyQt  
> in a
> bundle and I assume that support for images is built as plugins, and  
> I'm
> guessing that some misconfiguration is causing this to fail.

Yes, though I haven't built any of the support for images explicitly.   
Rather I've configured my build machine using macports.  The issues I  
ran into building for OSX (ironically, the OS I'm developing on)  
placed me squarely between three technologies:  Qt/PyQt, py2app, and  
macports.  Finding which of the three was the culprit, or which could  
be used to provide a cure, proved a challenging task.

>> The enum docs (http://doc.trolltech.com/4.4/qlibraryinfo.html) aren't
>> specific about image data and my tests at possible syntax haven't
>> yielded any positive results.
> The QLibraryInfo class and your resource files are two separate  
> things - I
> assume that by "resources" you mean you compiled your image files to  
> Python
> modules using pyrcc4. Is that the case?

Yes, the images are compiled in a .qrc file.

A solution that seems to be working is copying the tiff and jpg  
libraries to the plugin dir after building with py2app.  Once there,  
the qt_plugpath term works its OSX magic.


> David
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

More information about the PyQt mailing list