Skip to content
Snippets Groups Projects
Commit 0efd9c7f authored by Matthias Puchner's avatar Matthias Puchner
Browse files

free ParticleCoreShellForm from SessionItem

parent 766e36ea
No related branches found
No related tags found
1 merge request!570remove SessionModel/Item from SampleModel and all related items
......@@ -13,6 +13,7 @@
// ************************************************************************************************
#include "GUI/View/SampleDesigner/ParticleCoreShellForm.h"
#include "GUI/Model/Sample/FormFactorItemCatalog.h"
#include "GUI/Model/Sample/FormFactorItems.h"
#include "GUI/Model/Sample/ParticleCoreShellItem.h"
#include "GUI/Model/Sample/ParticleItem.h"
......@@ -22,7 +23,6 @@
#include "GUI/View/SampleDesigner/SampleEditorController.h"
#include "GUI/View/SampleDesigner/SelectionContainerForm.h"
#include "GUI/View/Tool/GroupBoxCollapser.h"
#include <QAction>
#include <QComboBox>
#include <memory>
......@@ -31,21 +31,17 @@ namespace {
QComboBox* createFormFactorCombo(QWidget* parent, FormFactorItem* current)
{
ASSERT(current);
auto* combo = new QComboBox(parent);
WheelEventEater::install(combo);
combo->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
combo->addItem(QIcon(), "None", "");
for (const auto& modelType : ItemCatalog::formfactorTypes()) {
const auto ui = ItemCatalog::instance().uiInfo(modelType);
combo->addItem(QIcon(ui.iconPath), ui.menuEntry, modelType);
for (const auto type : FormFactorItemCatalog::types()) {
const auto ui = FormFactorItemCatalog::uiInfo(type);
combo->addItem(QIcon(ui.iconPath), ui.menuEntry, (uint8_t)type);
}
combo->setMaxVisibleItems(combo->count());
if (current == nullptr)
combo->setCurrentIndex(0);
else
combo->setCurrentIndex(combo->findData(current->modelType()));
combo->setCurrentIndex(combo->findData((uint8_t)FormFactorItemCatalog::type(current)));
return combo;
}
......@@ -131,8 +127,8 @@ void ParticleCoreShellForm::onCoreComboChanged()
while (core.layouter->layout()->rowCount() > 1)
core.layouter->layout()->removeRow(1);
const QString newClassName = core.formfactorCombo->currentData().toString();
m_ec->setCoreFormFactor(this, newClassName);
const auto type = (FormFactorItemCatalog::Type)core.formfactorCombo->currentData().toUInt();
m_ec->setCoreFormFactor(this, type);
}
void ParticleCoreShellForm::onShellComboChanged()
......@@ -140,8 +136,8 @@ void ParticleCoreShellForm::onShellComboChanged()
while (shell.layouter->layout()->rowCount() > 1)
shell.layouter->layout()->removeRow(1);
const QString newClassName = shell.formfactorCombo->currentData().toString();
m_ec->setShellFormFactor(this, newClassName);
const auto type = (FormFactorItemCatalog::Type)shell.formfactorCombo->currentData().toUInt();
m_ec->setShellFormFactor(this, type);
}
void ParticleCoreShellForm::showCoreInRealSpace()
......@@ -161,9 +157,7 @@ void ParticleCoreShellForm::createCoreWidgets()
QString groupTitle = "Core";
if (ParticleItem* particle = m_item->core()) {
const QString formfactor =
particle->formfactorItem()->value().value<ComboProperty>().getValue();
const QString formfactor = FormFactorItemCatalog::menuEntry(particle->formfactor());
groupTitle += " (" + formfactor + ")";
core.layouter->addGroupOfValues("Geometry", particle->formfactor()->geometryValues());
......@@ -180,9 +174,7 @@ void ParticleCoreShellForm::createShellWidgets()
QString groupTitle = "Shell";
if (ParticleItem* particle = m_item->shell()) {
const QString formfactor =
particle->formfactorItem()->value().value<ComboProperty>().getValue();
const QString formfactor = FormFactorItemCatalog::menuEntry(particle->formfactor());
groupTitle += " (" + formfactor + ")";
shell.layouter->addGroupOfValues("Geometry", particle->formfactor()->geometryValues());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment