-
Bug
-
Resolution: Done
-
P2: Important
-
5.6.0, 5.6.1, 5.6.2, 5.7.0, 5.7.1, 5.8.0, 5.9.0 Beta 1, 5.9.0, 5.9.1
-
None
-
5c0a9fc532d70ae784cca3e16b5fe59862902815
(See attachment)
Minimal example:
#include <QMdiArea> #include <QMdiSubWindow> #include <QStringListModel> #include <QTableView> #include <QLabel> #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); QMdiArea mdiArea; mdiArea.show(); QStringList stringList; for (int i = 1; i <= 10; i++) stringList << QString("bla").repeated(i); QTableView *tableView = new QTableView(&mdiArea); QStringListModel *model = new QStringListModel(stringList, tableView); tableView->setMinimumSize(800, 600); tableView->setModel(model); QMdiSubWindow *tableWindow = mdiArea.addSubWindow(tableView, Qt::Window); tableWindow->show(); QMdiSubWindow *labelWindow = mdiArea.addSubWindow(new QLabel("<h1>oh my grid!<br>for what?</h1>"), Qt::Window); labelWindow->move(300, 100); labelWindow->show(); return a.exec(); }
Possible reason:
void QTableView::paintEvent(QPaintEvent *event)
{
uint x = horizontalHeader->length() - horizontalHeader->offset() - (rightToLeft ? 0 : 1);
uint y = verticalHeader->length() - verticalHeader->offset() - 1;
...
for (QRect dirtyArea : region) {
dirtyArea.setBottom(qMin(dirtyArea.bottom(), int(y)));
if (rightToLeft) {
dirtyArea.setLeft(qMax(dirtyArea.left(), d->viewport->width() - int(x)));
} else {
dirtyArea.setRight(qMin(dirtyArea.right(), int(x)));
}
// and dirtyArea may be invalid:
// dirtyArea.right() == x && x < dirtyArea.left()
// dirtyArea.bottom() == y && y < dirtyArea.top()
...
if (showGrid) {
...
// even if dirtyArea.right() < dirtyArea.left()
painter.drawLine(dirtyArea.left(), rowY + rowh, dirtyArea.right(), rowY + rowh);
...
// even if dirtyArea.bottom() < dirtyArea.top()
painter.drawLine(colp, dirtyArea.top(), colp, dirtyArea.bottom());
}
}
}
- is duplicated by
-
QTBUG-58134 QTableView draws row lines in area without columns
-
- Closed
-