Hi Philipp, 

 

If your view is attached to the proxy model, then you could just emit from the 
proxy itself.  

 

Regards, 

 

Tony

 

 

 

Sent: Friday, 29 November 2013 1:00 AM

I have a proxymodel that is responsible for background image downloading. How 
to I notify the source model (which does not implement setData, doesn't have 
to) that an image has been downloaded? My proxy keeps a cache of downloaded 
images for every row in the source model

 

QVariant ProxyModel:data(index, role) {

  if (role == Qt::DecorationRole) {

    if (cache not contains(index)) {

       startBackgroundDownload(QPersistentIndex(index));

       return placeholderimage;

    } else {

      cachedImage;

    }

  }  

}

 

void ProxyModel::onDownloadFinished(index) {

  // how do I force the sourceModel to refresh?

  emit sourceModel->dataChanged(index, QVector<int>() << Qt::DecorationRole);

}

 

This works, but I know we should not call signals of other objects directly. So 
how would that work otherwise? By connecting the ProxyModels dataChanged signal 
to the sourceModel dataChanged signal?

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to