[Development] Qt Contributor Summit 2019 sessions

Uwe Rathmann Uwe.Rathmann at tigertal.de
Fri Nov 8 10:50:39 CET 2019


On 11/8/19 9:51 AM, Richard Weickelt wrote:

>> doing scene graph node composition ? > What is the latter?

It is mostly about having a lower memory footprint.

a)

With QML you only have access to ~heavy objects like QQuickItem and the 
controls are usually compositions of basic items like text/image/rectangle.

F.e a page indicator with n bullets from QC2 is made of n + 3 
QQuickItems. Each item has an impact on the scene graph as it adds at 
least an additional transform node. Each bullet is a QQuickRectangle, 
that has a gradient made of stops. Each gradient and each stop of each 
rectangle is a QObject.

I leave it up you to sum things up:

sizeof( QSGNode ): 80
sizeof( QSGTransformNode ): 216

sizeof( QObjectPrivate ): 112
sizeof( QObject ): 16

sizeof( QQuickItemPrivate ): 320
sizeof( QQuickItem ) : 32

The page indicator of QSkinny is exactly 1 QQuickitem that creates 
exactly one node per bullet.

The same technique is used for almost all QSkinny controls - f.e a push 
button is made of Panel/Image/Text nodes. The maybe most extreme example 
is the listbox that is also one QQuickItem only.

b)

Having access to the nodes also allows a more memory aware approach 
about when to create/destroy nodes.

The application driving QSkinny is a beast of ~250K lines of code, 
having ~2000 different images. For applications like these you simply 
have to be careful about resources.

> I'm not sure if that is what You have in mind, but I think that QML's
> language features:

No, I don't want to make a statement about QML vs. C++. This is 
something that needs to be decided based on the situation of a project 
and the preferences of the development team.

But of course you need to do C++ when accessing the scene graph or its 
nodes.

ciao,
Uwe



More information about the Development mailing list