From 4550f80dc40f52c1bad70ac068f8aecbbe6344d1 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Tue, 13 Nov 2018 13:32:36 -0600 Subject: [PATCH] Begin tabs properly --- forms/eventpropertiesframe.ui | 944 +++------------------------------- src/mainwindow.cpp | 42 +- 2 files changed, 73 insertions(+), 913 deletions(-) diff --git a/forms/eventpropertiesframe.ui b/forms/eventpropertiesframe.ui index af691bcc..5007d951 100644 --- a/forms/eventpropertiesframe.ui +++ b/forms/eventpropertiesframe.ui @@ -7,7 +7,7 @@ 0 0 284 - 1084 + 146 @@ -37,7 +37,7 @@ 1 - + @@ -200,890 +200,63 @@ - - - - - - - - Sprite - - - comboBox_sprite - - - - - - - true - - - - 0 - 0 - - - - Qt::StrongFocus - - - <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> - - - true - - - - - - 25 - - - QComboBox::AdjustToContentsOnFirstShow - - - - + + + + 0 + 0 + + + + + 9 + + + 0 + + + 0 + + + + + Sprite + + + comboBox_sprite + + - - - - - - Movement - - - comboBox_sprite - - - - - - - true - - - - 0 - 0 - - - - Qt::StrongFocus - - - <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> - - - true - - - - - - 25 - - - QComboBox::AdjustToContentsOnFirstShow - - - - - - - - - - - Movement Radius X - - - comboBox_sprite - - - - - - - true - - - - 0 - 0 - - - - Qt::StrongFocus - - - <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> - - - true - - - - - - 25 - - - QComboBox::AdjustToContentsOnFirstShow - - - - - - - - - - - Movement Radius Y - - - comboBox_sprite - - - - - - - true - - - - 0 - 0 - - - - Qt::StrongFocus - - - <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> - - - true - - - - - - 25 - - - QComboBox::AdjustToContentsOnFirstShow - - - - - - - - - - - Script - - - comboBox_sprite - - - - - - - true - - - - 0 - 0 - - - - Qt::StrongFocus - - - <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> - - - true - - - - - - 25 - - - QComboBox::AdjustToContentsOnFirstShow - - - - - - - - - - - Event Flag - - - comboBox_sprite - - - - - - - true - - - - 0 - 0 - - - - Qt::StrongFocus - - - <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> - - - true - - - - - - 25 - - - QComboBox::AdjustToContentsOnFirstShow - - - - - - - - - - - Trainer - - - - - - - - 0 - 0 - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Sight Radius / Berry Tree ID - - - comboBox_sprite - - - - - - - true - - - - 0 - 0 - - - - Qt::StrongFocus - - - <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> - - - true - - - - - - 25 - - - QComboBox::AdjustToContentsOnFirstShow - - - - - - - - - - - - - - - - - Destination Map - - - comboBox_sprite - - - - - - - true - - - - 0 - 0 - - - - Qt::StrongFocus - - - <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> - - - true - - - - - - 25 - - - QComboBox::AdjustToContentsOnFirstShow - - - - - - - - - - - Destination Warp - - - comboBox_sprite - - - - - - - true - - - - 0 - 0 - - - - Qt::StrongFocus - - - <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> - - - true - - - - - - 25 - - - QComboBox::AdjustToContentsOnFirstShow - - - - - - - - - - - - - - - - - Script - - - comboBox_sprite - - - - - - - true - - - - 0 - 0 - - - - Qt::StrongFocus - - - <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> - - - true - - - - - - 25 - - - QComboBox::AdjustToContentsOnFirstShow - - - - - - - - - - - Var - - - comboBox_sprite - - - - - - - true - - - - 0 - 0 - - - - Qt::StrongFocus - - - <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> - - - true - - - - - - 25 - - - QComboBox::AdjustToContentsOnFirstShow - - - - - - - - - - - Var Value - - - comboBox_sprite - - - - - - - true - - - - 0 - 0 - - - - Qt::StrongFocus - - - <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> - - - true - - - - - - 25 - - - QComboBox::AdjustToContentsOnFirstShow - - - - - - - - - - - - - - - - - Weather - - - comboBox_sprite - - - - - - - true - - - - 0 - 0 - - - - Qt::StrongFocus - - - <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> - - - true - - - - - - 25 - - - QComboBox::AdjustToContentsOnFirstShow - - - - - - - - - - - - - - - - - Player Facing Direction - - - comboBox_sprite - - - - - - - true - - - - 0 - 0 - - - - Qt::StrongFocus - - - <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> - - - true - - - - - - 25 - - - QComboBox::AdjustToContentsOnFirstShow - - - - - - - - - - - Script - - - comboBox_sprite - - - - - - - true - - - - 0 - 0 - - - - Qt::StrongFocus - - - <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> - - - true - - - - - - 25 - - - QComboBox::AdjustToContentsOnFirstShow - - - - - - - - - - - - - - - - - Item - - - comboBox_sprite - - - - - - - true - - - - 0 - 0 - - - - Qt::StrongFocus - - - <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> - - - true - - - - - - 25 - - - QComboBox::AdjustToContentsOnFirstShow - - - - - - - - - - - Flag - - - comboBox_sprite - - - - - - - true - - - - 0 - 0 - - - - Qt::StrongFocus - - - <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> - - - true - - - - - - 25 - - - QComboBox::AdjustToContentsOnFirstShow - - - - - - - - - - - - - - - - - Secret Base ID - - - comboBox_sprite - - - - - - - true - - - - 0 - 0 - - - - Qt::StrongFocus - - - <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> - - - true - - - - - - 25 - - - QComboBox::AdjustToContentsOnFirstShow - - - - + + + + true + + + + 0 + 0 + + + + Qt::StrongFocus + + + <html><head/><body><p>The sprite graphics to use for this object.</p></body></html> + + + true + + + + + + 25 + + + QComboBox::AdjustToContentsOnFirstShow + + @@ -1106,6 +279,7 @@ spinBox_x spinBox_y spinBox_z + comboBox_sprite diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b34168a1..d203ae7b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -892,7 +892,6 @@ void MainWindow::updateSelectedObjects() { editor->selected_events->append(selectedEvent); editor->redrawObject(selectedEvent); events->append(selectedEvent); - } } @@ -939,7 +938,7 @@ void MainWindow::updateSelectedObjects() { frame->ui->label_spritePixmap->setPixmap(item->event->pixmap); connect(item, SIGNAL(spriteChanged(QPixmap)), frame->ui->label_spritePixmap, SLOT(setPixmap(QPixmap))); - /*frame->ui->sprite->setVisible(false); + frame->ui->sprite->setVisible(false); QMap field_labels; field_labels["script_label"] = "Script"; @@ -961,45 +960,32 @@ void MainWindow::updateSelectedObjects() { field_labels["flag"] = "Flag"; field_labels["secret_base_id"] = "Secret Base Id"; - QStringList fields;*/ - - for (QWidget *widget : frame->findChildren(QString(), Qt::FindDirectChildrenOnly)) - { - widget->hide(); - } + QStringList fields; if (event_type == EventType::Object) { - frame->ui->object->setVisible(true); + frame->ui->sprite->setVisible(true); frame->ui->comboBox_sprite->addItems(event_obj_gfx_constants.keys()); frame->ui->comboBox_sprite->setCurrentText(item->event->get("sprite")); connect(frame->ui->comboBox_sprite, SIGNAL(activated(QString)), item, SLOT(set_sprite(QString))); - frame->ui->comboBox_movement->setCurrentText(item->event->get("movement_type")); - item->bind(frame->ui->comboBox_movement, "movement_type"); - - frame->ui->comboBox_movementRadiusX->setCurrentText(item->event->get("radius_x")); - item->bind(frame->ui->comboBox_movementRadiusX, "radius_x"); - - frame->ui->comboBox_movementRadiusY->setCurrentText(item->event->get("radius_y")); - item->bind(frame->ui->comboBox_movementRadiusY, "radius_y"); - - //frame->ui->script->setVisible(true); - //frame->ui->comboBox_script->addItem(item->event->get("script_label")); + /* + frame->ui->script->setVisible(true); + frame->ui->comboBox_script->addItem(item->event->get("script_label")); frame->ui->comboBox_script->setCurrentText(item->event->get("script_label")); //item->bind(frame->ui->comboBox_script, "script_label"); - //connect(frame->ui->comboBox_script, SIGNAL(activated(QString)), item, SLOT(set_script(QString))); + connect(frame->ui->comboBox_script, SIGNAL(activated(QString)), item, SLOT(set_script(QString))); //connect(frame->ui->comboBox_script, static_cast(&QComboBox::activated), item, [item](QString script_label){ item->event->put("script_label", script_label); }); //connect(item, SIGNAL(scriptChanged(QString)), frame->ui->comboBox_script, SLOT(setValue(QString))); - item->bind(frame->ui->comboBox_script, "script_label"); + */ - /*fields << "movement_type"; + fields << "movement_type"; fields << "radius_x"; fields << "radius_y"; fields << "script_label"; fields << "event_flag"; fields << "is_trainer"; - fields << "sight_radius_tree_id";*/ + fields << "sight_radius_tree_id"; } else if (event_type == EventType::Warp) { fields << "destination_map_name"; @@ -1138,19 +1124,19 @@ void MainWindow::updateSelectedObjects() { if (event_type == EventType::Object) { target = ui->eventsObjects_ScrollAreaContents; - ui->tabWidget_EventType->setCurrentIndex(0); + ui->tabWidget_EventType->setCurrentWidget(ui->tab_Objects); } else if (event_type == EventType::Warp) { target = ui->eventsWarps_ScrollAreaContents; - ui->tabWidget_EventType->setCurrentIndex(1); + ui->tabWidget_EventType->setCurrentWidget(ui->tab_Warps); } else if (event_type == EventType::CoordScript || event_type == EventType::CoordWeather) { target = ui->eventsTriggers_ScrollAreaContents; - ui->tabWidget_EventType->setCurrentIndex(2); + ui->tabWidget_EventType->setCurrentWidget(ui->tab_Triggers); } else if (event_type == EventType::Sign || event_type == EventType::HiddenItem || event_type == EventType::SecretBase) { target = ui->eventsBGs_ScrollAreaContents; - ui->tabWidget_EventType->setCurrentIndex(3); + ui->tabWidget_EventType->setCurrentWidget(ui->tab_BGs); } ui->tabWidget_EventType->removeTab(ui->tabWidget_EventType->indexOf(ui->tab_Multiple));