So I have the following code:

Qt Code:
  1. void Classy::on_checkBox_pressed()
  2. {
  3. qDebug() << "Box Pressed";
  4. layout->addWidget(stackedWidget);
  5. stackedWidget->setCurrentWidget(sickWidget);
  6. stackedWidget->setLayout(layout);
  7. stackedWidget->show();
  8. }
To copy to clipboard, switch view to plain text mode 

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/6878...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.