User login

You are here

Creating fluid, powerful Kexi forms

Kexi reports have for a long time supported a powerful scripting interface. Forms however, while supporting a wide range of data-enabled widgets, only have support for simple macros.

Forms and reports are both plugins in Kexi. Kexi plugins are based around views....a plugin exposes a Design View and a Data View (in the normal case). Reports and Form design views are based on quite extensive wysiwyg designers which create XML representations used by the Data view to display the data in the object.

A few days ago, i was thinking about how to create more powerful forms, with user created scripting abilities and it hit me, QML! I could create a very simple plugin containing only a text editor for the designer, and declarative view for the viewer. This would allow a power-user to hand-write QML inside Kexi for the production of powerful, scriptable forms. It wasnt quite that simple, for example, QDeclarativeView only works with files, and wanted to supply the QML text from the database. This was resolved by using a QGraphicsView/Scene and manually creating a QDeclarativeComponent.

There are also limitations such as no external components, just plain QML. I imagine that if this experiment is pursued, then we could create some cusom Kexi components and possibly allow the user to write components inside the database. The editor also sucks, its just a QPlainTextEdit at the moment, but this could be easily switched out for KatePart with some syntax hi-lighting.

I expect to also bind the form to a data source and expose the record data. At the moment there is only one addition to the engine, a Kexi object which allows performing operations on the database such as opening objects, printing, closing, renaming etc. This is taken from the existing Script api, so provides a known API.