PDA

View Full Version : QWTPlot runtime properties dialog and editor



corrado1972
19th April 2011, 14:24
For several years I used delphi with a commercial charting component, teechart.
Teechart has a feature that allows user to edit chart properties directly in runtime: curve, axis, values, graphical properties, and so on, changing its properties values and datasets.
This video http://www.youtube.com/watch?v=bKtjq2tRjfE&feature=related
show'up what I mean.

I wonder: what do I need to build similar facility in QWT?
If I'm right, QWT has full rtti support: in runtime should be possible to build an editor that could read and allow editing of published properties, to change directly them?

This is just an idea to improve the usability of QWT interface API, without forcing the user recompile every time that it wants to try different appeal to curves, backgrounds, data, etc..

:)

Uwe
20th April 2011, 08:24
This is just an idea to improve the usability of QWT interface API, without forcing the user recompile every time that it wants to try different appeal to curves, backgrounds, data, etc..
Yes of course, but this is more an application using Qwt ( like f.e. QtiPlot ) than something I want to add to the library.

What I can imagine to have in the library is an attribute editor widget, that can be used to configure the plot and its items at runtime, but can also be embedded into the Designer/Creator. I made a proof of concept several years ago how to embed such an editor and how to pass the edited attributes, but never started to implement it.

If someone is interested ...

Uwe

corrado1972
21st April 2011, 00:43
I'm interested, but at the present I'm busy in a project: I'm not in hurry, in the future, when I'll have more free time, i'll try.
Could be useful if, instead to start writing some code, starting some discussion about the Qwt architecture.

For example, one thing that could be useful is to know that we must use PROPERTY macro to allow a public property to be exposed in the properties editor of the designer. I remember that this is similar to delphi published keyword that must be used into the interface of classes.

We need to uncover the architecture and its behaviour you designed in your development activity.
thanks for the feedback

Uwe
25th April 2011, 20:35
For example, one thing that could be useful is to know that we must use PROPERTY macro to allow a public property to be exposed in the properties editor of the designer.
Yes - but no, not really. The complete concept for Qt designer plugins is pretty limited for composite widgets ( like QwtPlot ) and unusable for objects that are no QObjects ( like all QwtPlotItems ).

The solution to work around this is to introduce a special property, that is used to exchange all settings as a string f.e. as XML format. Then you are free to implement a completely individual editor widget and to embed it into the designer.

Beside using this editor widget inside of the designer it could be used as run time settings editor and the XML format could also be used for saving/restoring the settings of a plot widget.

As I wrote before: I made a proof of concept several years ago. In qwt_plot_xml.cpp you find the interface how the plot widget gets the XML string and in designer/qwt_designer_plotdialog.cpp you find a small editor for plot attributes ( the title ).

I never tried this path since years, but I would expect, that it is still working after re-enabling some code that is there - but partly in comments.

Uwe