#include <qapplication.h>#include "mainwindow.h"main(int argc, char **argv){ QApplication app(argc,argv); MainWindow mainWin; mainWin.show(); return app.exec(); }
#ifndef MAINWINDOW_H#define MAINWINDOW_H#include <qmainwindow.h>#ifndef INTEGR_H#include "integration.h"#endifclass QAction;class QLineEdit;class QPushButton;class QStringList;class MainWindow : public QMainWindow{ Q_OBJECTpublic: MainWindow(); private slots: void applyInputHClicked(); void applyInputW1Clicked(); void calculateKoefClicked(); void drawFurieClicked(); private: double ak; double bk; double w1; double h; double T; QLineEdit *w1input; QLineEdit *hinput; QStringList *abk; QPushButton *applyInputW1; QPushButton *applyInputH; QPushButton *calculateKoef; QPushButton *drawFurie; QPushButton *exit; pfdri ri; pfdcs ris; pfdcs ric;}#endif и реализацияMainWindow::MainWindow() : QMainWindow(parent, flags){ w1input = new QLineEdit; hinput = new QLineEdit; abk = new QStringList; plotter = new Q3Canvas; applyInputH = new QPushButton("Apply h"); applyInputW1 = new QPushButton("Apply w1"); calculateKoef = new QPushButton("Calculate koeff"); drawFurie = new QPushButton("Plot!"); exit = new QPushButton("Exit"); ak = new double [7]; bk = new double [7]; w1 = new double; h = new double; T = new double; ri = &research_impulse; ric = &ri_cos; ris = &ri_sin; connect(applyInputW1, SIGNAL(clicked()), &MainWindow, SLOT(applyInputW1Clicked())); connect(applyInputH, SIGNAL(clicked()), &MainWindow, SLOT(applyInputHClicked())); connect(calculateKoef, SIGNAL(clicked()),&MainWindow, SLOT(calculateKoefClicked()));// QObject::connect(exit,SIGNAL(clicked()),&MainWindow,SLOT(exitClicked())); }void MainWindow::applyInputW1Clicked(){ w1 = w1input->text.toDouble; T = 2*PI/w1;}void MainWindow::applyInputHClicked(){ h = hinput->text.toDouble;}void MainWindow::calculateKoefClicked(){ for (int i = 0; i < 7;i++) {// ak[i] = get_koef(0,ris,ri,i+1,500,T);// bk[i] = get_koef(0,ric,ri,i+1,500,T);// это в принципе не интересно }}