Use pageStack.popHiddenPages

This uses a new property in Kirigami to simplify the code.
This commit is contained in:
Devin Lin 2022-12-18 10:24:15 +00:00 committed by Bart De Vries
parent 22f882e477
commit c30bfbb5a5
2 changed files with 2 additions and 21 deletions

View File

@ -12,7 +12,7 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(KF5_MIN_VERSION "5.89.0")
set(KF5_MIN_VERSION "5.101.0")
set(QT_MIN_VERSION "5.15.0")
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)

View File

@ -24,6 +24,7 @@ Kirigami.ApplicationWindow {
height: Kirigami.Settings.isMobile ? 660 : 600
pageStack.clip: true
pageStack.popHiddenPages: true
pageStack.globalToolBar.style: Kirigami.ApplicationHeaderStyle.ToolBar;
pageStack.globalToolBar.showNavigationButtons: Kirigami.ApplicationHeaderStyle.ShowBackButton;
@ -96,26 +97,6 @@ Kirigami.ApplicationWindow {
}
}
// pop pages when not in use
Connections {
target: applicationWindow().pageStack
function onCurrentIndexChanged() {
// wait for animation to finish before popping pages
timer.restart();
}
}
Timer {
id: timer
interval: 300
onTriggered: {
let currentIndex = applicationWindow().pageStack.currentIndex;
while (applicationWindow().pageStack.depth > (currentIndex + 1) && currentIndex >= 0) {
applicationWindow().pageStack.pop();
}
}
}
Component.onDestruction: {
saveWindowLayout();
}