I have a column in my table view that holds links to either an online PDF, or a local one. The default editor is fine for just adding web links, but more troublesome for adding a file path. I made a dialog where the user can paste a web link, or open a QFileDialog to get the path. I currently have, in createEditor()
Qt Code:
  1. else if(header == "Datasheet")
  2. {
  3. AddPDFDialog *dialog = new AddPDFDialog(parent);
  4. connect(dialog, SIGNAL(pdfAdded(QString)),
  5. this, SLOT(addPDF(QString)));
  6. dialog->exec();
  7. model->setData(index, path);
  8.  
  9. return QStyledItemDelegate::createEditor(parent, option, index);
  10. }
To copy to clipboard, switch view to plain text mode 
and use
Qt Code:
  1. void CompleterDelegate::addPDF(QString path)
  2. {
  3. this->path = path;
  4. }
To copy to clipboard, switch view to plain text mode 
to catch the slot. this->path is a public QString.

It works fine, so far, but it seems like sort of a hack creating the variable. Is there a way to access the slot, directly, inside of createEditor()?