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

Removing a panel from the page

Given what we have done with the previous use case, from a visual point of view, supporting remove panel from page amounts to two activities:

  •  Adding an affordance to the page to trigger the use case (a minus button)
  • Removing an item from the panel's data model

Thanks to the power of Qt Quick, both tasks are pretty trivial. For the first one, we reuse the already created PanelButton by exposing its text property:

// PanelButton.qml...Item {    signal clicked()    property alias text: textItem.text    ...    Text {        id: textItem        ...    }    ...}

Then, we add the instance below panelAdder and expose it:

// ComicPage.qml...Item {    id: page    ...    property alias panelAdder: panelAdder    property alias panelRemover: panelRemover    ... PanelButton ...

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