qtk/app/mainwindow.cpp

26 lines
810 B
C++
Raw Normal View History

#include <mainwindow.h>
#include <qtkwidget.h>
#include "ui_mainwindow.h"
2022-11-24 22:26:53 +00:00
MainWindow::MainWindow(QWidget * parent) :
QMainWindow(parent), ui(new Ui::MainWindow) {
ui->setupUi(this);
// 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) {
std::string key = qtkWidget->objectName().toStdString();
2022-11-24 22:26:53 +00:00
if(mScenes[key] == nullptr) {
mScenes[qtkWidget->objectName().toStdString()] = new ExampleScene();
}
qtkWidget->setScene(mScenes[qtkWidget->objectName().toStdString()]);
}
}
setWindowIcon(QIcon("../resources/icon.png"));
}
2022-11-24 22:26:53 +00:00
MainWindow::~MainWindow() {
delete ui;
}