出现这个的原因是窗口继承的是QMainwindow,需要设置
setCentralWidget();
如下:

    m_wMainWidget = new QWidget();
    //QWidget::setLayout: Attempting to set QLayout "" on MainWindow "", which already has a layout
    setCentralWidget(m_wMainWidget);

    setWindowTitle(tr("资源转换工具"));
    setMinimumSize(800, 600);

    QVBoxLayout * mainLayout = new QVBoxLayout();
    mainLayout->addWidget(m_gbInputGroup);

    m_wMainWidget->setLayout(mainLayout);

设置好一个widget即可

Comments are closed.

Post Navigation