BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ItemFactory.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/MakeItem/ItemFactory.cpp
6 //! @brief Implements class ItemFactory
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
18 
19 SessionItem* GUI::Model::ItemFactory::CreateItem(const QString& model_name, SessionItem* parent)
20 {
21  SessionItem* result = ItemCatalog::instance().createItemPtr(model_name).release();
22  if (parent)
23  parent->insertChild(-1, result);
24 
25  return result;
26 }
Defines class ItemCatalog.
Defines namespace GUI::Model::ItemFactory.
Defines class SessionItem.
static ItemCatalog & instance()
Definition: ItemCatalog.cpp:80
std::unique_ptr< SessionItem > createItemPtr(const QString &modelType) const
Definition: ItemCatalog.cpp:86
Base class for a GUI data item.
Definition: SessionItem.h:204
void insertChild(int row, SessionItem *item, const QString &tag="")
Insert item into given tag into given row.
SessionItem * CreateItem(const QString &model_name, SessionItem *parent=nullptr)
create SessionItem of specific type and parent
Definition: ItemFactory.cpp:19