C++ (Qt)Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget){ ui->setupUi(this); qDebug() << ui->groupBox->geometry() << ui->listView->geometry() << ui->pushButton->geometry(); show(); qDebug() << ui->groupBox->geometry() << ui->listView->geometry() << ui->pushButton->geometry();}
QRect(0,0 100x30) QRect(0,0 100x30) QRect(0,0 100x30)QRect(11,216 324x13) QRect(92,11 243x199) QRect(11,99 75x23)
C++ (Qt)...
C++ (Qt) QVBoxLayout *layout = new QVBoxLayout( this ); QLabel *label = new QLabel( tr( "Label" ), this ); layout->addWidget( label ); QTextEdit *textEdit = new QTextEdit( this ); textEdit->setMinimumSize( 400, 400 ); layout->addWidget( textEdit ); setLayout( layout ); qDebug() << minimumSize(); qDebug() << layout->activate(); qDebug() << minimumSize();
C++ (Qt)MainWindow::MainWindow() : QWidget( 0 ){ QVBoxLayout *layout = new QVBoxLayout( this ); QLabel *label = new QLabel( tr( "Label" ), this ); layout->addWidget( label ); QTextEdit *textEdit = new QTextEdit( this ); textEdit->setMinimumSize( 400, 400 ); layout->addWidget( textEdit ); setLayout( layout ); qDebug() << layout->activate(); qDebug() << minimumSize(); // Печатаем размер виджета} int main(int argc, char *argv[]){ QApplication app(argc, argv); MainWindow *mw = new MainWindow(); mw->show(); qDebug() << mw->size(); // Проверяем после show return app.exec();}