@@ -26,7 +26,7 @@ Item {
2626 readonly property int currentItemIndex: currentItem ? currentItem.ownIndex : -1
2727 property alias row: row
2828 property QtObject indicatorsModel: null
29− property var visibleIndicators: defined
29+ property var visibleIndicators: undefined
3030 property int overFlowWidth: width
3131 property bool showAll: false
3232 property real currentItemOffset: 0.0
@@ -94,34 +94,56 @@ Item {
9494 property real opacityMultiplier: highlighted ? 1 : (1 - indicatorRow.unitProgress)
9595
9696 IndicatorItem {
97− id: indicatorItem
98− identifier: model.identifier
99− height: parent.height
100−
101− dimmed: itemWrapper.dimmed
102−
103− widgetSource: model.widgetSource
104− indicatorProperties : model.indicatorProperties
105−
106− Component.onCompleted: {
107− if (visibleIndicators == undefined) {
108− visibleIndicators = {}
109− }
110− indicatorRow.visibleIndicators[model.identifier] = indicatorVisible;
111− indicatorRow.visibleIndicatorsChanged();
112− }
113− onIndicatorVisibleChanged: {
114− if (visibleIndicators == undefined) {
115− visibleIndicators = {}
116− }
117− indicatorRow.visibleIndicators[model.identifier] = indicatorVisible;
118− indicatorRow.visibleIndicatorsChanged();
119−
120− if (indicatorVisible) {
121− showAll = true;
122− allVisible.start();
123− }
124− }
97+ id: indicatorItem
98+ identifier: model.identifier
99+ height: parent.height
100+
101+ dimmed: itemWrapper.dimmed
102+
103+ widgetSource: model.widgetSource
104+ indicatorProperties : model.indicatorProperties
105+
106+ Component.onCompleted: {
107+ updateVisiblility();
108+ }
109+ onIndicatorVisibleChanged: {
110+ updateVisiblility();
111+
112+ if (indicatorVisible) {
113+ showAll = true;
114+ allVisible.start();
115+ }
116+ }
117+
118+ function updateVisiblility() {
119+ if (visibleIndicators == undefined) {
120+ visibleIndicators = {}
121+ }
122+ indicatorRow.visibleIndicators[model.identifier] = indicatorVisible;
123+
124+ // removed current index?
125+ if (indicatorRow.currentItemIndex === index && !indicatorVisible) {
126+ // find the next closest visible indicator (after current, else before)
127+ var newIndex = -1;
128+ for (var i = index+1; i < rowRepeater.count; i++) {
129+ if (indicatorRow.visibleIndicators[i] === undefined || indicatorRow.visibleIndicators[model.identifier]) {
130+ newIndex = i;
131+ break;
132+ }
133+ }
134+ if (newIndex === -1) {
135+ for (i = index - 1; i >= 0; i--) {
136+ if (indicatorRow.visibleIndicators[i] === undefined || indicatorRow.visibleIndicators[model.identifier]) {
137+ newIndex = i;
138+ break;
139+ }
140+ }
141+ }
142+ indicatorRow.setCurrentItem(newIndex);
143+ }
144+
145+ indicatorRow.visibleIndicatorsChanged();
146+ }
125147 }
126148
127149 states: [