I am trying to create layout like this

In the QT i created widgets and put in the main widget, the problem is not visible. none of the widget’s are not shown. please help me to fix this issue
Complete Source Code
sandbox.ifuturemec.com/test.zip
Source code
mainWindow.cpp
#include "mainwindow.h"
#include <QtGui>
#include "headerbar.h"
#include <QGridLayout>
#include <QPushButton>
#include <QBoxLayout>
#include "statusbar.h"
#include "leftpanel.h"
#include "rightpanel.h"
#include "centerpanel.h"
mainWindow::mainWindow(QWidget *parent) : QWidget(parent)
{
QGridLayout *layout=new QGridLayout(this);
headerBar *Header= new headerBar(this);
leftPanel *LeftPanel=new leftPanel(this);
centerPanel *CenterPanel=new centerPanel(this);
rightPanel *RightPanel=new rightPanel(this);
statusBar *Status=new statusBar(this);
QHBoxLayout *box=new QHBoxLayout();
box->addWidget(LeftPanel);
box->addWidget(CenterPanel);
box->addWidget(RightPanel);
layout->addWidget(Header,0,0);
layout->addLayout(box,1,0);
layout->addWidget(Status,2,0);
setLayout(layout);
}
mainWindow::~mainWindow() {}
mainWindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QWidget>
class mainWindow : public QWidget
{
Q_OBJECT
public:
mainWindow(QWidget *parent = 0);
~mainWindow();
signals:
public slots:
};
#endif // MAINWINDOW_H
headerbar.cpp
#include "headerbar.h"
#include <QPushButton>
#include <QMessageBox>
headerBar::headerBar(QWidget *parent) : QWidget(parent)
{
this->setMaximumHeight(24);
this->setStyleSheet("background-color: rgb(85, 170, 255)");
}
headerBar::~headerBar(){}
headerbar.h
#ifndef HEADERBAR_H
#define HEADERBAR_H
#include <QWidget>
class headerBar : public QWidget
{
Q_OBJECT
public:
headerBar(QWidget *parent = 0);
~headerBar();
signals:
public slots:
};
#endif // HEADERBAR_H
Please help me to fix this problem.
Actually, your widgets do show ! But they are empty and have nothing to show !
Regarding the background color you are setting : the
background-colorproperty is not showing, because this property is not supported byQWidget.Have a look at the documentation regarding this : List of stylable widgets.
More specifically :
If you try to put, for instance, a label in your widgets, you’ll see they do show :