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. QCheckBox painting problems on macOS

QCheckBox painting problems on macOS

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 850 Views
  • 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.
  • P Offline
    P Offline
    patrickkidd
    wrote on last edited by
    #1

    It appears as though QCheckBox shows Qt::Checked when it is actually Qt::PartiallyChecked for Qt-5.11.0 on macOS. This is the case when QCheckBox::checkState() returns Qt:PartiallyChecked. This is easily reproducible by previewing a tristate QCheckBox in Qt Creator.

    There is another possibly related issue where a QCheckBox in a QTableView does not repaint itself when ::setCheckState(Qt::Checked) is called until the table view is redrawn, for example when the cell in question is selected.

    Help??

    https://alaskafamilysystems.com/

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

      Hi,

      What version of macOS are you running ?

      Can you give a minimal compilable example showing that ?

      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
      • P Offline
        P Offline
        patrickkidd
        wrote on last edited by
        #3

        Latest Mac OS X and QT 5.11.0. You can reproduce the Partially checked bug in QT creator by just alt-clicking on a checkbox that is tristate. You will never see the partially checked symbol.

        I’ll need to make an example for the other bug.

        https://alaskafamilysystems.com/

        1 Reply Last reply
        0
        • P Offline
          P Offline
          patrickkidd
          wrote on last edited by
          #4

          Just slap these into the vanilla QtWidgets app template to reproduce the bug where it doesn't paint the tristate checkbox on Qt-5.11.0 on macOS. The repaint bug does not appear to occur here with QTableWidget as it does in my QTableView application. I will make an example for that if I have time, but this is enough for now.

          #include "widget.h"
          #include "ui_widget.h"
          #include <QTableWidget>
          #include <qDebug>
          
          Widget::Widget(QWidget *parent) :
              QWidget(parent),
              ui(new Ui::Widget)
          {
              ui->setupUi(this);
          
              tw = new QTableWidget(this);
              tw->setColumnCount(2);
              tw->setRowCount(2);
          
              QTableWidgetItem *item = new QTableWidgetItem;
              item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsAutoTristate);
              item->setCheckState(Qt::Unchecked);
              tw->setItem(0, 0, item);
          
              this->startTimer(1000);
          }
          
          Widget::~Widget()
          {
              delete ui;
          }
          
          
          void Widget::timerEvent(QTimerEvent *event) {
              QTableWidgetItem *item = tw->item(0, 0);
              if(item->checkState() == Qt::Checked) {
                  item->setCheckState(Qt::PartiallyChecked);
              } else if(item->checkState() == Qt::PartiallyChecked){
                  item->setCheckState(Qt::Unchecked);
              } else {
                  item->setCheckState(Qt::Checked);
              }
              qDebug() << item->checkState();
          }
          
          #ifndef WIDGET_H
          #define WIDGET_H
          
          #include <QWidget>
          
          namespace Ui {
          class Widget;
          }
          
          class QTableWidget;
          
          class Widget : public QWidget
          {
              Q_OBJECT
          
              QTableWidget *tw;
          public:
              explicit Widget(QWidget *parent = 0);
              ~Widget();
          
              void timerEvent(QTimerEvent *event);
          
          private:
              Ui::Widget *ui;
          };
          
          #endif // WIDGET_H
          

          https://alaskafamilysystems.com/

          1 Reply Last reply
          0
          • P Offline
            P Offline
            patrickkidd
            wrote on last edited by
            #5

            I posted a bug here:

            https://bugreports.qt.io/browse/QTBUG-69346

            https://alaskafamilysystems.com/

            1 Reply Last reply
            1

            • Login

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