1
QVBoxLayout *layout = (QVBoxLayout*)this->layout();
printf("Before: %d %d\n", this->height(), layout->totalSizeHint().height());
QWidget *widget = new SubWidget();
layout->insertWidget(0, widget);
this->updateGeometry();
this->adjustSize();
this->update();
this->repaint();
printf("After: %d %d %d\n", this->height(), layout->totalSizeHint().height(), widget->height());
的問題是,我得到同樣的號碼之前和之後,儘管小部件高度爲非零(在我的情況下約400)。爲什麼?
真棒的感謝! – chacham15