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 { id: panelAdder anchors.right: parent.right text: "+" } PanelButton { id: panelRemover anchors.top: panelAdder.bottom anchors.right: parent.right ...