Web lists-archives.com

Re: Problem instanciating a custom c++ plugin into a plasmoid

El diumenge, 30 d’abril de 2017, a les 22:32:12 CEST, renn0xtek9@xxxxxxxxxxx 
va escriure:
> Hello everybody
> I am trying to make a BookmarkWidgets for KF5
> So I want to make plasmoid in QML and the AbstractItem Model as a C++ plugin
> Right now I am struggling to instanciate the plugin in the QML:
> After installing the plugin and launching the plasmoid with plasmoidviewer,
> it keep saying Non-existent attached object
> I don't understand what it means/what I am doing wrong. (And I don't know
> which efficient way to debug exist)
> So for the c++ plugin
> the qmldir file:
> https://github.com/renn0xtek9/BookMarkWidgets/blob/PlasmoidUsesPlugin/libboo
> kmarksmodule/qmldir the header:
> https://github.com/renn0xtek9/BookMarkWidgets/blob/PlasmoidUsesPlugin/libboo
> kmarksmodule/bookmarkmodel.hpp the main.qml
> https://github.com/renn0xtek9/BookMarkWidgets/blob/PlasmoidUsesPlugin/plasmo
> id/contents/ui/main.qml
> If someone can point me at what is wrong/give some hint, that would be very
> much appreciated.

I see several things that look bad/fishy

Yo do


but you export your class as 

qmlRegisterType<Bookmarkmodel,1>(uri, 1, 0, "bookmarkmodelplugin");

so your names don't match.

Also i think that all QML type names must start with uppercase (maybe only the 
ones that are from QML files) so i'd turn those to

qmlRegisterType<Bookmarkmodel,1>(uri, 1, 0, "Bookmarkmodel");

And actually i'm almost also sure you should either do
 import MyPlugins 1.0 as MyPlugins
or drop
from MyPlugins.Bookmarkmodel{

Next time you say "it keep saying Non-existent attached object", it'd be nice 
to have the full error + line number ;)


> Best regards