Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. In Qt6.9.1 and windows 11, QtableWidget check box is not updating in UI
Forum Updated to NodeBB v4.3 + New Features

In Qt6.9.1 and windows 11, QtableWidget check box is not updating in UI

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 4 Posters 263 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    QtlearnerNew
    wrote last edited by
    #1

    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.

    jsulmJ SGaistS 2 Replies Last reply
    0
    • Q QtlearnerNew

      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.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote last edited by
      #2

      @QtlearnerNew Do you by any chance block the UI thread after calling setCheckState?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • Q QtlearnerNew

        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.

        SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote last edited by
        #3

        @QtlearnerNew Hi,

        Beside @jsulm point, which version of Qt are you using ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          QtlearnerNew
          wrote last edited by
          #4

          @SGaist we are using QT6.9.1
          @jsulm we are not blocking the UI thread after calling setCheckState

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote last edited by
            #5

            Can you try with starting your application using the windowsvista style ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • Q Offline
              Q Offline
              QtlearnerNew
              wrote last edited by
              #6

              @SGaist Many thanks for the timely help, it woks using windowsvista style.

              1 Reply Last reply
              0
              • Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote last edited by Christian Ehrlicher
                #7

                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.

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved