当前位置:网站首页>QT graphicsview graphical view usage summary with flow chart development case prototype

QT graphicsview graphical view usage summary with flow chart development case prototype

2022-07-07 22:56:00 Trendy technology research society

QGraphicsview The predecessor was QCanvas, As one can imagine , It is the canvas , Inherited from QWidget, and QTableView,QListView etc. view Are visual controls , That is, yes show Control for .

For these View, We know , You usually have to work with one Model binding ,Model Responsible for content addition management ,View Responsible for exhibition . therefore ,QGraphicsView There is also one Model, Namely QGraphicsScene, One scene You can bind multiple view,scene You can set the size , It can also be set without .

QGraphicsScene(qreal x, qreal y, qreal width, qreal height, QObject *parent = nullptr)
 QGraphicsScene(const QRectF &sceneRect, QObject *parent = nullptr)
 QGraphicsScene(QObject *parent = nullptr)

Typical usage codes are as follows :

 QGraphicsScene scene;
 scene.addText("Hello, world!");

 QGraphicsView view(&scene);
 view.show();

Graphics View The function of the framework is , Provides a surface , On this side , Can manage a large number of 2D graphics , Like lines , Rectangle , triangle , circular , For example, the graphics in the flow chart , arrow , Smiley face symbol , Comment box , Various symbols , Now let's make a flow chart software 

原网站

版权声明
本文为[Trendy technology research society]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207071910015448.html