In Qt6.9.1 and windows 11, QtableWidget check box is not updating in UI
-
Hi,
The following code works correctly on Windows 10, but does not behave as expected on Windows 11:
ui->sampleTableWidget->item(0, 0)->setCheckState(Qt::Checked);
When I print the check state using qDebug(), it shows as Checked.
However, the checkbox state is not updated or reflected in the UI on Windows 11.Please suggest possible reasons for this issue or provide a solution.
-
Hi,
The following code works correctly on Windows 10, but does not behave as expected on Windows 11:
ui->sampleTableWidget->item(0, 0)->setCheckState(Qt::Checked);
When I print the check state using qDebug(), it shows as Checked.
However, the checkbox state is not updated or reflected in the UI on Windows 11.Please suggest possible reasons for this issue or provide a solution.
@QtlearnerNew Do you by any chance block the UI thread after calling setCheckState?
-
Hi,
The following code works correctly on Windows 10, but does not behave as expected on Windows 11:
ui->sampleTableWidget->item(0, 0)->setCheckState(Qt::Checked);
When I print the check state using qDebug(), it shows as Checked.
However, the checkbox state is not updated or reflected in the UI on Windows 11.Please suggest possible reasons for this issue or provide a solution.
@QtlearnerNew Hi,
Beside @jsulm point, which version of Qt are you using ?
-
Can you try with starting your application using the
windowsvista
style ? -
@SGaist Many thanks for the timely help, it woks using windowsvista style.
-
It works fine for me with Qt6.9.1 with the windows11 style:
int main(int argc, char *argv[]) { QApplication app(argc, argv); QTableWidget tw; tw.setRowCount(5); tw.setColumnCount(1); auto item = new QTableWidgetItem("Item"); tw.setItem(0, 0, item); QTimer::singleShot(2000, &tw, [&]() { tw.item(0, 0)->setCheckState(Qt::Checked); }); tw.show(); return app.exec(); }
Please provide a minimal, compilable example of your problem.