#include "../../headers/test_headers/dialog.h"#include "ui_dialog.h"#include <QtCore>#include <QtGui>Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog){ ui->setupUi(this); QGraphicsScene* scene = new QGraphicsScene(this); scene->setBackgroundBrush( Qt::white ); QPen pen( Qt::black ); pen.setWidth( 1 ); QBrush br( Qt::white ); qreal w = 80.0; int numbers = 100000; for(int i = 0; i < numbers; i++){ scene->addRect(QRectF(0.0, 100.0 + i*100, 80.0, 80.0),pen, br); if(i != numbers - 1) scene->addLine(QLineF(40.0, w + (i+1)*100, 40.0, w + (i+1)*100 + 20),pen); } ui->graphicsView->setScene(scene);}Dialog::~Dialog(){ delete ui;}
#ifndef DIALOG_H#define DIALOG_H#include <QDialog>#include <QGraphicsScene>#include <QGraphicsView>#include <QGraphicsItem>#include <QStyleOptionGraphicsItem>#include <QPainter>namespace Ui {class Dialog;}class Dialog : public QDialog{ Q_OBJECTpublic: explicit Dialog(QWidget *parent = 0); ~Dialog();private: Ui::Dialog *ui;};#endif // DIALOG_H
#include "../headers/test_headers/dialog.h"#include <QApplication>int main(int argc, char *argv[]){ QApplication app(argc, argv); Dialog testgraph; testgraph.show(); return app.exec();}
bla bla