Didn't check. Wouldn't matter. If it did return "false" I'd still be stuck in the same position: not knowing how to get the size.
Added after 6 minutes:
This simple code shows that sizeHint doesn't work on the items if the target widget is already visible. I'll go file this at nokia.
#include <QtGui>
int main( int argc, char ** argv )
{
win->show(); //without this here it works as expected
button->setText( "Sample" );
layout->addWidget( button );
qDebug() << button->sizeHint() << layout->itemAt( 0 )->sizeHint() << layout->sizeHint();
}
#include <QtGui>
int main( int argc, char ** argv )
{
QApplication app( argc, argv );
QWidget * win = new QWidget();
win->show(); //without this here it works as expected
QBoxLayout * layout = new QHBoxLayout( win );
QPushButton * button = new QPushButton( win );
button->setText( "Sample" );
layout->addWidget( button );
qDebug() << button->sizeHint() << layout->itemAt( 0 )->sizeHint() << layout->sizeHint();
}
To copy to clipboard, switch view to plain text mode
Added after 15 minutes:
QT Defect:
http://bugreports.qt.nokia.com/browse/QTBUG-15832
Bookmarks