Adding the page

We now create a separate QML document for the ComicPage UI component:

// ComicPage.qmlimport QtQuick 2.9Item {    id: page    width: 480    height: width    Rectangle {        anchors.fill: parent    }}

Nothing new here, except for the fact that we decide the ComicPage to be square-shaped by default, and thus make its height reflect its width. We also do not specify the color of the Rectangle, as we are content with its default value,  "#ffffff". Firing qmlscene will show a non-exciting white square.

Now that the ComicPage is there, we can stack it on top of the TableSurface. Let's first create a  CCPanels.qml document that we will use for testing purposes to combine our components:

// CCPanels.qmlimport QtQuick 2.9TableSurface { ComicPage { } ...

Get End to End GUI Development with Qt5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.