title: Qt Qtableview not getting signal for header item clicking
body: <p>I am using <code>Qtableview</code> with <code>QsqlTableModel</code> for populating a table data. I want to sort the column based on user selection on column header.</p>
  
  <p>I tried the way mentioned in <a href="https://stackoverflow.com/questions/3081340/qtableview-sorting-signal">QTableView sorting signal?</a> for getting the signal (get the horizontal header from <code>QtableView</code> and connect signal <code>sectionclicked(int logical index)</code>. But the same signal is not getting emitted when i click on column header.</p>
  
  <p>Please find the code where connection is done:</p>
  
  <p><strong>Member variable:</strong></p>
  
  <pre><code>QHeaderView *m_horiz_header;
  </code></pre>
  
  <p><strong>.cpp file</strong></p>
  
  <pre><code>m_sqltablemodel-&gt;setTable(tabel_name);
  m_sqltablemodel-&gt;setEditStrategy(QSqlTableModel::OnManualSubmit);
  m_sqltablemodel-&gt;select();
  
  m_horiz_header= m_table_view-&gt;horizontalHeader();
  connect(m_horiz_header, SIGNAL(sectionClicked ( int logicalIndex ) ),
      this, SLOT(on_sectionClicked ( int logicalIndex ) ));
  </code></pre>
  
  <p><strong>Slot function for sorting:</strong></p>
  
  <pre><code>void class::on_sectionClicked ( int logicalIndex ) 
  {
      m_horiz_header-&gt;setSortIndicator(logicalIndex, Qt::AscendingOrder);
      m_table_view-&gt;sortByColumn(logicalIndex);
  }
  </code></pre>
  
  <p>This function is not getting called, when column header is clicked.</p>
  
  <p>Can you please help me how to do this, where I went wrong?</p>