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

simplify code (rm indirections)

parent 6572fcc6
No related branches found
No related tags found
1 merge request!397Centralize item infos
......@@ -40,8 +40,3 @@ SessionItem* GUI::Model::ItemFactory::CreateEmptyItem()
{
return new SessionItem("ROOT_ITEM");
}
QStringList GUI::Model::ItemFactory::ValidTopItemTypes()
{
return ItemCatalog::validTopItemTypes();
}
......@@ -31,10 +31,6 @@ template <typename ItemType> ItemType* CreateItem(SessionItem* parent = nullptr)
//! create empty SessionItem that serves as a root item
SessionItem* CreateEmptyItem();
//! retrieve list of all possible item types suitable for
QStringList ValidTopItemTypes();
template <typename ItemType> ItemType* CreateItem(SessionItem* parent)
{
return dynamic_cast<ItemType*>(CreateItem(ItemType::M_TYPE, parent));
......
......@@ -14,7 +14,7 @@
#include "GUI/Views/SampleDesigner/SampleTreeWidget.h"
#include "GUI/Models/FilterPropertyProxy.h"
#include "GUI/Models/ItemFactory.h"
#include "GUI/Models/ItemCatalog.h"
#include "GUI/Models/SampleModel.h"
#include "GUI/Views/SampleDesigner/ItemTreeView.h"
#include <QAction>
......@@ -64,7 +64,7 @@ void SampleTreeWidget::showContextMenu(const QPoint& pnt)
QModelIndex parent_index = FilterPropertyProxy::toSourceIndex(treeView()->indexAt(pnt));
treeView()->setCurrentIndex(parent_index);
if (!parent_index.isValid()) {
addItemNames = GUI::Model::ItemFactory::ValidTopItemTypes().toVector();
addItemNames = ItemCatalog::validTopItemTypes().toVector();
} else {
addItemNames = m_sampleModel->acceptableDefaultItemTypes(parent_index);
}
......
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