[Interest] example code for C++ plugin qml extension?

Alan Alpert 416365416c at gmail.com
Fri Apr 12 23:23:05 CEST 2013


The example's .pro file should install all those files to the correct
directory. If not, try manually copying the TimeExample directory
(make sure it has the built .so file) into the "qml" folder of your Qt
installation (the qml folder should be next to the bin folder which
contains qmake).

--
Alan Alpert

On Fri, Apr 12, 2013 at 1:50 PM, VStevenP <vstevenpavao at yahoo.com> wrote:
> Hi Alan,
>
> Thanks for the help!  I think I almost have the example plug-in working, but I think I need another tip.
>
> I built examples/qml/plugins/plugins.pro using Qt Creator 2.6.1 / Qt 5.0.0.   It generated qmlqtimeexampleplugin.dll and some other files under the debug build directory "plugins-build-Desktop_Qt_5_0_0_MSVC2010_32bit_SDK-Debug/Imports/TimeExample".
>
> What's some good steps to then make the plug-in available to the companion qml project: examples/qml/plugins/plugins.qmlproject , or some other .pro project.  It's not available in the plugins.qmlproject at this point; it says "TimeExample is not installed").
>
> I also notice there is a directory examples/qml/plugins/Imports/TimeExample.  It contains a qmldir file which contains the following:
>
> module TimeExample
> Clock 1.0 Clock.qml
> plugin qmlqtimeexampleplugin
>
> (Curiously enough, that directory also contains some .png files and some QML code.  I wonder why an Imports directory would contain such files; it's confusing to me.)
>
>
> So, any way, what are the typical steps I now need to follow to use the plug-in some other projects?  Do I need to just move/copy the .dll, or are all those other files also critical.
>
> Thanks for your help so far.  I am excited to be getting so close to exposing a number of my C++ classes to QML via a single import of a plugin.
>
> - VStevenP
>
> ----- Original Message -----
>> From: Alan Alpert <416365416c at gmail.com>
>> To: Steve Pavao <vstevenpavao at yahoo.com>
>> Cc: interest <interest at qt-project.org>
>> Sent: Friday, April 12, 2013 1:08 PM
>> Subject: Re: [Interest] example code for C++ plugin qml extension?
>>
>>T here's clearly something wrong with the doc generation there. You can
>> go directly to the example code if you check out the qtdeclarative
>> repo from http://qt.gitorious.org/qt/qtdeclarative . The example is in
>> examples/qml/plugins. Or browse it in gitorious:
>> http://qt.gitorious.org/qt/qtdeclarative/trees/stable/examples/qml/plugins
>>
>> --
>> Alan Alpert
>>
>> On Fri, Apr 12, 2013 at 9:13 AM, Steve Pavao <vstevenpavao at yahoo.com>
>> wrote:
>>>  Could someone please post generic code for a working C++ plugin to extend
>>>  QML?
>>>
>>>  The following official doc and also the official help in Qt Creator are
>>>  missing the example code.  It just shows "..." or blank space in
>> the example
>>>  entries.
>>>
>>>  http://qt-project.org/doc/qt-5.0/qtqml/qtqml-modules-cppplugins.html
>>>
>>>  - VStevenP
>>>
>>>
>>>  _______________________________________________
>>>  Interest mailing list
>>>  Interest at qt-project.org
>>>  http://lists.qt-project.org/mailman/listinfo/interest
>>>
>>



More information about the Interest mailing list