[Qt-interest] Sort Indicator For QTableView Not Showing Up
Adrien Guinet
adrien at guinet.me
Wed Feb 8 07:43:27 CET 2012
Le 08/02/2012 07:29, Dan Alcantra a écrit :
> 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
>
Hello,
Have you tried to set frozenTableView->setSortingEnabled(true) ?
Regards,
--
Adrien.
More information about the Qt-interest-old
mailing list