0

I have a simuWindows.ui (and its .cpp and .h files associated) which is a QWidget.
I have a mainWindows.cpp and mainWindows.h.

What I would like to do is to set my QWidget (simuWindows) as a centralZone of mainWindows.

Here is what I have tried :
mainWindows.cpp

#include "mainwindows.h"
#include "simuWindows.h"

m_centralZone = new QWidget;
simuWindows mainSimuWindows;
QHBoxLayout mainLayout;
mainLayout.addWidget(&mainSimuWindows);
m_centralZone->setLayout(&mainLayout);

However, the widget will not show up and I don't why.

Is my code correct to add my simuWindows.ui widget as centralZone of my QMainWindows ?

EDIT : Here is the correct code (thx to @ekhumoro) :

#include "mainwindows.h"
#include "ui_simuWindows.h"

Ui::simuWindows mainSimuWindows;
QWidget *simuWidget = new QWidget;
mainSimuWindows.setuoUi(simuWidget);
setCentralWidget(simuWidget);
m_centralZone->setLayout(&mainLayout);
EagleWatch
  • 105
  • 1
  • 8

0 Answers0