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

Column width being reset unexpected in QTableView

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Duplicate
    • Affects Version/s: 5.9.4
    • Fix Version/s: None
    • Component/s: Widgets: Layout
    • Labels:
      None
    • Environment:
      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

              • Assignee:
                qt.team.quick.subscriptions Qt Quick and Widgets Team
                Reporter:
                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