0

I need to sort my column number 1 in TableView. I followed this link but I get some errors and I'm not really sure why it doesnt work.

In my TableView model qml file I have this:

TableView
{
    ...
    onSortIndicatorColumnChanged: model.sort(1, sortIndicatorOrder)
...

and in cpp file:

    Q_INVOKABLE virtual void sort(int column, Qt::SortOrder order=Qt::AscendingOrder)
    {
        proxyModel=new QSortFilterProxyModel;
        qDebug("Sorting by column %d", column);
        proxyModel->sort(column, order);
    }
ImNew
  • 97
  • 9
  • you cannot call 'QSortFilterProxyModel::sort', because it is not static, ))) there is an example here https://code.qt.io/cgit/qt/qtbase.git/tree/examples/widgets/itemviews/basicsortfiltermodel?h=5.13 – Vahagn Avagyan Jul 24 '19 at 09:25
  • @VahagnAvagyan thank you for your answer, I updated my question. It doesnt show any errors now but it also doesnt work. – ImNew Jul 24 '19 at 11:17
  • have you set to your proxy model your abstract model? I guess you can see the debug output? Can you? – Bob Jul 24 '19 at 11:22
  • @Mikhail I cant – ImNew Jul 24 '19 at 11:26

0 Answers0