QSortFilterProxy sorting works on Linux but fails on Windows
-
I use MariaDB,
when i run this code on linux all works fine, clicking on the column changes the sorting of the table rowsI was using qt 6.8.
Since 6.10.1 cross-compiled to Windows with MXE when i run this code on windows10 when I click on column i can see the sorting indicators changing but sorting of rows does not happen
void MainWindow::on_PB_stany_filtruj_clicked() { if (!model_stany) { model_stany = new QSqlQueryModel(this); model_stany_proxy = new QSortFilterProxyModel(this); model_stany_proxy->setSourceModel(model_stany); model_stany_proxy->setDynamicSortFilter(true); ui->TV_stany_magazynowe->setModel(model_stany_proxy); ui->TV_stany_magazynowe->setSortingEnabled(true); } QString filtruj_stany; if (ui->RB_stany_filtruj_nazwa->isChecked()) filtruj_stany=" TwrKarty.nazwa like :filter"; QSqlQuery query_stany; query_stany.prepare("SELECT TwrKarty.twr_id,TwrKarty.kod, TwrKarty.nazwa FROM TwrKarty "); query_stany.bindValue(":filter", "%"+ui->LE_stany_filtruj->text()+"%"); query.exec(); model_stany->setQuery(query_stany); } -
Please provide a minimal compilable example, without sql but a simple qt provided model and no mainwindow as this should not be needed to provide a mre
-
i verified it, this is qt6.10 bug in windows only
qt 6.9.3 works fine on both Linux and Windows whereas Qt 6.10 (and 6.10.1) has this bug on windows
even more, it not only fails to sort, it also causes a crash ocasionally
-
@Seb-Tur This might be due to this then : https://qt-project.atlassian.net/browse/QTBUG-141830
-
J JonB referenced this topic