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

QHeaderView expands column beyond the maximum size

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 5.9.2
    • Fix Version/s: 5.9.3
    • Component/s: Widgets: Itemviews
    • Labels:
      None
    • Environment:
      Kubuntu 16.04 amd64
    • Commits:
      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

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

          Activity

            People

            Assignee:
            chehrlic Christian Ehrlicher
            Reporter:
            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