Improve UI #13

Merged
shaunrd0 merged 28 commits from ui into master 2023-03-12 02:02:28 +00:00
3 changed files with 9 additions and 3 deletions
Showing only changes of commit e6bcd131b7 - Show all commits

View File

@ -76,5 +76,5 @@ Qtk::QtkWidget * MainWindow::getQtkWidget(const QString & name) {
void MainWindow::refreshScene(QString sceneName) { void MainWindow::refreshScene(QString sceneName) {
// TODO: Select TreeView using sceneName> // TODO: Select TreeView using sceneName>
ui_->qtk__TreeView->updateView(getQtkWidget(sceneName)->getScene()); ui_->qtk__TreeView->updateView(getQtkWidget()->getScene());
} }

View File

@ -108,7 +108,13 @@ void QtkWidget::paintGL() {
} }
void QtkWidget::setScene(Qtk::Scene * scene) { void QtkWidget::setScene(Qtk::Scene * scene) {
if (mScene != Q_NULLPTR) {
delete mScene; delete mScene;
connect(
scene, &Qtk::Scene::sceneUpdated, MainWindow::getMainWindow(),
&MainWindow::refreshScene);
}
mScene = scene; mScene = scene;
if(mScene != Q_NULLPTR) { if(mScene != Q_NULLPTR) {
mConsole->setTitle(mScene->getSceneName()); mConsole->setTitle(mScene->getSceneName());

View File

@ -45,7 +45,7 @@ void Qtk::TreeView::updateView(const Qtk::Scene * scene) {
void Qtk::TreeView::itemFocus(QTreeWidgetItem * item, int column) { void Qtk::TreeView::itemFocus(QTreeWidgetItem * item, int column) {
QString name = item->text(column); QString name = item->text(column);
auto scene = auto scene =
MainWindow::getMainWindow()->getQtkWidget(mSceneName)->getScene(); MainWindow::getMainWindow()->getQtkWidget()->getScene();
auto & transform = scene->getCamera().getTransform(); auto & transform = scene->getCamera().getTransform();
auto object = scene->getObject(name); auto object = scene->getObject(name);
if (object == Q_NULLPTR) { if (object == Q_NULLPTR) {