DataEngine & KPluginFactory

Sebastian Kügler sebas at kde.org
Mon Jul 1 10:47:32 UTC 2013


On Monday, July 01, 2013 09:03:29 Kevin Krammer wrote:
> On Monday, 2013-07-01, Sebastian Kügler wrote:
> > Open questions:
> > 
> >
> > - KPart and QWidget create* calls: In my current patch, these are simply
> >
> >   ignored.
> >   I'm getting away with one overridden function in our
> >   macro-generated KPluginFactory subclass, it all seems to boil down to
> > 
> >
> >       virtual QObject *create(const char *iface, QWidget *parentWidget, \
> >                                                                       QObj
> > ect *parent, const QVariantList &args, 
> \
> 
> >                                                                       cons
> > t QString &keyword) \>
> >         { \
> >             return new baseclass(parent, args); \
> >         } \
> > 
> >   as you can see, I'm using "baseclass" as return type. Is there a way to
> >
> > use iface for the classname? If so, then this could be moved into an
> > inline method?
> 
> What if the macro only creates the header content (as its name already 
> suggests)?
> 
> name::create() could then be implemented in a plugin specific way, not 
> requiring a certain constructor pattern or specifying of "baseclass".

I'd rather save the user writing that boilerplate.

> It would also allow to just pass parent, not also parentWidget. A plugin
> that  creates a widget can qobject_cast parent to QWidget.

This is already handled in KPluginInfo, the create<MyType>(QObject*, 
QVariantList) method works. It will just fall back to the one I've added.

Cheers,
-- 
sebas

http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9


More information about the Kde-frameworks-devel mailing list