Details
-
Bug
-
Resolution: Out of scope
-
P1: Critical
-
None
-
5.11.1
-
None
Description
Hi, before 5.11, regardless of how long an item/string is in a QComboBox inserted in a QTableWidget, it never overflows into other columns. I haven't tested on 5.11.0, but on 5.11.1 if the string is too long, it will happily render into other columns to the right. This is probably just me missing/not understanding the documentation, or?
To reproduce, create an empty vanilla widgets app.
In main.cpp, add these #include lines:
#include "QPushButton" #include "QTableWidget" #include "QVBoxLayout" #include "QComboBox"
Add this static var:
static QStringList sl = {"Now","is","the","time","for","all","good","men" "to","come","to","the","aid","of","the","party."};
Remove these lines:
MainWindow w; w.show();
Instead, insert these lines:
auto bu = new QPushButton("Add one row"); auto tw = new QTableWidget(1,3); tw->setColumnWidth(0,100); tw->setColumnWidth(1,100); tw->setColumnWidth(2,100); auto vb = new QVBoxLayout; vb->addWidget(bu); vb->addWidget(tw); auto wi = new QWidget(); wi->setGeometry(0,0,500,600); wi->setLayout(vb); wi->show(); bu->connect(bu,&QPushButton::clicked,[tw] { int rows = tw->rowCount(); QString s; for (int r = 0; (r < rows); ++r) s += sl[r % sl.count()] + " "; auto cb = new QComboBox(); cb->addItem(s); tw->setCellWidget(rows - 1,0,cb); auto bu = new QPushButton("Button"); tw->setCellWidget(rows - 1,1,bu); tw->setItem(rows - 1,2,new QTableWidgetItem("Static text")); tw->setRowCount(++rows); });
If I try in 5.10.1 the QComboBox behaves nicely and do not clobber the other columns, but in 5.11.1 not so
Perhaps there is a header setting I've overlooked?