Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.5.2
-
None
-
GNU/Linux Fedora release 8 (Werewolf)
Description
For a QTableView with the alternatingRowColors property enabled, hiding a row causes all spanned rows below it be painted with an incorrect background color. This example demonstrates the problem:
#include <QtGui> #include <QtCore> class MyWidget : public QWidget { Q_OBJECT public: MyWidget(QWidget *parent=0) : QWidget(parent) { model = new QStandardItemModel(10, 5, this); for (int row = 0; row < 10; row++) { for (int col = 0; col < 5; col++) { QStandardItem *item = new QStandardItem(QString("row %0, col %1").arg(row).arg(col)); model->setItem(row, col, item); } } view = new QTableView(this); view->setAlternatingRowColors(true); view->setModel(model); view->setSpan(7, 0, 1, 5); button = new QPushButton("Hide 3rd row", this); connect(button, SIGNAL(clicked()), this, SLOT(hideRow())); layout = new QVBoxLayout(this); layout->addWidget(view); layout->addWidget(button); } public slots: void hideRow() { view->setRowHidden(2, true); } private: QTableView *view; QStandardItemModel *model; QPushButton *button; QVBoxLayout *layout; }; int main(int argc, char *argv[]) { QApplication a(argc, argv); MyWidget w; w.resize(600,400); w.show(); return a.exec(); }