[Interest] Migration path from QGraphicsScene to QtQuick2

Igor Mironchik igor.mironchik at gmail.com
Fri Apr 15 15:29:41 CEST 2016



On 15.04.2016 15:57, Jean-Michaƫl Celerier wrote:
>
> On Fri, Apr 15, 2016 at 12:15 PM, Igor Mironchik 
> <igor.mironchik at gmail.com <mailto:igor.mironchik at gmail.com>> wrote:
>
>
>
>     Can I ask you why you need to migrate from QGraphicsScene to QtQuick?
>
>
> Hi,
>
> I like the scene graph rendering being done in another thread, and 
> more importantly
> I wish to provide the ability to write plug-ins in QML for my 
> software, which is
> much easier than C++ for the end-user.
>
> I'll try overriding QQuickItem but what I am not able to grasp is how 
> everything is supposed to happen in
> term of scene management.
> Can I just keep the same parent - children relationship ?

I think so.

> Do transforms work the same ?
> For instance I don't see boundingRect in QQuickItem and many of the 
> "more graphical"
> functions seems to be split between QQuickItem and various QSGNode[...].

All visual QML items are rendered using the scene graph, a low-level, 
high-performance rendering stack, closely tied to OpenGL. It is possible 
for subclasses ofQQuickItem <http://doc.qt.io/qt-5/qquickitem.html>to 
add their own custom content into the scene graph by setting 
theQQuickItem::ItemHasContents 
<http://doc.qt.io/qt-5/qquickitem.html#Flag-enum>flag and reimplementing 
theQQuickItem::updatePaintNode 
<http://doc.qt.io/qt-5/qquickitem.html#updatePaintNode>() function.

*Warning:*It is crucial that OpenGL operations and interaction with the 
scene graph happens exclusively on the rendering thread, primarily 
during theupdatePaintNode 
<http://doc.qt.io/qt-5/qquickitem.html#updatePaintNode>() call. The best 
rule of thumb is to only use classes with the "QSG" prefix inside 
theQQuickItem::updatePaintNode 
<http://doc.qt.io/qt-5/qquickitem.html#updatePaintNode>() function.

*Note:*All classes with QSG prefix should be used solely on the scene 
graph's rendering thread. SeeScene Graph and Rendering 
<http://doc.qt.io/qt-5/qtquick-visualcanvas-scenegraph.html#scene-graph-and-rendering>for 
more information.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160415/9cb9453d/attachment.html>


More information about the Interest mailing list