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

QHeaderview : CascadingSectionResizes do not resize correctly in both directions.

    XMLWordPrintable

Details

    Description

      A QHeaderview with CascadingSectionResizes set to true will not resize correctly if you drag a header so large that the handle moves off the screen.
      When you return the handle to the original location the columns after the grabbed one are incorrectly sized.

      To see the behavior:
      1. Execute example below
      2. Two tables appear. A problem occurs at the table of the upper part.
      3. Drag the boundary line of the header and resize it in the right direction.
      4. Return a cursor to the drug start position without releasing it.

      Notice that on the top view the size of the header does not return to original size.
      On the view on the bottom (with no CascadingSectionResizes), size is restored.

      #include <QtGui>
      class Widget : public QWidget {
      public:
          Widget() : QWidget(0) {
      
              QTableView *tableCascade   = new QTableView;
              tableCascade->horizontalHeader()->setCascadingSectionResizes(true);
      
              QTableView *tableNoCascade = new QTableView;
              tableNoCascade->horizontalHeader()->setCascadingSectionResizes(false);
      
              QStandardItemModel *dataSource = new QStandardItemModel(5, 5);
              tableCascade->setModel(dataSource);
              tableNoCascade->setModel(dataSource);
      
              QVBoxLayout *vlay = new QVBoxLayout;
              vlay->addWidget(new QLabel("<h1>setCascadingSectionResizes(true)</h1>"));
              vlay->addWidget(tableCascade);
              vlay->addWidget(new QLabel("<h1>setCascadingSectionResizes(false)</h1>"));
              vlay->addWidget(tableNoCascade);
              setLayout(vlay);
      
              resize(800, 600);
      
          }
      };
      
      int main(int argc, char *argv[]) {
          QApplication app(argc, argv);
      
          Widget w;
          w.show();
      
          return app.exec();
      }
      

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            dettman Dean Dettman (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes