Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.11.2, 5.12.0 Beta 4, 5.15.2
-
None
-
MSVC 15
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(); }