View Full Version : invalid sizeHint()

25th August 2006, 21:25
Is there any reason why the function sizeHint() should return a invalid QSize?

My code is

QTableWidgetItem *header = new QTableWidgetItem("Hello\nWorld");
QSize size = header->sizeHint();

25th August 2006, 22:11
Are you using a layout? Doesn't look like it, in which case, the QWidget docs state that the function returns an invalid size. QTableWidgetItem::sizeHint() implies that it returns the value from a previous call to setSizeHint().

25th August 2006, 23:11
The problem is that QTableWidgetItem isn't a widget in itself, so it cannot be putted inside a QLayout