void MainWindow::setGUI()
{
frame->setLayout(_layout);
_layout->addWidget(tabWidget);
scrollArea->setWidget(frame);
scrollArea->setWidgetResizable(true);
setCentralWidget(scrollArea);
}
void MainWindow::setGUI()
{
QWidget* frame = new QWidget;
QToolButton *toolButton;
_layout = new QVBoxLayout;
frame->setLayout(_layout);
tabWidget = new QTabWidget();
tab = new QWidget();
pushButton = new QPushButton(tab);
tabWidget->addTab(tab, QString());
_layout->addWidget(tabWidget);
scrollArea = new QScrollArea;
scrollArea->setWidget(frame);
scrollArea->setWidgetResizable(true);
setCentralWidget(scrollArea);
}
To copy to clipboard, switch view to plain text mode
This above works fine, i got scrollArea->tabWidget->tab->pushButton, but if I'd like to addWidget from other method/function to this layout i am not able to add new widget to "tab". Everything is under tabWidget which is part of scrollArea (centralWidget).
void MainWindow::addToGUI()
{
while(true)
{
QFormLayout* form_layout = new QFormLayout;
layout
->addRow
("ID1",
new QLabel(function
()));
layout
->addRow
("ID2",
new QLabel(function
()));
layout
->addRow
("ID3",
new QLabel(function
()));
newGB->setLayout(layout);
this->_layout->addWidget(newGB); // i want this in tabWidget->tab, i know that there is setCentralWIdget(scrollArea) and that is why i get this under tabWidget.
}
}
void MainWindow::addToGUI()
{
while(true)
{
QGroupBox* newGB = new QGroupBox("group box");
QFormLayout* form_layout = new QFormLayout;
layout->addRow("ID1", new QLabel(function()));
layout->addRow("ID2", new QLabel(function()));
layout->addRow("ID3", new QLabel(function()));
newGB->setLayout(layout);
this->_layout->addWidget(newGB); // i want this in tabWidget->tab, i know that there is setCentralWIdget(scrollArea) and that is why i get this under tabWidget.
}
}
To copy to clipboard, switch view to plain text mode
Here is what i mean -> 84465788e05d.jpg
How to solve this?
Bookmarks