C++ (Qt) QVBoxLayout *layout = new QVBoxLayout( this ); QTextEdit *textEdit = new QTextEdit( this ); layout->addWidget( textEdit ); setLayout( layout ); resize( 200, 200 ); qDebug() << textEdit->size(); layout->activate(); qDebug() << textEdit->size();