[Development] Contribution proposal, mainly server-side and QtWidgets-based

Grégoire Barbier devel at g76r.eu
Mon Sep 28 09:49:32 CEST 2015


As a base for a software of mine[1], I developed a few pieces of code 
based on Qt that may be of interest for others.

This is not as mature as the Qt framework itself, dramaticaly lacks 
documentation, but it is currently working.

If somebody is interested in seeing some part of this software 
contributed/integrated into a Qt module, even some small subset, I would 
be pleased to talk about it further.

1) A Simple web application framework which main interest is to be able 
to write HTML tables and CSV exports directly from the same 
QAbstractItemModels than those used on a GUI.

Let's be clear: the httpd and templating engine implementations are 
quite primitive (304 implemented only with timestamps, only basic auth, 
no scripting in html templates, etc.) and it is not so scalable, but it 
works and enables QAbstractItemModel code sharing between GUI and WUI.
- The most interesting parts are probably the text views, i.e. 
replacement for QAbstractItemView that can be plugged into 
QAbstractItemModel just the same way. Although there are not plenty of 
them, the HTML table view works and provides an item delegate able to 
handle icons and classes fitting fine e.g. with Twitter Bootstrap:
example implementation:

- A CSV view is also available for CSV/Excel exports:
- The deeper layer consists of an HTTP server and HTML templating engine 
with built-in support for basic authentication, upload or funny things 
like graphviz auto-generated diagrams:

2) A generic item pattern/framework over Qt's model/view framework that 
supports generic display and edition of tuples-oriented items.

Uses Qt's implicit sharing pattern to implement value classes and works 
both with QtWidgets and the previously described web framework.
The tuples-oriented items have an arbitrary number of sections that are 
interpreted as columns by table or tree models.
- The core class is the SharedUiItem:
example implementation:
- Then come models (subclasses of QAbstractItemModel):
example implementation:
- And document managers, which are more or less DAOs:
example implementation:

3) A "target" pattern/framework over QtWidgets (could probably be 
adapted to QML)

A "target" is an application-wide selection, accross widgets and 
windows. It is strongly tied to previously described generic item 
framework, especialy because items have application-wide unique ids, 
which makes it possible to have consistent target references.
Thanks to target, actions can be performed on item regardless the view, 
which is convenient when same items are present in several views at a 
time (e.g. a table and a graphics view).
- The core classes are these ones:
- There are generic actions to create or delete targeted items using 
generic previsously described item framework:
- View and form widgets should extend this class to get convenient 
behaviors such as ensuring visibility and starting edition of a newly 
created item:
example implementation:

4) A few server-side utilities that are probably of lesser interest

Such as a thread-safe circular buffer for implicitly shared objects and 
other pointer-sized data.

5) A proof-of-concept of what could become a graphviz-powered 
QGraphicsLayout implementation

Processing a dot layout of QGraphicsItems nodes and edges works fine, 
but the code is still limited, e.g. info like edge labels or edge 
extremities locations are lost and it's too slow.


PS: I come to QTWS next week.

[1]: an open source scheduler: http://qron.eu/ which needed these 
software pieces for its web ui, and its (still work in progress) desktop 
and mobile uis

Grégoire Barbier :: g à g76r.eu :: +33 6 21 35 73 49

More information about the Development mailing list