primarytabbar: use synchronizer to simplify bindings

This commit is contained in:
end-4
2025-10-30 00:03:18 +01:00
parent 9fe68c5a38
commit 714895976f
4 changed files with 25 additions and 27 deletions
@@ -5,6 +5,7 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Qt5Compat.GraphicalEffects
import Qt.labs.synchronizer
Item {
id: root
@@ -58,9 +59,8 @@ Item {
id: tabBar
visible: root.tabButtonList.length > 1
tabButtonList: root.tabButtonList
externalTrackedTab: root.selectedTab
function onCurrentIndexChanged(currentIndex) {
root.selectedTab = currentIndex
Synchronizer on currentIndex {
property alias source: root.selectedTab
}
}
@@ -71,7 +71,7 @@ Item {
Layout.fillHeight: true
spacing: 10
currentIndex: tabBar.externalTrackedTab
currentIndex: root.selectedTab
onCurrentIndexChanged: {
tabBar.enableIndicatorAnimation = true
root.selectedTab = currentIndex