该用 QGraphicsView ? QtQuick-QML ?

时间:2023-03-09 19:32:22
该用 QGraphicsView ? QtQuick-QML ?

目前QtQuick (2014/3/6) 已经发展了有一段时间了,很多人在用因此我也想看看是否适合我目前的项目。

我要做的是一个类似3DMax中的材质编辑器的东西,里面有成千上万的”表单“(不知道怎么形容它),目前是结构是基于QGraphicsView的,但我需要很多的控件才能组装起来,Qt中提供复杂控件的部分有:QWidget和QtQuick。QWidget的复杂度比我需要的要高,使用它会极大的降低我的项目的运行效率(已测试)。而QtQuick是我目前想观测的架构。想看看它是否与QGraphicsView有什么交集,又或者是否可以完全取代QGraphicsView。

找到网络上的一片文章:http://qt-project.org/forums/viewthread/4360(也正是此文章让我有了确定一句)

文中有几个地方我格外注意:

1,the fact is that using QML and QT-Quick to develop the User Interface you can work with a descriptive language and separate the interface from logic. —— QtQuick 是为了解耦:控件 和 逻辑应用的。

2,That performance penalty may nor may not apply. —— 效率是个问题。

3,while QML is currently build on the GraphicsView framework, it is perfectly possible to make it work on a different graphical backend. —— (大致是说:)QML目前是基于GraphicsView架构的,它可以绘制在其它的后备缓冲区。

4,You will not be able to get the kind of speedups you get then with GraphicsView or anywhere else in the QWidget world. —— (大致是说:)它比不上 GraphicsView 和 QWidget 的效率。

另:感谢Qt QQ 群内朋友的帮助。