[Qt-interest] Sort Indicator For QTableView Not Showing Up

Dan Alcantra dalcantra at yahoo.com
Wed Feb 8 07:29:04 CET 2012


Hi Qt Experts.

I am using a QTableView and have trouble with the sort indicator not showing up.  This is on Qt 4.7 and 4.8. I even tried to omplement it with the Qt ItemView example call freezedemo.  


In this example I created a slot for the signal sectionClicked(int).  And in this slot I have:

void FreezeTableWidget::sectionClickedSlot(int logicindex)
{
  qDebug() << "sort to " << logicindex;
  frozenTableView->sortByColumn(logicindex,Qt::DescendingOrder);
  frozenTableView->horizontalHeader()->setSortIndicator(logicindex,Qt::DescendingOrder);
  frozenTableView->horizontalHeader()->setSortIndicatorShown(true);
}

It does the sort ok, but I do not see the sort indicator on anything but the first column. And after the frozenTableView gets created I added the following code:

  frozenTableView->setSortingEnabled(true);
      init();
      frozenTableView->horizontalHeader()->setClickable(true);
      frozenTableView->horizontalHeader()->setSortIndicatorShown(true);


Any ideas on how to get the sort indicator to show up ?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20120207/e14b153e/attachment.html 


More information about the Qt-interest-old mailing list