The cons don't seem very problematic, any other reasons why you don't like the approach? I guess the only other thing you can do is use strings, and that would suck even more :P
On Fri, May 10, 2013 at 11:14 PM, Marco Martin <notm...@gmail.com> wrote: > Hi all, > > After many experiments in varuious failing directions, i have the branch > PlasmaTypesClass of palsma-framework > > The problem: > we need a way to expose the enums used in libplasma such as FormFactor, > Location, Constraints etc in some way accessible to QML, for applet > bindings, > and any possible future qml plugin that needs to use them as properties. > > we used to have a duplication of most of enums in AppletInterface in the > script engine, that works fine-ish but you still have to pass them by > numeric > value (the name of the enum doesn't seem to be accessible, but at least the > parameters are assed when invoking methods or setting properties) > and of course you can use it only in plasmoids, and not within qml plugins. > > In the branch, I have now in libplasma a class called Types that contains > all > the enums, this makes possible to use them in qml, (or even in old > qtscript if > one wants). Is exactly how is done for the global Qt namespace (Qt:: is > actually not a namespace, but a QObject) > > in QML they would be accessed by name with something like > PlasmaCore.Types.TopEdge > (they weren't accessible byu name at all in qml1 so no mandatory porting > involved from qml part, accessing by number still works) > > pros: > * used directly > * removes duplicate definitions > * typecasts-- > > cons: > * Types name (or any other for what matters) is not particularly pretty > * in c++ all Plasma::Foo must be changed in Plasma::Types::Foo > > So. > I can't really get to like this approach, but i think is the only one that > can > work in any way... > > Cheers, > Marco Martin > _______________________________________________ > Plasma-devel mailing list > Plasma-devel@kde.org > https://mail.kde.org/mailman/listinfo/plasma-devel > -- Shantanu Tushar (UTC +0530) http://www.shantanutushar.com
_______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel