Remarks

From Qt layout documentation:

When you use a layout, you do not need to pass a parent when constructing the child widgets. The layout will automatically reparent the widgets (using QWidget::setParent()) so that they are children of the widget on which the layout is installed.

So do :

QGroupBox *box = new QGroupBox("Information:", widget);
layout->addWidget(box);

or do :

QGroupBox *box = new QGroupBox("Information:", nullptr);
layout->addWidget(box);

is exactly the same.

相关文章:

  • 2021-09-15
  • 2021-11-18
  • 2021-07-22
  • 2021-04-24
  • 2022-03-04
  • 2022-12-23
  • 2022-12-23
  • 2021-08-20
猜你喜欢
  • 2021-11-07
  • 2021-09-16
  • 2021-05-30
  • 2022-12-23
  • 2021-06-18
  • 2021-12-24
  • 2021-10-14
相关资源
相似解决方案