2022-08-07 17:12:12 +00:00
|
|
|
#include <mainwindow.h>
|
2022-08-21 19:37:42 +00:00
|
|
|
#include <qtkwidget.h>
|
|
|
|
#include "ui_mainwindow.h"
|
2022-03-13 22:00:00 +00:00
|
|
|
|
2022-11-24 22:26:53 +00:00
|
|
|
MainWindow::MainWindow(QWidget * parent) :
|
|
|
|
QMainWindow(parent), ui(new Ui::MainWindow) {
|
2022-03-13 22:00:00 +00:00
|
|
|
ui->setupUi(this);
|
2022-08-21 19:37:42 +00:00
|
|
|
// For use in design mode using Qt Creator
|
|
|
|
// + We can use the `ui` member to access nested widgets by name
|
2022-11-24 22:26:53 +00:00
|
|
|
for(const auto widget : ui->qWidget->children()) {
|
|
|
|
auto qtkWidget = dynamic_cast<Qtk::QtkWidget *>(widget);
|
|
|
|
if(qtkWidget != nullptr) {
|
2022-08-21 19:37:42 +00:00
|
|
|
std::string key = qtkWidget->objectName().toStdString();
|
2022-11-24 22:26:53 +00:00
|
|
|
if(mScenes[key] == nullptr) {
|
2022-08-21 19:37:42 +00:00
|
|
|
mScenes[qtkWidget->objectName().toStdString()] = new ExampleScene();
|
|
|
|
}
|
|
|
|
qtkWidget->setScene(mScenes[qtkWidget->objectName().toStdString()]);
|
|
|
|
}
|
|
|
|
}
|
2022-03-13 22:00:00 +00:00
|
|
|
setWindowIcon(QIcon("../resources/icon.png"));
|
|
|
|
}
|
|
|
|
|
2022-11-24 22:26:53 +00:00
|
|
|
MainWindow::~MainWindow() {
|
2022-03-13 22:00:00 +00:00
|
|
|
delete ui;
|
|
|
|
}
|