From c948d9e1a61f49f0fab685121a99542ccd71be41 Mon Sep 17 00:00:00 2001 From: Shaun Reed Date: Sun, 11 Dec 2022 12:36:07 -0500 Subject: [PATCH] Fix loading of QtkWidget in mainwindow --- app/mainwindow.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp index a7a912e..445a3bb 100644 --- a/app/mainwindow.cpp +++ b/app/mainwindow.cpp @@ -17,18 +17,17 @@ MainWindow::MainWindow(QWidget * parent) : ui->setupUi(this); // Find all QtkWidgets in this QMainWindow and initialize their scenes. - for(const auto widget : ui->qWidget->children()) { - auto qtkWidget = dynamic_cast(widget); - if(qtkWidget != nullptr) { - std::string key = qtkWidget->objectName().toStdString(); - // Initialize each scene into a map if it doesn't exist. - if(mScenes[key] == nullptr) { - mScenes[key] = new ExampleScene(); - } - // Set the QtkWidget to use the scene associated with this widget. - qtkWidget->setScene(mScenes[key]); + auto children = ui->centralwidget->findChildren(); + for(const auto qtkWidget : children) { + std::string key = qtkWidget->objectName().toStdString(); + // Initialize each scene into a map if it doesn't exist. + if(mScenes[key] == nullptr) { + mScenes[key] = new ExampleScene(); } + // Set the QtkWidget to use the scene associated with this widget. + qtkWidget->setScene(mScenes[key]); } + // TODO: Use QPlainTextEdit or similar for debug console // Set the window icon used for Qtk. // TODO: Update this to be something other than kilroy.