S
QWidget::setLayout: Attempting to set QLayout "" on MainWindow "", which already has a layoutна
#include "mainwindow.h"
#include <QGridLayout>
#include <QVBoxLayout>
#include <QLabel>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout;
QLabel *mainLabel = new QLabel("I am a label");
QLabel *secondLabel = new QLabel("I am second lable");
mainLayout->addWidget(mainLabel);
mainLayout->addWidget(secondLabel);
setLayout(mainLayout);
}
