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

Simulating the usecase action

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    }}  
Unlike properties, signals cannot be aliased, hence the need to "repeat" the signal from the inner object to the outer ...

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