问题描述和解决方案:

 

 onCutImage: {
            if(isAdded){
                currentModel.insert(currentModel.count, {"imageURL":String(cutImagePrefix + url), "notifyVisible":true})
            }
            else{
                currentModel.set(imgIndex, {"imageURL": "", "notifyVisible":true})//1.先把路径置空
                currentModel.set(imgIndex, {"imageURL":String(cutImagePrefix + url), "notifyVisible":true})//2.然后再设置成应该的路径
} picEdit.close() }
 Image{
        id:imgItem
        cache:false//3.把Image的cache属性设置为false
        asynchronous:true
        source: ""
        sourceSize.width: 30/ratio
        sourceSize.height:30/ratio
        smooth: true
    }

1.因为新版本的Qt的图片缓存机制,导致相同路径的图片只会加载一次。所以要cache = false

2.因为model.set的object是一样的,可能没有触发model数据的刷新,所以要先set(index, {"imageURL" :""})

两个地方修改之后完美解决~

相关文章:

  • 2022-03-10
  • 2022-12-23
  • 2021-07-01
  • 2022-12-23
  • 2022-12-23
  • 2021-04-29
  • 2021-07-05
  • 2022-12-23
猜你喜欢
  • 2022-01-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-26
  • 2022-12-23
相关资源
相似解决方案