BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ModelPath.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Models/ModelPath.h
6 //! @brief Defines ModelPath namespace
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 
15 #ifndef BORNAGAIN_GUI_COREGUI_MODELS_MODELPATH_H
16 #define BORNAGAIN_GUI_COREGUI_MODELS_MODELPATH_H
17 
19 #include <memory>
20 #include <vector>
21 
22 class SessionItem;
23 class QModelIndex;
24 class SessionModel;
25 
26 namespace ModelPath {
27 QString getPathFromIndex(const QModelIndex& index);
28 
29 QModelIndex getIndexFromPath(const SessionModel* model, const QString& path);
30 
31 SessionItem* getItemFromPath(const QString& relPath, const SessionItem* parent);
32 
33 bool isValidItem(SessionModel* model, SessionItem* item, const QModelIndex& parent);
34 
35 const SessionItem* ancestor(const SessionItem* item, const QString& requiredModelType);
36 
37 QString itemPathTranslation(const SessionItem& item, const SessionItem* topItem = 0);
38 } // namespace ModelPath
39 
40 #endif // BORNAGAIN_GUI_COREGUI_MODELS_MODELPATH_H
Defines interface IParameterTranslator and subclasses.
SessionItem * getItemFromPath(const QString &relPath, const SessionItem *parent)
returns an item from relative path wrt to given parent
Definition: ModelPath.cpp:60
QModelIndex getIndexFromPath(const SessionModel *model, const QString &path)
Definition: ModelPath.cpp:36
bool isValidItem(SessionModel *model, SessionItem *item, const QModelIndex &parent)
Iterates through all the model and returns true if item is found. This is to.
Definition: ModelPath.cpp:69
const SessionItem * ancestor(const SessionItem *item, const QString &requiredModelType)
Returns ancestor of given modelType for given item.
Definition: ModelPath.cpp:87
QString getPathFromIndex(const QModelIndex &index)
Definition: ModelPath.cpp:19
QString itemPathTranslation(const SessionItem &item, const SessionItem *topItem=0)
Returns translation of item path to domain name.
Definition: ModelPath.cpp:98