[PyQt] pyqt5qmlplugin
Phil Thompson
phil at riverbankcomputing.com
Mon Nov 17 14:15:43 GMT 2014
On 13/11/2014 7:47 am, Marcus Ottosson wrote:
> The Charts example I mentioned related to the example included with
> PyQt5,
> it’s this one.
>
> -
>
>
>
> https://github.com/pyqt/python-qt5/tree/master/PyQt5/examples/quick/tutorials/extending/chapter6-plugins
> -
>
>
> http://qt-project.org/doc/qt-5/qtwidgets-itemviews-chart-example.html
>
> Running this as-is produces the problem stated in the original post.
>
> Best,
> Marcus
cd /path/to/chapter6-plugins
QML2_IMPORT_PATH=$PWD /path/to/qmlscene app.qml
...works fine for me.
Phil
> On 11 November 2014 19:00, Phil Thompson <phil at riverbankcomputing.com>
> wrote:
>
>> 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