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

setColumnWidth() for QTableWidget seems broken in 5.11.0

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.11.0
    • Widgets: Layout
    • None
    • Windows, MacOS, Linux

       

    Description

      Before Qt 5.11.0, setColumnWidth() on a QTableWidget can be used to set arbitrary widths for a given column, but in 5.11.0, if you try to set the width to something low, like 10 or 11, it will fail. To reproduce this in Qt Creator, create an empty vanilla widgets app.

      In main.cpp, add these #include lines:

      #include "QTableWidget"
      #include "qdebug.h"
      

      Remove these lines:

      MainWindow w;
      w.show();
      

      Insert these lines instead:

      auto tw = new QTableWidget(2,2);
      tw->show();
      tw->setColumnWidth(0,11);
      qDebug() << tw->columnWidth(0);
      tw->setColumnWidth(1,12);
      qDebug() << tw->columnWidth(1);
      

      In any Qt version before 5.11.0 the debug output will be 11 and 12, but in Qt 5.11.0 the output will be a fixed number like 31.

      (that number varies depending on the OS etc, on my computers with Qt 5.11.0 installed, the fixed number is 31 for Windows 7, 37 for Windows 10, 34 for Ubuntu 18.04 and 19 for MacOS High Sierra)

      Attachments

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

        Activity

          People

            chehrlic Christian Ehrlicher
            hskoglund Henry Skoglund
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes