bug: fixing some adding and updating issues
This commit is contained in:
parent
f084e6d88d
commit
82466ee6fc
2 changed files with 19 additions and 5 deletions
|
@ -120,7 +120,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeImage(index) {
|
function changeImage(index) {
|
||||||
let img = imageProxyModel.getImage(index);
|
let img = imageProxyModel.imageModel.getItem(index);
|
||||||
root.image = img;
|
root.image = img;
|
||||||
console.log(img.filePath.toString());
|
console.log(img.filePath.toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,8 +220,15 @@ mod image_model {
|
||||||
.execute(db);
|
.execute(db);
|
||||||
match result {
|
match result {
|
||||||
Ok(_i) => {
|
Ok(_i) => {
|
||||||
let image = self.as_mut().images_mut().get_mut(index as usize).unwrap();
|
for image in self
|
||||||
image.title = updated_title;
|
.as_mut()
|
||||||
|
.images_mut()
|
||||||
|
.iter_mut()
|
||||||
|
.filter(|x| x.id == index)
|
||||||
|
{
|
||||||
|
image.title = updated_title.clone();
|
||||||
|
println!("rust-title: {:?}", image.title);
|
||||||
|
}
|
||||||
self.as_mut()
|
self.as_mut()
|
||||||
.emit_data_changed(model_index, model_index, &vector_roles);
|
.emit_data_changed(model_index, model_index, &vector_roles);
|
||||||
true
|
true
|
||||||
|
@ -246,8 +253,15 @@ mod image_model {
|
||||||
.execute(db);
|
.execute(db);
|
||||||
match result {
|
match result {
|
||||||
Ok(_i) => {
|
Ok(_i) => {
|
||||||
let image = self.as_mut().images_mut().get_mut(index as usize).unwrap();
|
for image in self
|
||||||
image.path = updated_file_path;
|
.as_mut()
|
||||||
|
.images_mut()
|
||||||
|
.iter_mut()
|
||||||
|
.filter(|x| x.id == index)
|
||||||
|
{
|
||||||
|
image.path = updated_file_path.clone();
|
||||||
|
println!("rust-title: {:?}", image.path);
|
||||||
|
}
|
||||||
self.as_mut()
|
self.as_mut()
|
||||||
.emit_data_changed(model_index, model_index, &vector_roles);
|
.emit_data_changed(model_index, model_index, &vector_roles);
|
||||||
true
|
true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue