making signal and slots use appropriate signals
This makes it so other DataChanged signals don't reset the view as was happening before.
This commit is contained in:
parent
d2f26e4cc0
commit
4296a205a8
2 changed files with 4 additions and 2 deletions
|
@ -72,7 +72,7 @@ Item {
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: SlideMod
|
target: SlideMod
|
||||||
function onDataChanged() {
|
function onActiveChanged() {
|
||||||
if (active) {
|
if (active) {
|
||||||
previewSlidesList.currentIndex = index;
|
previewSlidesList.currentIndex = index;
|
||||||
previewSlidesList.positionViewAtIndex(index, ListView.Center);
|
previewSlidesList.positionViewAtIndex(index, ListView.Center);
|
||||||
|
|
|
@ -655,7 +655,9 @@ mod slide_model {
|
||||||
if let Some(slide) = self.as_mut().slides_mut().get_mut(index as usize) {
|
if let Some(slide) = self.as_mut().slides_mut().get_mut(index as usize) {
|
||||||
slide.active = true;
|
slide.active = true;
|
||||||
self.as_mut().emit_data_changed(tl, br, &vector_roles);
|
self.as_mut().emit_data_changed(tl, br, &vector_roles);
|
||||||
// self.as_mut().emit_active_changed(); // This function doesn't work
|
// We use this signal generated by our signals enum to tell QML that
|
||||||
|
// the active slide has changed which is used to reposition views.
|
||||||
|
self.as_mut().emit_active_changed();
|
||||||
println!("slide is activating {:?}", index);
|
println!("slide is activating {:?}", index);
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue