title: Show a context menu when the a column in a QTableView is selected
body: <p>I have a QTableView and I am trying to show up a context menu which appears only when a whole column is selected. I also need the number of the column selected for further purposes. I connected the <code>currentChanged()</code> signal of the Selection Model (reimplemented as <code>TabSelModel</code> here) to this slot</p>
  
  <pre><code>void TabSelModel::CheckSelection(const QModelIndex&amp; mod)
  {
      qDebug() &lt;&lt; "Inside mod.column=" &lt;&lt; mod.column();
      QModelIndexList ls = selectedIndexes();
  
      foreach(QModelIndex i, ls)
          qDebug() &lt;&lt; i.column() &lt;&lt; "," &lt;&lt; i.row();
  
      if(isColumnSelected(mod.column(),mod))      //never evaluates to true
          ColSelected = qMakePair(true,mod);
  }
  </code></pre>
  
  <p>And the first time I select the first column of the table the output is just</p>
  
  <pre><code>Inside mod.column= 0
  </code></pre>
  
  <p>When I select the next column I get</p>
  
  <pre><code>Inside mod.column= 1
  0 , 0
  0 , 1
  0 , 2
  0 , 3
  ...
  0, 66
  </code></pre>
  
  <p>Which means that <code>mod.column()</code> gives 1 but <code>selectedIndexes()[0].column()</code> gives 0 which is why (I think) I never manage to get into the <code>if</code> clause. Why is that? And how to fix that?</p>
  
  <p>Analysing the beheaviour it seems that <code>selectedIndexes()</code> registers the indexes that were <em>previously</em> selected while the index I receive with <code>currentChanged()</code> is the current one. If this is true I still do not know how to fix this problem.</p>