[PyQt] pyqt5qmlplugin

Marcus Ottosson konstruktion at gmail.com
Sun Nov 9 10:54:06 GMT 2014


Hi,

I’m attempting to write a Python plug-in for QML but are having issues in
getting it to work.

   -

   PyQt5 5.3.2/5.3.1
    -

   Qt 5.3.2/5.3.1
    -

   Python 2.7
    -

   Ubuntu 12.04 and Windows 8

Running the Charts example produces the error:

..extending/chapter6-plugins/app.qml:42 module "Charts" is not installed

And writing my own does the same. In fact, I’m having trouble understanding
how the qmldir is able to provide enough information about which class to
use as subclass of QQmlExtensionPlugin.

Here’s the Charts qmldir file.

module Charts
plugin pyqt5qmlplugin

I also tried modifying it to point to the directory with the pyqt5qmlplugin
library.

module Charts
plugin `pyqt5qmlplugin` /home/marcus/Qt/5.3/gcc_64/plugins/PyQt5

If I understand correctly, the pyqt5qmlplugin library is looking for a
Python module with the same name as the module, in this case Charts,
suffixed with “plugin.py”, so “Chartsplugin.py” (is the upper-case relevant
here?) but when inside, how does it find the right class to use? Does it
need to start with the same name as the module (i.e. “Charts”) and end with
“Plugin”?

Is there any other examples of this in action? So far, this is the only
mention of pyqt5qmlplugin I’ve been able to find.

   -
   http://pyqt.sourceforge.net/Docs/PyQt5/qml.html#writing-python-plugins-for-qmlscene

Best,
Marcus
​
-- 
*Marcus Ottosson*
konstruktion at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20141109/017cd0e6/attachment.html>


More information about the PyQt mailing list