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

QHeaderView expands column beyond the maximum size

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.9.3
    • 5.9.2
    • Widgets: Itemviews
    • None
    • Kubuntu 16.04 amd64
    • b4f4c384d9ee7cf93cc3db289a7d4275ac10a618

    Description

      If I limit the column width with the QHeaderView::setMaximumSectionSize(), it doesn't work for the double-click on a section separator.

      Test program
      #include <QtWidgets>
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
          QStandardItemModel model;
          QWidget window;
          QTreeView *tree = new QTreeView(&window);
      
          model.setColumnCount(2);
          model.setItem(0, 0, new QStandardItem("test 1"));
          model.setItem(0, 1, new QStandardItem("test 2"));
          model.setItem(1, 0, new QStandardItem("This is a very very long text that cannot fit into the window"));
          model.setItem(1, 1, new QStandardItem("test 3"));
      
          QHBoxLayout *layout = new QHBoxLayout;
          layout->addWidget(tree);
          window.setLayout(layout);
      
          tree->header()->setMaximumSectionSize(150);
          tree->setModel(&model);
      
          window.show();
      
          return app.exec();
      }
      

      Attachments

        1. Expand_ignore_maximum.gif
          116 kB
          Nikita Krupenko
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            chehrlic Christian Ehrlicher
            nkrupenko.nvidia Nikita Krupenko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes