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

QTableWidget displays widgets in its cells incorrectly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • 5.13.2
    • 5.11.0
    • Widgets: Itemviews
    • None
    • d2ae838a7c6a49eb826ddf8de115306d11dd4d30 (qt/qtbase/5.13)

    Description

      The widgets that are setted into QTableWidget cells are shown with wrong width.

       

      On Qt 5.11.0:

      On Qt 5.10.1

       

      The code:

      #include <QApplication>
      #include <QTableWidget>
      #include <QPushButton>
      #include <QHeaderView>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          QTableWidget table(5, 5);
          for (int i = 0; i < 5; ++i)
          {
              for (int j = 0; j < 5; ++j)
                  table.setCellWidget(i, j, new QPushButton("0", &table));
          }
      
          table.horizontalHeader()->setDefaultSectionSize(40);
          table.resize(300, 200);
          table.show();
      
          return a.exec();
      }
      

      Attachments

        1. 5.10.1.PNG
          5.10.1.PNG
          4 kB
        2. Qt 5.11.PNG
          Qt 5.11.PNG
          4 kB

        Issue Links

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

          Activity

            People

              chehrlic Christian Ehrlicher
              differed Yurii
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes