Important Concepts In Qt Quick Ultralite - The Visual Canvas

坐标系统

The top-left pixel in the Qt Quick Ultralite coordinate system is the [0, 0] pixel. The coordinate system of a child item is relative to its visual parent item. See the documentation on the 坐标系统 for in-depth information about the coordinate system utilized by Qt Quick Ultralite.

视觉父级

There are two separate kinds of parenting in a QML application which uses Qt Quick Ultralite. The first kind is the ownership-parent which determines object lifetime semantics. The second kind is the visual parent which determines where on the canvas an item is drawn, and also certain properties (for example, opacity applies to visual children).

In almost all cases, the visual parent is identical to the ownership-parent. See the documentation about the 视觉父级 for more in-depth information on the topic.

场景图形

Using a scene graph for graphics rather than the traditional imperative painting systems (QPainter and similar), means the scene to be rendered can be retained between frames and the complete set of primitives to render is known before rendering starts. This opens up for a number of optimizations, such as batch rendering to minimize state changes and discarding obscured primitives.

For example, say a user-interface contains a list of ten items where each item has a background color, an icon and a text. Using the traditional drawing techniques, this would result in 30 draw calls and a similar amount of state changes. A scene graph, on the other hand, could reorganize the primitives to render such that all backgrounds are drawn in one call, then all icons, then all the text, reducing the total amount of draw calls.