Unsolved problem with the sort indicator in QHeaderView QT5
-
Sort display image does not match the sort order.
code:QSqlRelationalTableModel *model = new QSqlRelationalTableModel(); model->setTable("records"); ui->tableView->setSortingEnabled(true); connect(ui->tableView->horizontalHeader(), &QHeaderView::sortIndicatorChanged, this, &MainWindow::on_sortChanged); ui->tableView->setModel(model); model->select();
slot:
void MainWindow::on_sortChanged(int index, Qt::SortOrder order) { qDebug() << index << order << ui->tableView->horizontalHeader()->sortIndicatorOrder(); }
when i click to header, i see:
but qDebug print:
0 Qt::SortOrder(DescendingOrder) Qt::SortOrder(DescendingOrder)
I tried Qt 5.7.0 and Qt 5.6.2
It's a QT bug or I doing something wrong? -
Hi and welcome to devnet,
Are you running a Gnome desktop environment ?
-
@SGaist Thanks! No, it's KDE (Kubuntu 16.10 x64)
-
Can you check with your distribution provided Qt ?
Also, can you try with one of KDE's application like KMail or any other that uses a QTableView ?
-
@SGaist Kontact and Krusader apps has the same bug.
-
Build application on Windows 7. No bug.
-
Then it looks rather like a KDE Theme issue. You should check with them.
-
I think it is a "feature" in Qt style code:
Some UI developers thinks, that "^" is ascending sort indicator, other thinks it is a descending sort indicator.
Qt platfom-dependend styles (QWindowsVistaStyle, QMacStyle, QGtkStyle, etc..) will draw indicator using current OS & theme settings, platform-independend styles (QFusionStyle, QWindowsStyle) will draw it as hardcoded in Q***Style.cpp