You can set any QWidget
subclass as central widget, or you can add any QWidget
subclass to your central widget.
For example, if you create a Qt Designer Form Class
(that's what Qt Creator calls a class consisting of a .cpp, a .h and a .ui file) called MyCentralWidget
, you can do:
#include "MyCentralWidget.h"
// ...
QWidget *centralWidget = new MyCentralWidget();
ui->tabWidget->addTab( centralWidget, "tab header" );
You can then use the Qt Designer (or Qt Creator) to design MyCentralWidget
in any way you want.
Another example is adding the widget to a layout within the central widget:
#include "MyCentralWidget.h"
#include <QtGui/QGridLayout>
// ...
QWidget *centralWidget = new QWidget();
centralWidget->setLayout( new QGridLayout() );
centralWidget->layout()->addWidget( new MyCentralWidget() );
ui->tabWidget->addTab( centralWidget, "tab header" );