O'Reilly logo

Qt 5 Projects by Marco Piccolino

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Managing comic panels with a grid layout

Among the types provided by the Qt Quick Layouts module, the GridLayout is the one which allows us to place its children in a grid arrangement, by defining the columns and/or rows of the desired grid, and a few additional properties. We go ahead and create a GridLayout object in our drawingSurface:

// ComicPage.qml...import QtQuick.Layouts 1.3Item {    id: page    ...    Item {        id: drawingSurface        anchors.fill: parent        anchors.margins: 32        GridLayout {            id: panelsGrid            anchors.fill: parent            rows: 1            columns: 0        }    }}

The layout fills the drawingSurface and has, initially, no columns and one row. Remember that, in our use-case scenarios, we wanted the added panels to grow from left to right, so we just need one row for ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required