mourad
21st November 2011, 15:10
Hello everyone,
I'm tring to sort my data filled in a QTableView. Data are the result of a query.
For that, I've proceed like below :
QSqlQueryModel *modelAb = new QSqlQueryModel(this);
modelAb ->setQuery(query, dbConnexion);
while(modelAb->canFetchMore())
modelAb->fetchMore();
QSortFilterProxyModel * mSortFilterModel = new QSortFilterProxyModel(this);
mSortFilterModel->setDynamicSortFilter(true);
mSortFilterModel->setSourceModel(modelAb);
tabAbonne->setModel(mSortFilterModel);
tabAbonne->setSortingEnabled(true);
My problem is that for some columns, sorting works fine but for the other is not working.
Can anyone help me to resolve this problem.
Best regards.
I'm tring to sort my data filled in a QTableView. Data are the result of a query.
For that, I've proceed like below :
QSqlQueryModel *modelAb = new QSqlQueryModel(this);
modelAb ->setQuery(query, dbConnexion);
while(modelAb->canFetchMore())
modelAb->fetchMore();
QSortFilterProxyModel * mSortFilterModel = new QSortFilterProxyModel(this);
mSortFilterModel->setDynamicSortFilter(true);
mSortFilterModel->setSourceModel(modelAb);
tabAbonne->setModel(mSortFilterModel);
tabAbonne->setSortingEnabled(true);
My problem is that for some columns, sorting works fine but for the other is not working.
Can anyone help me to resolve this problem.
Best regards.