Behave differently in qt 5.9.4.
Unsolved
General and Desktop
-
#include <QApplication> #include <QTableView> #include <QStandardItem> #include <QStandardItemModel> int main(int argc, char *argv[]) { QApplication a(argc, argv); QTableView view; QStandardItemModel model; model.setHorizontalHeaderItem(0, new QStandardItem(QObject::tr("Column 1"))); model.setHorizontalHeaderItem(1, new QStandardItem(QObject::tr("Column 2"))); model.setItem(0, 0, new QStandardItem("a")); model.setItem(0, 1, new QStandardItem("b")); view.setModel(&model); view.setSortingEnabled(true); view.show(); return a.exec(); }
Run above code, then change colum width. Column width will be reset to default when I click HorizontalHeader to perform a sorting.
Such behavior is not seen in qt 5.9.3 or qt 5.10.1. platform is linux
Does anyone know the trick?I have reported a bug, but no response now.
-
The report is: https://bugreports.qt.io/browse/QTBUG-67131
@Mr-Pang: It looks like your problem is https://bugreports.qt.io/browse/QTBUG-65478 which should be fixed in Qt 5.9.5.