Ok currently just testing a basic implementation as having problems with this section of the code in my main program.

Below is a simple class that just contains a couple of buttons created in code. However when I try to add them to either the central widget or to a layout the code fails with

QWidget::setLayout: Attempting to set QLayout "" on cctv_form "", which already has a layout
cctv_form.cpp
Qt Code:
  1. #include "cctv_form.h"
  2. #include <QPushButton>
  3. #include <QHBoxLayout>
  4.  
  5. cctv_form::cctv_form(QWidget *parent)
  6. : QMainWindow(parent)
  7. {
  8. QPushButton *left = new QPushButton("Right",this);
  9. QPushButton *right = new QPushButton("Right",this);
  10.  
  11. QHBoxLayout *layout = new QHBoxLayout;
  12. layout->addWidget(left);
  13. layout->addWidget(right);
  14.  
  15. QWidget *Window = new QWidget();
  16. Window->setLayout(layout);
  17. this->setCentralWidget(window);
  18.  
  19.  
  20. }
  21.  
  22. cctv_form::~cctv_form()
  23. {
  24.  
  25. }
To copy to clipboard, switch view to plain text mode 

cctv_form.h
Qt Code:
  1. #ifndef CCTV_FORM_H
  2. #define CCTV_FORM_H
  3.  
  4. #include <QMainWindow>
  5.  
  6. class cctv_form : public QMainWindow
  7. {
  8. Q_OBJECT
  9.  
  10. public:
  11. cctv_form(QWidget *parent = 0);
  12. ~cctv_form();
  13. };
  14.  
  15. #endif // CCTV_FORM_H
To copy to clipboard, switch view to plain text mode 

main.cpp
Qt Code:
  1. #include "cctv_form.h"
  2. #include <QApplication>
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6. QApplication a(argc, argv);
  7. cctv_form w;
  8. w.show();
  9.  
  10. return a.exec();
  11. }
To copy to clipboard, switch view to plain text mode 

Can anyone point me in the right direction ?