seerofsorrow
10th October 2017, 23:28
So I have the following code:
void Classy::on_checkBox_pressed()
{
qDebug() << "Box Pressed";
layout->addWidget(stackedWidget);
stackedWidget->setCurrentWidget(sickWidget);
stackedWidget->setLayout(layout);
stackedWidget->show();
}
Layout is a QVBoxLayout that I defined in public under classy.
stackedWidget is a stackedWidget that I have as as stacked Widget in my ui.
sickWidget is a "page" (QWidget) that has more objects underneath it.
i looked at all kinds of documentation for this including this thread: http://www.qtcentre.org/threads/68786-Switching-between-two-ui-forms-QMainWindow-screens?highlight=qstackedwidget
(I have w.show(); inside of main.cpp) However whenever I select the checkbox in my program it crashes and I don't understand what I'm doing wrong as I'm trying my best to follow the example in the Qt documentation under QStackedWidget. Can anyone help me?
Thank you again to everyone.
void Classy::on_checkBox_pressed()
{
qDebug() << "Box Pressed";
layout->addWidget(stackedWidget);
stackedWidget->setCurrentWidget(sickWidget);
stackedWidget->setLayout(layout);
stackedWidget->show();
}
Layout is a QVBoxLayout that I defined in public under classy.
stackedWidget is a stackedWidget that I have as as stacked Widget in my ui.
sickWidget is a "page" (QWidget) that has more objects underneath it.
i looked at all kinds of documentation for this including this thread: http://www.qtcentre.org/threads/68786-Switching-between-two-ui-forms-QMainWindow-screens?highlight=qstackedwidget
(I have w.show(); inside of main.cpp) However whenever I select the checkbox in my program it crashes and I don't understand what I'm doing wrong as I'm trying my best to follow the example in the Qt documentation under QStackedWidget. Can anyone help me?
Thank you again to everyone.