November 2018
Intermediate to advanced
1150 pages
24h 11m
English
Instead of having to change the model from code, as we did in the last line of the scene, we want the panels number to increase when pressing the "+" button. Let's do a little refactoring and extract panelAdder as a standalone component into a separate PanelButton document, so that we can expose the clicked signal of its MouseArea in a clean way:
// PanelButton.qmlimport QtQuick 2.0Item { signal clicked() width: 40 height: width anchors.right: parent.right opacity: 0.5 Text { text: "+" anchors.centerIn: parent font.pixelSize: 40 } MouseArea { onClicked: parent.clicked() anchors.fill: parent }}
Read now
Unlock full access