title: qt5 view different roles of model data
body: <p>I want to use a QTableView to show different roles of an item, e.g. column 1 shows the DisplayRole data, column 2 shows UserRole, column 3 shows UserRole+1, etc</p>
  
  <p>I've created this by making my own item delegate and assigning it to the appropriate column. However, to get access to the same item the delegates have to access their siblings. For example, here's my setEditorData function:</p>
  
  <pre><code>void UserRoleDelegate::setEditorData(QWidget *editor, const QModelIndex &amp;index) const
  {
      QModelIndex baseIndex = index.sibling(index.row(),0);
      QVariant v = baseIndex.data(Qt::UserRole);
      if(v.isValid())
          static_cast&lt;QLineEdit*&gt;(editor)-&gt;setText(v.toString());
  }
  </code></pre>
  
  <p>Right now, it's hardcoded that column 0 contains the real object and other columns just access that via the sibling function. I'm worried, though, that it's fragile in that changing the column order will break it.</p>
  
  <p>There are obvious ways to manage that, but I'm just wondering if I'm taking the right approach. Is there a better option to display different aspects of the same item?</p>