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

QTableWidget Unknown Tab Operation After hide() and show()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.11.2, 5.12.0 Beta 4, 5.15.2
    • Widgets: Itemviews
    • None
    • MSVC 15
    • Windows

    Description

             Create a new pure GUI project, add a tablewidget, add some data to the table, and set the QTimer to refresh the table regularly.

             In order to improve the performance, I first call tablewidget - > Hide (), modify the tables, and then call tablewidget - > show (). At this time, I found that the tables had similar effect of pressing the Tab key.

              The complete project is attached!

      mainwindow.cpp :
       

      #include "mainwindow.h"
      #include "ui_mainwindow.h"
      #include <QTimer> 
      #include <Windows.h> 
      
      MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
      
      ui(new Ui::MainWindow)
      {
              ui->setupUi(this);     
              ui->tableWidget->setRowCount(3);
              ui->tableWidget->setColumnCount(3); 
      
              QTimer *refresh = new QTimer(this);
              connect(refresh, &QTimer::timeout, this, &MainWindow::on_RefreshTable);
              refresh->start(1000);
      } 
      
      MainWindow::~MainWindow()
      {      
              delete ui;
      }
      
      void MainWindow::on_RefreshTable()
      {
              ui->tableWidget->hide();
              Sleep(200);
              ui->tableWidget->show();
      } 
      

       

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            mr.niu Niu Zhiyong
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes