PDA

View Full Version : communication between ui and qwtplot



thebrute
30th August 2010, 11:58
I have to write a program for physical application. I want to write in the following way.

ui file

QLinedit // Inputting data of the System
QPushButton // Caculate und Quit
QwtPlot // Output of an simple Plot

if you push the Button calculate -> the curve will be plotted into the qwtplot widget.
if you push Quit the programm has to close
In the lineedits you can put data for the function or curve with is show in the qwtplot widget after putting calculate.

I don't get the communication between the different objects

How works the communication between line Edit and qwtplot?
How works the communication between ui and qwtplot
How works the communication between QPushButton an qwtplot

In the qwt examples are no ui connection show, help me how communicate with the object of the ui?

ShamusVW
3rd September 2010, 09:59
Sorry, can't answer your question.
I'm trying a similar thing where I have created a ui in designer, now I want to add a plot to it. I'm not sure how to do it. I have followed the tutorial on http://www.squad17.org/node/41 but it doesn't have part 4 yet!

I do know how to change properties of the widgets already on the ui programatically, just not how to add a widget created programatically to the ui.

Carlton
6th September 2010, 15:08
The communiction between itens is controlled via the QDialog class that is the ui.
By over loading the signals and slots of the ui control can be passed between items.
For example, when you press the Calculate button, ovreride the clicked() slot function.
In your function, take the contents of the linedit and generate the data for the QwtPlot.
Here are some of my examples below;
Call your plotting routine when the plotbutton is clicked.


connect ( plotButton, SIGNAL ( clicked() ), this, SLOT ( plotActiveAccount( ) ) );// plot the active account

The following slot can be used to recognise when the contets of a linedit is changed.


connect ( lineEdit_Tamount, SIGNAL ( textChanged ( QString ) ), this, SLOT ( updateTamount( QString ) ) );

The dialog class controls all the communication between the various widgets on it.
Best of luck,
Carlton.