Using plasma enums from QML2
Marco Martin
notmart at gmail.com
Sun May 12 11:14:23 UTC 2013
On Sunday 12 May 2013, Aaron J. Seigo wrote:
> On Friday, May 10, 2013 19:44:09 Marco Martin wrote:
> > After many experiments in varuious failing directions, i have the branch
> > PlasmaTypesClass of palsma-framework
>
> de-duplication is terrific.
>
> it's still a draft state, i realize. the code in plasma.h is inconsistent
> in a few ways (e.g. Direction doesn't have a Q_ENUMS; the Q_ENUMS for
> Contraint and FormFactor are at the top of the class declaration while
> others are directly after the relevant enum), but i imagine that'll all
> get ironed out before this is merged.
yes, right now is just in a state to make it build as quickly as possible,
needs quite some refinements (the typedefs there are mostly for build issues)
> > in QML they would be accessed by name with something like
> >
> > PlasmaCore.Types.TopEdge
>
> not a huge fan of the nomenclature. would be nicer if they could be
> accessed as Plasma.TopEdge (e.g.). no way to inject a top-level QObject
> anymore in QML2?
we indeed can inject a top lefel qobject, but that's slightly different.
PlasmaCore.Types.TopEdge is generated from the Q_ENUMS in the qobject, while
if we inject a qobject we would be able to have something like
plasma.topEdge (notice the lower case) that plasma object would be a qobject
that has topEdge as an int qproperty that always return the value of TopEdge,
but still a property on an object instance (aestetically as usage the only
thing that makes you notice is the lower case names, that i think are enforced
for both object instance names and property names)
> > * Types name (or any other for what matters) is not particularly pretty
> > * in c++ all Plasma::Foo must be changed in Plasma::Types::Foo
>
> what's wrong with the typedefs you put in there?
i think they should go: they help with like Plasma::FormFactor, but
Plasma::Horizontal is still not accessible
Cheers,
Marco Martin
More information about the Plasma-devel
mailing list