BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
linkeditem.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // qt-mvvm: Model-view-view-model framework for large GUI applications
4 //
5 //! @file mvvm/model/mvvm/standarditems/linkeditem.cpp
6 //! @brief Implements class CLASS?
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2020
11 //! @authors Gennady Pospelov et al, Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
17 
18 using namespace ModelView;
19 
20 namespace {
21 const Variant empty_link = Variant::fromValue(std::string());
22 }
23 
25 {
26  setData(empty_link);
27  setEditable(false); // prevent editing in widgets, link is set programmatically.
28 }
29 
30 //! Set link to given item.
31 
33 {
34  setData(item ? Variant::fromValue(item->identifier()) : empty_link);
35 }
void setLink(const SessionItem *item)
Set link to given item.
Definition: linkeditem.cpp:32
The main object representing an editable/displayable/serializable entity.
Definition: sessionitem.h:38
SessionItem * setEditable(bool value)
Sets editable flag to given value (fluent interface).
bool setData(const T &value, int role=ItemDataRole::DATA, bool direct=false)
Sets data for a given role.
Definition: sessionitem.h:141
T * item(const std::string &tag) const
Returns first item under given tag casted to a specified type.
Definition: sessionitem.h:156
Defines class CLASS?
Defines class CLASS?
const model_type LinkedItemType
Definition: mvvm_types.h:56
materialitems.h Collection of materials to populate MaterialModel.
QVariant Variant
Definition: variant.h:23