#include "mainwindow.h"#include "ui_mainwindow.h"MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow){ const int n = 100000; int y_int[n]; double x[n]; double y_double[n]; for(int i = 0; i < n; i++) x[i] = i; for(int i = 0; i < n; i++) y_int[i] = rand() % 256; for(int i = 0; i < n; i++) y_double[i] = static_cast<double>(y_int[i]); ui->setupUi(this); ui->plot->setAxisScale(QwtPlot::xBottom, 0, n); ui->plot->setAxisScale(QwtPlot::yLeft, 0, 255); QwtPlotCurve *curve = new QwtPlotCurve("x(y)"); curve->setStyle(QwtPlotCurve::Lines); curve->setPen(QPen(Qt::green)); curve->setSamples(x, y_double, n); curve->attach(ui->plot); QGraphicsScene *scene = new QGraphicsScene(ui->graphicsView); double ed = ui->graphicsView->width()/static_cast<double>(n); // Нормированный множитель для адекватного отображения графика в graphicsView for (int i = 0; i < n-1; i++) scene->addLine(x[i]*ed,-y_int[i],x[i+1]*ed,-y_int[i+1]); ui->graphicsView->setScene(scene); ui->textEdit->setText(arg); }MainWindow::~MainWindow(){ delete ui;}
Flat profile:Each sample counts as 0.01 seconds. no time accumulated % cumulative self self total time seconds seconds calls Ts/call Ts/call name 0.00 0.00 0.00 199998 0.00 0.00 QPointF::QPointF(double, double) 0.00 0.00 0.00 99999 0.00 0.00 QGraphicsScene::addLine(double, double, double, double, QPen const&) 0.00 0.00 0.00 99999 0.00 0.00 QLineF::QLineF(double, double, double, double) 0.00 0.00 0.00 132 0.00 0.00 qt_noop() 0.00 0.00 0.00 106 0.00 0.00 QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::operator->() const 0.00 0.00 0.00 63 0.00 0.00 QBasicAtomicInt::deref() 0.00 0.00 0.00 61 0.00 0.00 QString::~QString() 0.00 0.00 0.00 26 0.00 0.00 QBasicAtomicInt::ref() 0.00 0.00 0.00 26 0.00 0.00 QString::QString(QString const&) 0.00 0.00 0.00 22 0.00 0.00 QString::operator+=(QString const&) 0.00 0.00 0.00 13 0.00 0.00 operator+(QString const&, QString const&) 0.00 0.00 0.00 9 0.00 0.00 operator+(QString const&, char const*) 0.00 0.00 0.00 6 0.00 0.00 QBasicAtomicInt::operator!=(int) const 0.00 0.00 0.00 4 0.00 0.00 QChar::unicode() 0.00 0.00 0.00 4 0.00 0.00 QRect::QRect(int, int, int, int) 0.00 0.00 0.00 4 0.00 0.00 QString::operator+=(QChar) 0.00 0.00 0.00 4 0.00 0.00 operator+(QString const&, char) 0.00 0.00 0.00 3 0.00 0.00 QTime::QTime() 0.00 0.00 0.00 3 0.00 0.00 QFlags<Qt::AlignmentFlag>::QFlags(Qt::AlignmentFlag) 0.00 0.00 0.00 2 0.00 0.00 QFlags<Qt::WindowType>::QFlags(void**) 0.00 0.00 0.00 2 0.00 0.00 QFlags<Qt::AlignmentFlag>::operator|(Qt::AlignmentFlag) const 0.00 0.00 0.00 1 0.00 0.00 qMain(int, char**) 0.00 0.00 0.00 1 0.00 0.00 MainWindow::MainWindow(QWidget*) 0.00 0.00 0.00 1 0.00 0.00 MainWindow::~MainWindow() 0.00 0.00 0.00 1 0.00 0.00 Ui_MainWindow::retranslateUi(QMainWindow*) 0.00 0.00 0.00 1 0.00 0.00 Ui_MainWindow::setupUi(QMainWindow*) 0.00 0.00 0.00 1 0.00 0.00 QSize::QSize(int, int) 0.00 0.00 0.00 1 0.00 0.00 QString::QString(char const*) 0.00 0.00 0.00 1 0.00 0.00 QWidget::show() 0.00 0.00 0.00 1 0.00 0.00 QWidget::resize(int, int) 0.00 0.00 0.00 1 0.00 0.00 QRect::width() const 0.00 0.00 0.00 1 0.00 0.00 QString::isEmpty() const 0.00 0.00 0.00 1 0.00 0.00 QWidget::width() const 0.00 0.00 0.00 1 0.00 0.00 operator|(Qt::AlignmentFlag, Qt::AlignmentFlag)