QTableWidget repainting broken on 5.10 and 5.11 on macOS
-
QTableWidget does not repaint correctly for operations such as adding rows. The problems seems to be particularly bad if QWidgets are shown in cells.
Adding rows with combo widgets doesn't repaint most of the table:
Adding empty rows doesn't repaint the vertical header:
If you resize the window or force a QTableWidget viewport()->repaint() after adding the rows, it updates correctly. But it is pretty klunky to force a repaint after each operation.
Main source is here:
#include "MainWindow.h" #include <QComboBox> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { setupUi(this); m_tableWidget->setColumnCount( 4 ); m_tableWidget->setRowCount( 0 ); connect( m_addWithButton, SIGNAL( clicked() ), this, SLOT( onAddWith() ) ); connect( m_addWithoutButton, SIGNAL( clicked() ), this, SLOT( onAddWithout() ) ); connect( m_clearButton, SIGNAL( clicked() ), this, SLOT( onClear() ) ); } void MainWindow::onAddWith() { m_tableWidget->setRowCount( m_tableWidget->rowCount() + 1 ); for ( int c = 1; c < 3; c++ ) { QComboBox* comboItem = new QComboBox( m_tableWidget ); QStringList values; values << "combo1" << "combo2"; comboItem->addItems( values ); m_tableWidget->setCellWidget( m_tableWidget->rowCount() - 1, c, comboItem ); } if ( m_repaintCheckBox->isChecked() ) m_tableWidget->viewport()->repaint(); } void MainWindow::onAddWithout() { m_tableWidget->setRowCount( m_tableWidget->rowCount() + 1 ); if ( m_repaintCheckBox->isChecked() ) m_tableWidget->viewport()->repaint(); } void MainWindow::onClear() { m_tableWidget->setRowCount( 0 ); if ( m_repaintCheckBox->isChecked() ) m_tableWidget->viewport()->repaint(); }
This is broken on Qt 5.10.1, 5.11.0, 5.11.1 and 5.11.2 snapshot (18-Sep) for macOS.
It works ok for Qt 5.9.6 for macOS and all Qt versions I tried for Windows.
I am on macOS 10.13.
With the other Qt bugs I have come across, I am having a great deal of difficulty finding a recent version of Qt for Mac that doesn't have a showstopper bug!
https://forum.qt.io/topic/94535/qfontdialog-broken-in-5-11-1-on-mac/
https://forum.qt.io/topic/91642/qstatictext-size-bug-when-using-rich-text-and-word-wrap/--
Andy Brice
https://www.perfecttableplan.com -
Weirdly, I can't find any other reports of this bug, so I filed a bug report:
https://bugreports.qt.io/browse/QTBUG-70599Andy Brice
https://www.perfecttableplan.com -
Hi, just want to confirm your bug (tested on my Mac).
Have some Qt apps on Windows which are heavily users of QTableWidget, also filed some bugs (most recent this one)
If you change your QStringList stuffing line to say:
values << "combo1" << "combo2" << "supercalifragilisticexpialidocious";
you can see my bug in action (if you're on 5.11). -
@hskoglund I confirm that I can reproduce your problem.
And it isn't fixed by a repaint.
QFontDialog is also totally broken on Qt 5.11.1 and the 5.11.2 snapshot. These regressions in core parts of Qt are very frustrating. The macOS version seems particularly prone to them. The Windows version seems pretty solid.
--
Andy Brice
https://www.perfecttableplan.com