Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-67131

Column width being reset unexpected in QTableView

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2: Important
    • None
    • 5.9.4
    • Widgets: Layout
    • None
    • gentoo linux with kde5, qt 5.9.4, kernel 4.15.0

      This problem only appers in qt 5.9.4, not found in 5.9.3 and 5.10.1

    Description

      // code placeholder
      

      The column width is reset when I sort the row. 

      Run below code, then change column width, then click HorizontalHeader to sort . column will be reset to default.

      Code:

       

      #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();
       }
      

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              pangqingyuan1991 Pang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes