[PyQt] Fwd: qrc:/// not working to access resources?

Shriramana Sharma samjnaa at gmail.com
Tue Feb 4 12:46:46 GMT 2014


On Mon, Feb 3, 2014 at 10:09 PM, lloyd konneker <bootch at nc.rr.com> wrote:

> The Qt documentation for C++ does not necessarily explain how PyQt should
> work.  You must interpret, and often ignore, certain parts of the C++
> documentation.
>

We should ignore those parts (about pointers, references etc) which
conflict with Python. The rest is expected to work unless the documentation
says so.


>
> In this case, since the documentation you refer to talks about 'static
> linking' and libraries, it is probably something you should ignore, since
> static linking is a C++ concept and not a Python concept.
>

We import in Python where we would static-link in lower level languages.
This does not preclude the use of qrc:// in filename to access resource
files.

IIUC the resources are still registered with the C++ level Qt system and
not with any Python-level system. And in case of QImage() etc constructor
calls, I would expect PyQt to just convert the Python str to QString and
pass it to the underlying C++ QImage constructor without bias to just how
that string is formatted, which is why it is surprising to me that qrc://
doesn't work. Of course, I should note that I haven't checked the C++ Qt
whether there is a regression that prevents qrc:// from working.


>
> Do you have a use case where you must use 'qrc:///' instead of ':/' ?
>

The use of qrc:// is useful in so far as it helps us identify which images
etc we are loading from resource and which from outside. Thus it would be
preferable (not a "must") to use qrc://.

-- 
Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा



-- 
Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140204/187104f7/attachment.html>


More information about the PyQt mailing list