[PyQt] pyqt5qmlplugin

Phil Thompson phil at riverbankcomputing.com
Tue Nov 11 19:00:10 GMT 2014


On 11/11/2014 5:58 pm, Marcus Ottosson wrote:
> Is my question vague, or is this not implemented as documented?

As ever, please provide a small complete example that demonstrates the 
problem.

Phil

> On 9 November 2014 11:24, Marcus Ottosson <konstruktion at gmail.com> 
> wrote:
> 
>> It looks for a class that is derived from QQmlExtensionPlugin.
>> 
>> Fair enough, but how come it doesn’t work?
>>>> 
>> On 9 November 2014 11:16, Phil Thompson <phil at riverbankcomputing.com>
>> wrote:
>> 
>>> On 09/11/2014 10:54 am, Marcus Ottosson wrote:
>>> 
>>>> 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
>>>> 
>>> 
>>> It looks for a class that is derived from QQmlExtensionPlugin.
>>> 
>>> Phil
>>> _______________________________________________
>>> PyQt mailing list    PyQt at riverbankcomputing.com
>>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>> 
>> 
>> 
>> 
>> --
>> *Marcus Ottosson*
>> konstruktion at gmail.com
>> 


More information about the PyQt mailing list