PDA

View Full Version : Advice - First Qt4 App - Instrument Panel



SolarQuark
16th January 2011, 20:41
Hi all.
First of all I would like to thank all those involved in the 'Qt Project' - I think Qt is amazing.
I wish to learn Qt and I have obtained a few Qt books (C++ GUI Programming with Qt4, The Art of Building Qt4 Applications, Foundations of Qt Development).
I have given myself a project as I find there is a very big difference in trying to learn from a book and actually creating a 'real' application that would be useful. The project is an instrument panel that will display the current status of certain instruments connected to the PC. These may include temperature, air pressure, humidity, and so on.
As this is my first project I have a very great deal to learn.

I would like each instrument in the instrument panel to have a label to identify that instrument and at least one other label (or alternative) to display the reading of the instrument (in addition to the analogue indication of the instrument pointer). The first would probably be best located over the instrument with the second probably located underneath the instument.
'Temperature' instruments should probably look similar to a thermometer. Other instruments would probably look similar to a circular dial with a scale.
It would seem to me that it would be appropriate to create some form of frame widget containing one of the required instruments and the required lables.
Each frame widget could then be placed into a 'main window' widget.

I am not at all sure how this type of construction would react to main window resizing.

Would this be an appropriate approach, or is there a better approach?

Take care.

Mke

javimoya
16th January 2011, 21:07
qwt may help you
http://qwt.sourceforge.net/controlscreenshots.html

SolarQuark
19th January 2011, 12:01
qwt may help you
http://qwt.sourceforge.net/controlscreenshots.html

Wow! They are nice looking instruments and, I suspect, just a tad better than I could cobble together :)

But that's not really the problem that is exercising my mind just now.

Let's say that there will be four or five circular gauge style instruments (a compass, an air pressure gauge, a humidity gauge, etc, etc) and a few vertical scale style instruments (thermometers mostly).
Each of these will have an accompanying label over the instrument to identify the purpose of that instrument (e.g. Air Pressure). Each of these will also have a label underneath the instrument that will give a 'digital' indication of the scale reading (e.g. the scale needle might be pointing at a part of the scale in the region of 1000mB but the label undeneath might indicate 1002mB).

And so the layout...
I could create a main window and place each instrument on this along with the upper and lower labels and any other widgets that might be required. I could spend some time getting the layout just right. But when I resize the main window the layout will go all awry (I have actually tried this and that is what happens).
And so is there a better approach?
I could create each individual instrument in its own window type widget along with all the other widgets that 'belong' to that instrument (such as upper and lower labels). These instrument containers could then be added to the main window and laid out as required.
This would seem to be a better approach. But I am not sure of a few things.

And so the questions
1. Would this be a good approach?
2. Is there a better approach?
3. What would be likely to happen if/when the main window is resized? (would each instrument container also resize 'appropriately'? And would each of the widgets _inside_ each instrument container resize 'appropriately'?)
4. Would a frame or a docking window be a better container for the instrument and accompanying widgets?

Or am I completely off course?

Thanks for the reply, javimoya. Those are really nice instruments.

Take care.

Mike

SolarQuark
23rd January 2011, 16:17
Update

I have crudely 'hand-coded' some Qwt gauges and added these to a window. These gauges now resize as expected.

The problems I have experienced with Qwt gauges 'created' using Qt Designer must be due to my lack of understanding of Qt Designer.

As I now have a means to create gauges that behave as needed (I think) by sticking to the keyboard then this matter is now closed.

I would like, again, to take the opportunity to thank the creators and maintainers of Qt. I continue to be amazed.

Take care all.

Mike