void MainWindow::viewObrabotka(){ obrabotka *pobrabotka = new obrabotka(this); pobrabotka->setAttribute(Qt::WA_DeleteOnClose); pobrabotka->setModel(model); pobrabotka->resize(800, 600); pobrabotka->show();}
#include <QtGui/QStandardItemModel>#include "obrabotka.h"#include "mainwindow.h"#include <qwt_plot.h>#include <qwt_plot_marker.h>#include <qwt_plot_curve.h>#include <qwt_legend.h>#include <qwt_data.h>#include <qwt_text.h>#include <qwt_math.h>#include <qwt_scale_widget.h>#include <qwt_painter.h>#include <qwt_plot_canvas.h>#include <math.h>obrabotka::obrabotka(QWidget *parent) :QDialog(parent){}obrabotka::~obrabotka(){}void obrabotka::obra(){}void obrabotka::setModel(QStandardItemModel *model){ m_model = model; QList<double> x0, x1, x2, x3; int Size = m_model->rowCount(); double X0[Size], X1[Size], X2[Size], X3[Size]; for (int i = 0; i < m_model->rowCount(); i++) { x0.append(m_model->item(i, 0)->text().toDouble()); x1.append(m_model->item(i, 1)->text().toDouble()); x2.append(m_model->item(i, 2)->text().toDouble()); } for (int i = 0; i < m_model->rowCount(); i++) { X0[i] = x0[i]; X1[i] = x1[i]; X2[i] = x2[i]; }//******* Grafiki ***** QwtPlot *myPlot = new QwtPlot(tr("Grafiki zavisimosti parametrov ot vremeni"), this); // add curves QwtPlotCurve *curve1 = new QwtPlotCurve("H ot T"); curve1->setRenderHint(QwtPlotItem::RenderAntialiased); QwtPlotCurve *curve2 = new QwtPlotCurve("Curve 2"); // Axis of plot myPlot->setAxisTitle(QwtPlot::xBottom, "Time/seconds"); myPlot->setAxisTitle(QwtPlot::yLeft, "Height/meters"); curve1->setPen(QPen(Qt::red)); curve2->setPen(QPen(Qt::blue)); curve1->setData(X0,X1,Size); curve2->setData(X0,X2,Size); curve1->attach(myPlot); curve2->attach(myPlot); // finally, refresh the plot myPlot->resize(600, 500); myPlot->replot();//*************}
void MainWindow::FlyFile(){ QDialog *dialog = new QDialog(this); dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->resize(800, 600); QTableView *view = new QTableView(dialog); view->setModel(model); QVBoxLayout *layout = new QVBoxLayout(); layout->addWidget(view); dialog->setLayout(layout); dialog->show();}
QwtPlot *myPlot = new QwtPlot(tr("Grafiki zavisimosti parametrov ot vremeni"), this);
void MainWindow::viewObrabotka(){ obrabotka *pobrabotka = new obrabotka(this); pobrabotka->setAttribute(Qt::WA_DeleteOnClose); pobrabotka->setWindowTitle("Grafiki zavisimostey parametrov ot vremeni"); pobrabotka->setModel(model); pobrabotka->resize(800, 600); //QwtPlot *myPlot = new QwtPlot(this); //QVBoxLayout *layout = new QVBoxLayout(); //layout->addWidget(myPlot); //pobrabotka->setLayout(layout); pobrabotka->show();}
void obrabotka::setModel(QStandardItemModel *model){...//******* Grafiki ***** QwtPlot *myPlot = new QwtPlot(tr("Grafiki zavisimosti parametrov ot vremeni"), this); // add curves...
void MainWindow::viewObrabotka(){ obrabotka *pobrabotka = new obrabotka(this); pobrabotka->setAttribute(Qt::WA_DeleteOnClose); pobrabotka->setWindowTitle("Grafiki zavisimostey parametrov ot vremeni"); pobrabotka->setModel(model); pobrabotka->resize(800, 600); QwtPlot *myPlot = new QwtPlot(this); QVBoxLayout *layout = new QVBoxLayout(); layout->addWidget(myPlot); pobrabotka->setLayout(layout); pobrabotka->show();}
void obrabotka::setModel(QStandardItemModel *model)
class obrabotka : public QDialog{...private: QwtPlot *plot;}
obrabotka::obrabotka(QWidget *parent) :QDialog(parent){ plot = new QwtPlot(); QVBoxLayout *l = new QVBoxLayout(); l->addWidget(plot); setLayout(l);
void obrabotka::setModel(QStandardItemModel *model){ m_model = model;...}