Model undo stack is accessible in QML. Added Undo & Redo buttons, which are properly en-/disabled and have informative texts.
This commit is contained in:
49
ListPage.qml
49
ListPage.qml
@ -5,24 +5,45 @@ import QtQuick.Controls.Material
|
||||
Page {
|
||||
id: page
|
||||
|
||||
ListView {
|
||||
id: listView
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
focus: true
|
||||
clip: true
|
||||
|
||||
model: mainModel
|
||||
ListView {
|
||||
id: listView
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
focus: true
|
||||
clip: true
|
||||
|
||||
// delegate: ListItemDelegate {}
|
||||
delegate: ExpandableItemDelegate {}
|
||||
// delegate: EditableItemDelegate {}
|
||||
delegateModelAccess: DelegateModel.ReadWrite
|
||||
model: mainModel
|
||||
|
||||
header: bannercomponent
|
||||
footer: Rectangle {
|
||||
width: parent.width
|
||||
height: 30
|
||||
gradient: mainGradient
|
||||
// delegate: ListItemDelegate {}
|
||||
delegate: ExpandableItemDelegate {}
|
||||
// delegate: EditableItemDelegate {}
|
||||
delegateModelAccess: DelegateModel.ReadWrite
|
||||
|
||||
header: bannercomponent
|
||||
footer: Rectangle {
|
||||
width: parent.width
|
||||
height: 30
|
||||
gradient: mainGradient
|
||||
}
|
||||
}
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
text: "Undo: " + appUndoStack.undoText
|
||||
enabled: appUndoStack.canUndo
|
||||
onClicked: {
|
||||
appUndoStack.undo()
|
||||
}
|
||||
}
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
text: "Redo: " + appUndoStack.redoText
|
||||
enabled: appUndoStack.canRedo
|
||||
onClicked: {
|
||||
appUndoStack.redo()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user