attempt at fixing bug with slides not activating with service item
This commit is contained in:
parent
4685c9eb70
commit
c6700907b1
5 changed files with 55 additions and 14 deletions
|
|
@ -120,7 +120,9 @@ mod service_item_model {
|
|||
bottom_right: &'a QModelIndex,
|
||||
roles: &'a QVector_i32,
|
||||
},
|
||||
ActiveChanged,
|
||||
ActiveChanged {
|
||||
index: &'a i32,
|
||||
},
|
||||
SelectedChanged,
|
||||
ItemInserted {
|
||||
index: &'a i32,
|
||||
|
|
@ -630,7 +632,7 @@ mod service_item_model {
|
|||
);
|
||||
// We use this signal generated by our signals enum to tell QML that
|
||||
// the active service_item has changed which is used to reposition views.
|
||||
self.as_mut().emit_active_changed();
|
||||
self.as_mut().emit_active_changed(&index);
|
||||
true
|
||||
} else {
|
||||
false
|
||||
|
|
@ -676,7 +678,7 @@ mod service_item_model {
|
|||
);
|
||||
// We use this signal generated by our signals enum to tell QML that
|
||||
// the active service_item has changed which is used to reposition views.
|
||||
self.as_mut().emit_active_changed();
|
||||
// self.as_mut().emit_active_changed(index);
|
||||
true
|
||||
} else {
|
||||
false
|
||||
|
|
|
|||
|
|
@ -864,6 +864,28 @@ mod slide_model {
|
|||
qvariantmap
|
||||
}
|
||||
|
||||
#[qinvokable]
|
||||
pub fn get_slide_from_service(
|
||||
self: Pin<&mut Self>,
|
||||
index: i32,
|
||||
) -> i32 {
|
||||
let slides = self.slides().clone();
|
||||
let slides_iter = slides.iter();
|
||||
debug!(
|
||||
service_item = index,
|
||||
"Getting slide from this item"
|
||||
);
|
||||
let mut id = 0;
|
||||
for (i, slide) in slides_iter
|
||||
.filter(|slide| slide.service_item_id == index)
|
||||
.enumerate()
|
||||
{
|
||||
id = i as i32;
|
||||
break;
|
||||
}
|
||||
id
|
||||
}
|
||||
|
||||
#[qinvokable]
|
||||
pub fn activate(
|
||||
mut self: Pin<&mut Self>,
|
||||
|
|
@ -883,16 +905,21 @@ mod slide_model {
|
|||
if let Some(slide) =
|
||||
self.as_mut().slides_mut().get_mut(index as usize)
|
||||
{
|
||||
println!("slide is activating {:?}", index);
|
||||
println!("slide-title: {:?}", slide.service_item_id);
|
||||
println!(
|
||||
"slide-image-background: {:?}",
|
||||
slide.image_background
|
||||
);
|
||||
println!(
|
||||
"slide-video-background: {:?}",
|
||||
slide.video_background
|
||||
debug!(
|
||||
slide = index,
|
||||
service_item = slide.service_item_id,
|
||||
"This slide is activating"
|
||||
);
|
||||
// println!("slide is activating {:?}", index);
|
||||
// println!("slide-title: {:?}", slide.service_item_id);
|
||||
// println!(
|
||||
// "slide-image-background: {:?}",
|
||||
// slide.image_background
|
||||
// );
|
||||
// println!(
|
||||
// "slide-video-background: {:?}",
|
||||
// slide.video_background
|
||||
// );
|
||||
slide.active = true;
|
||||
self.as_mut().emit_data_changed(
|
||||
tl,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue