KDE-ify QML all across KDE
Marco Martin
notmart at gmail.com
Sun Jan 9 17:41:45 CET 2011
Hi all,
during last couple of days I've been working on
git at git.kde.org:scratch/mart/libkdeclarative
This is a thing we agreed upon (and that I promised to do ;) at the mobile
sprint.
It's a little ~60KB library that's meant to be used inside KDE apps that are
using QML, what do they do? but before, a bit of history:
Since 4.6, Plasma has bindings to write plasmoids using just QML/Javascript,
and especially in the light of our previous pure JS bindings, we immediately
had some issues, that made KDE integration really poor, namely:
* no way to use our own i18n
* not possible to use Icons, pixmap and images (only pathnames of on-disk
images)
* no kconfig, kjobs
* all urls manipulation hidden deeply into default qml elements only accepting
strings
This mostly because 2 severe design limitations of QML:
* no access to the QScriptEngine
* read only QScriptEngine main object
that made impossible among other things to register any non-qobject class or
global functions. Both are possible to be "reverted" in a quite hacky way, but
so needed that made the hack acceptable to us, so now the QML based plasmoids
can do all of the above without problems.
Talking with the PIM people we discovered they had all of the same problems,
so we agreed with them to have a KDE-wide solution that would make easy to
anybody to use in a nice way what of kdelibs makes it so uhm, kdelibs ;)
This library is basically a class, that after setting a QDeclarativeEngine
with initialize() pulls the qscriptengine out of it, then replaces the main
object with a writable copy.
the setupBindings() function (unsure if keeping this step optional or just
pput it into initialize()) binds in the main object goodies like i18n, kjob,
kconfig, kicon and kurl.
at the moment it links to qtdeclarative, kdecore and kdeui (just for kicon, if
QIcon::fromTheme works good enough perhaps we can keep kdeui out)
This would go in a (probably separate library) in kdelibs, making it possible
to use from qml plasmoids as before or also in c++plasmoids or non plasmoid ui
components of plasma (where we still don't have the same nice bindings)
but also from completely independent applications like Kontact touch/calligra
mobile/whatever.
Cheers,
Marco Martin
More information about the Plasma-devel
mailing list