This is quite odd. Using this code, I am attempting to add a tab to a QTabWidget:
void SideWidget::changePanel(SearchablePanel* panel){
ui->nextButton->setEnabled(false);
cout << pointer;
widgetHistory[++pointer] = panel;
QWidget* widget = panel->getWidget();
cout << panel->id;
MainWindow::main->addTab(widget, "nT");
QTextEdit* thing = new QTextEdit("Test");
MainWindow::main->addTab(thing, "tabqx");
this->internalChange(panel);
}
And internalChange:
void SideWidget::internalChange(SearchablePanel *panel){
cout << "internale change, "+panel->id;
ui->scrollPanel->setWidget(panel->getWidget());
ui->prevButton->setEnabled(true);
}
Now, when I add the tab "tabqx" it works, and when I set the scrollPanel's widget to panel->getWidget()
it works. However, when I attempt to add the tab "nT", it does not work. I am very confused. I should note that panel->getWidget()
returns a QWidget
, as might be expected. In this instance specifically, it will return a QTextEdit
. Also, MainWindow::main
is a static QTabWidget
.
So my question is, why is the tab "nT" not being added?