#include "MyMainWindow.h"
#include <QGridLayout>
#include <QHBoxLayout>
#include <qwt_plot_curve.h>
#include "RunSimulation.h"
#include <vector>
{
setLayout(mainLayout);
myPlot1->setMinimumSize(200, 100);
myPlot2->setMinimumSize(200, 100);
myPlot3->setMinimumSize(200, 100);
myPlot4->setMinimumSize(200, 100);
myPlot5->setMinimumSize(200, 100);
myPlot6->setMinimumSize(200, 100);
buttonLayout->addWidget(BUTTONRun ,0,0);
buttonLayout->addWidget(BUTTONQuit ,0,1);
buttonLayout->addWidget(BUTTONAbout ,1,0);
buttonLayout->addWidget(BUTTONContact,1,1);
buttonWidget->setLayout(buttonLayout);
mainLayout->addWidget(myPlot1 ,0,0,1,1);
mainLayout->addWidget(myPlot2 ,0,1,1,1);
mainLayout->addWidget(myPlot3 ,0,2,1,1);
mainLayout->addWidget(myPlot4 ,1,0,1,1);
mainLayout->addWidget(myPlot5 ,1,1,1,1);
mainLayout->addWidget(myPlot6 ,1,2,1,1);
mainLayout->addWidget(buttonWidget ,0,3,1,1);
myCurve1.attach(&myPlot1);
myCurve2.attach(&myPlot2);
myCurve3.attach(&myPlot3);
myCurve4.attach(&myPlot4);
myCurve5.attach(&myPlot5);
myCurve6.attach(&myPlot6);
QObject::connect(BUTTONQuit,
SIGNAL(clicked
()),
qApp,
SLOT(quit
()));
QObject::connect(BUTTONAbout,
SIGNAL(clicked
()),
qApp,
SLOT(aboutQt
()));
QObject::connect(BUTTONRun,
SIGNAL(clicked
()),
qApp,
SLOT(myRunSlot
()));
}
void MyMainWindow::myRunSlot()
{
RunSimulation();
}
void MyMainWindow::plotValuesFromFunction()
{
QVector<double> x(1);
QVector<double> y(1);
vector<double> points;
x.append( points[0] );
y.append( points[1] );
myCurve1.setSamples(x.data(),y.data(),x.size());
myCurve2.setSamples(x.data(),y.data(),x.size());
myCurve3.setSamples(x.data(),y.data(),x.size());
myCurve4.setSamples(x.data(),y.data(),x.size());
myCurve5.setSamples(x.data(),y.data(),x.size());
myCurve6.setSamples(x.data(),y.data(),x.size());
myPlot.replot();
myPlot.show();
}
#include "MyMainWindow.h"
#include <QGridLayout>
#include <QHBoxLayout>
#include <qwt_plot_curve.h>
#include "RunSimulation.h"
#include <vector>
MyMainWindow::MyMainWindow(QWidget* parent) : QWidget(parent)
{
QGridLayout* mainLayout = new QGridLayout();
setLayout(mainLayout);
myPlot1 = new QwtPlot();
myPlot2 = new QwtPlot();
myPlot3 = new QwtPlot();
myPlot4 = new QwtPlot();
myPlot5 = new QwtPlot();
myPlot6 = new QwtPlot();
myPlot1->setMinimumSize(200, 100);
myPlot2->setMinimumSize(200, 100);
myPlot3->setMinimumSize(200, 100);
myPlot4->setMinimumSize(200, 100);
myPlot5->setMinimumSize(200, 100);
myPlot6->setMinimumSize(200, 100);
QWidget* buttonWidget = new QWidget();
QGridLayout* buttonLayout = new QGridLayout();
BUTTONRun = new QPushButton("RUN");
BUTTONQuit = new QPushButton("STOP");
BUTTONAbout = new QPushButton("About");
BUTTONContact = new QPushButton("Contact");
buttonLayout->addWidget(BUTTONRun ,0,0);
buttonLayout->addWidget(BUTTONQuit ,0,1);
buttonLayout->addWidget(BUTTONAbout ,1,0);
buttonLayout->addWidget(BUTTONContact,1,1);
buttonWidget->setLayout(buttonLayout);
mainLayout->addWidget(myPlot1 ,0,0,1,1);
mainLayout->addWidget(myPlot2 ,0,1,1,1);
mainLayout->addWidget(myPlot3 ,0,2,1,1);
mainLayout->addWidget(myPlot4 ,1,0,1,1);
mainLayout->addWidget(myPlot5 ,1,1,1,1);
mainLayout->addWidget(myPlot6 ,1,2,1,1);
mainLayout->addWidget(buttonWidget ,0,3,1,1);
myCurve1.attach(&myPlot1);
myCurve2.attach(&myPlot2);
myCurve3.attach(&myPlot3);
myCurve4.attach(&myPlot4);
myCurve5.attach(&myPlot5);
myCurve6.attach(&myPlot6);
QObject::connect(BUTTONQuit, SIGNAL(clicked()), qApp, SLOT(quit()));
QObject::connect(BUTTONAbout, SIGNAL(clicked()), qApp, SLOT(aboutQt()));
QObject::connect(BUTTONRun, SIGNAL(clicked()), qApp, SLOT(myRunSlot()));
}
void MyMainWindow::myRunSlot()
{
RunSimulation();
}
void MyMainWindow::plotValuesFromFunction()
{
QVector<double> x(1);
QVector<double> y(1);
vector<double> points;
x.append( points[0] );
y.append( points[1] );
myCurve1.setSamples(x.data(),y.data(),x.size());
myCurve2.setSamples(x.data(),y.data(),x.size());
myCurve3.setSamples(x.data(),y.data(),x.size());
myCurve4.setSamples(x.data(),y.data(),x.size());
myCurve5.setSamples(x.data(),y.data(),x.size());
myCurve6.setSamples(x.data(),y.data(),x.size());
myPlot.replot();
myPlot.show();
}
To copy to clipboard, switch view to plain text mode
Bookmarks