Hi everyone,
I´m kind of confused on how to pass the arguments that i choose on spinboxes and radio buttons on the GUI to perform a calculation that is described on a function in main.cpp.
I´ve seen many methods, signal/slot, qml, thread, commandparse, and I really don´t know what to use.
1-With the help of some people, i did the code for the ricker function,

2-Then I added a way to plot it using qwt, I used a Qt console application;

3-Also i did in another project a GUI where one can choose many parameters, being some of them the inputs for the ricker function. After a CommandLinkButton is clicked the values chosen are written to a txt file and saved.

4-I copied the ricker function and plotting code to the main.cpp of the GUI interface, and I´m trying to pass the values chosen on the GUI as the arguments to the function, but the plotting can only open after the commandlinkbutton is clicked. But i´m struggling to do that.

Some people gave me the idea of putting the qwt part of the code inside the GUI code, it would solve the problem of executing the plot only when pressing the commandlinkButton, but then it doesn´t find the function to execute, since it is another place;

Can anyone show me a way of doing it, I mean pass the arguments from the GUI to the ricker function, and plot only after the commandlinkbutton is clicked? The arguments I want to pass are: wavelet_freq=f, sampling_rate=dt and polarity.
Thanks in advance.

my header is:

#ifndef INTERFACE2_H
#define INTERFACE2_H
#include <QtGui>
#include <QWidget>

namespace Ui {
class interface2;

class interface2 : public QWidget

explicit interface2(QWidget *parent = 0);

int number_traces;
int trace_samples;
double sampling_rate;
int polarity;
double wavelet_freq;
bool noise;
bool standard_reflec;

double f;
double dt1;
double dt=dt1/1000;
Ui::interface2 *ui;

private slots:
void on_RUN_clicked();


#endif // INTERFACE2_H

MY interface.cpp is:

#include "interface2.h"
#include "ui_interface2.h"
#include <QtCore/QString>
#include <QtCore/QFile>
#include <QtCore/QTextStream>
#include <QMessageBox>

interface2::interface2(QWidget *parent) :
ui(new Ui::interface2)




delete ui;

void interface2:n_RUN_clicked()

number_traces = ui->traces->value();
trace_samples = ui->samples->value();
sampling_rate = ui->rate->value();
wavelet_freq = ui->freq->value();

if(ui->reflectivity->isChecked())/*refletividade padrao*/
standard_reflec= 1;
standard_reflec= 0;

if(ui->Noise->isChecked())/*introduzir ruido*/
noise= 1;
noise= 0;

if(ui->negative->isChecked())/*polaridade negativa*/


if(ui->positive->isChecked())/*polaridade positiva*/

QString outputFilename = "sismica1.ini";
QFile outputFile(outputFilename);
outputFile.open(QIODevice::WriteOnly|QIODevice::Te xt);

/* Check it opened OK */
QMessageBox::warning(this,tr("Sismica"),tr("- Error, unable to open sismica1.ini for output"));


/* Point a QTextStream object at the file */
QTextStream outStream(&outputFile);

/* Write the line to the file */
outStream << "////////////////////////////////////////////////////////////////////////////////////"<<endl
<< "Impedancia.txt"<<"\n"
<< number_traces<<"\n"
<< trace_samples<<"\n"
<< sampling_rate/1000<<"\n"
<< wavelet_freq<<"\n"
<< polarity<<"\n"
<< noise<<"\n"
<< standard_reflec<<"\n";

/* Close the file */
emit polarity;

my main.cpp is:

#include "interface2.h"
#include <QApplication>
#include <qapplication.h>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_grid.h>
#include <qwt_symbol.h>
#include <qwt_legend.h>
#include <cmath>

const double pi = 3.14159265358979323846;
int polarity;

QVector<QPointF> ricker(double f, double dt, double length = 60.0)
size_t N = (length - dt/2.0)/dt;
QVector<QPointF> w(N);
for (size_t i = 0; i < N; ++i)
double t = -length/2 + idt;
w[i].setY(polarity((1.0 - 2pipifftt) * exp(-pipifft*t)));
return w;

int main(int argc, char *argv[])

QApplication a(argc, argv);
interface2 w;

QwtPlot plot;
plot.setTitle( "Ricker Wavelet" );
plot.setCanvasBackground( Qt::white );
plot.setAxisScale( QwtPlot::xBottom, -0.25, 0.25 );
plot.setAxisScale( QwtPlot::yLeft, -1.0, 1.0 );
plot.insertLegend( new QwtLegend() );

QwtPlotGrid *grid = new QwtPlotGrid();
grid->attach( &plot );

QwtPlotCurve *curve = new QwtPlotCurve();
curve->setTitle( "Wavelet" );
curve->setPen( Qt::blue, 4 ),
curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );

curve->attach( &plot );
plot.resize(800, 600);

return a.exec();