fixed bug: activating service item switches the slide list properly
This commit is contained in:
parent
03f6871fe1
commit
3c2f74ae66
3 changed files with 16 additions and 15 deletions
|
@ -231,6 +231,16 @@ FocusScope {
|
||||||
NumberAnimation {properties: "x, y"; duration: 100}
|
NumberAnimation {properties: "x, y"; duration: 100}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: SlideMod
|
||||||
|
function onActiveChanged(index) {
|
||||||
|
console.log("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
|
||||||
|
console.log(index);
|
||||||
|
previewSlidesList.currentIndex = index;
|
||||||
|
previewSlidesList.positionViewAtIndex(index, ListView.Center);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
|
|
|
@ -85,16 +85,4 @@ Item {
|
||||||
propagateComposedEvents: true
|
propagateComposedEvents: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: SlideMod
|
|
||||||
function onActiveChanged() {
|
|
||||||
if (active) {
|
|
||||||
console.log("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
|
|
||||||
console.log(index);
|
|
||||||
previewSlidesList.currentIndex = index;
|
|
||||||
previewSlidesList.positionViewAtIndex(index, ListView.Center);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,9 @@ mod slide_model {
|
||||||
bottom_right: &'a QModelIndex,
|
bottom_right: &'a QModelIndex,
|
||||||
roles: &'a QVector_i32,
|
roles: &'a QVector_i32,
|
||||||
},
|
},
|
||||||
ActiveChanged,
|
ActiveChanged {
|
||||||
|
index: &'a i32,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Role {
|
enum Role {
|
||||||
|
@ -877,9 +879,10 @@ mod slide_model {
|
||||||
);
|
);
|
||||||
let mut id = 0;
|
let mut id = 0;
|
||||||
for (i, slide) in slides_iter
|
for (i, slide) in slides_iter
|
||||||
.filter(|slide| slide.service_item_id == index)
|
|
||||||
.enumerate()
|
.enumerate()
|
||||||
|
.filter(|(i, slide)| slide.service_item_id == index)
|
||||||
{
|
{
|
||||||
|
debug!(slide_id = i, ?slide);
|
||||||
id = i as i32;
|
id = i as i32;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -928,7 +931,7 @@ mod slide_model {
|
||||||
);
|
);
|
||||||
// We use this signal generated by our signals enum to tell QML that
|
// We use this signal generated by our signals enum to tell QML that
|
||||||
// the active slide has changed which is used to reposition views.
|
// the active slide has changed which is used to reposition views.
|
||||||
self.as_mut().emit_active_changed();
|
self.as_mut().emit_active_changed(&index);
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue