[Solved]creating tabs
Page |
1 |
hi
Im new to creating widgets programmatically. I got the application running but no tabs were created
This is my code
- ui(new Ui::Tabs)
- {
- ui->setupUi(this);
- tabWidget = new QTabWidget;
- mainLayout = new QVBoxLayout;
- mainLayout->addWidget(tabWidget);
- setLayout(mainLayout);
- }
and in the header file
I’ve declared the following
alfah
47 replies
eddy,
ui(new Ui::Tabs) { ui->setupUi(this); tabWidget = new QTabWidget; mainLayout = new QVBoxLayout; mainLayout->addWidget(tabWidget); centralWidget()->setLayout(mainLayout); }i still do not know how to make individual buttons on each tab :(
alfa
You can event add custom widgets to the tab widget, so go this way:
- ui(new Ui::Tabs)
- {
- ui->setupUi(this);
- tabWidget = new QTabWidget;
- // fill pHistory here
- tabWidget->addTab(pHistory,tr("History"));
- mainLayout = new QVBoxLayout;
- mainLayout->addWidget(tabWidget);
- centralWidget()->setLayout(mainLayout);
- }
You must log in to post a reply. Not a member yet? Register here!


