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

QTableWidget: Cellwidget set invisible become visible after column resize

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Duplicate
    • Affects Version/s: 5.15.3, 6.0.3, 6.0.1
    • Fix Version/s: None
    • Component/s: Widgets: Itemviews
    • Labels:
      None
    • Platform/s:
      Linux/X11, Windows

      Description

      I have a QTableWidget where I have cells that contain a QPushButton and at some point I won't need those buttons anymore so instead of removing (removeCellWidget) I decided to just make them invisible. However, after I do it, if that cell size ever changes, during a window resize for example, the buttons recently setVisible(false) become visible again.

      Here is a compilable code tested with a QPushButton but I believe the problem is true to any widget. On clicking the button it will be become invisible, afterresizing it it will beome visible again

       

      MainWindow::MainWindow(QWidget *parent)
          : QMainWindow(parent)
          , ui(new Ui::MainWindow)
      {
          ui->setupUi(this);
      
          ui->table->setRowCount(1);
      
          QPushButton *p = new QPushButton("Test");
      
          ui->table->setCellWidget(0, 0, p);
      
          connect(p, &QPushButton::clicked, [p]()
          {
              p->setVisible(false);
          });
      
      }
      

       

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              qt.team.quick.subscriptions Qt Quick and Widgets Team
              Reporter:
              hbatalha Helder Batalha
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes