I guess the question is why you want to return a file through data().

Does the code that reacts to your selection changes not have access to your model type? I.e. you can't do something like
Qt Code:
  1. m_model->fileForModelIndex(modelIndex);
To copy to clipboard, switch view to plain text mode 
because you don't have access to m_model as a pointer of your model type?

And you also don't have access to the actual data, as in you can't do
Qt Code:
  1. QString filename = modelIndex.data(MyRoles::FilenameRole);
  2. ... m_zipFile->file(filename);
To copy to clipboard, switch view to plain text mode 
because there is no mappable identifier?

Cheers,
_