BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Base class for a GUI data item.
SessionItem and SessionModel implement the base structures to store data in the GUI layer.
SessionItem provides
For realizing the highly generic approach, access to properties, children, values, signals is done by strings. Converting values is done by means provided by QVariant.
A data structure is realized at runtime, not at compile time (therefore e.g. properties are not just data members, but children of type SessionItem). The tree structure, properties, UI etc. are usually created by initialization routines.
By this, the data holding is completely generic and also completely volatile - it can be changed at any time, properties or children can be added or removed to represent different behavior, or even different objects. This realizes kind of a dynamic polymorphy, which can be examined by strings. E.g. to find out whether a child is a property with a value, or a grouping element with more children, the child's modelType() has to be checked against "Property", "GroupProperty", and so on. The model type therefore is comparable to the "class" of the SessionItem.
The hierarchy of a SessionItem and its children is used for
Example for creating properties (properties are a replacement for data members):
In this example, the text "Radius" will be used
The object has nothing like a
Relation to core elements
The GUI component does not use core component elements to store data.
As an example, here the representation of simulation options in the core layer:
And following the corresponding object in the UI layer.
As one can see, no structure is visible at all in the class definition itself. The structure is created in the constructor:
The onPropertyChange part in the above example shows also the string based access to values as well as types:
Since UI and core are using completely unrelated objects, a conversion between the two components is necessary. This is done with the functions in namespace TransformFromCore and TransformToCore.
For IParticle this looks like this:
This code part again shows the (highly error-prone) string-based type checking.
Definition at line 204 of file SessionItem.h.
Public Member Functions | |
SessionItem (const QString &modelType) | |
Constructs new item with given model type. The type must be defined. More... | |
virtual | ~SessionItem () |
Destructor deletes all its children and request parent to delete this item. More... | |
QVector< QString > | acceptableDefaultItemTypes () const |
Returns vector of acceptable default tag types. More... | |
bool | acceptsAsDefaultItem (const QString &item_name) const |
Returns true if model type can be added to default tag. More... | |
SessionItem * | addGroupProperty (const QString &groupTag, const GroupInfo &groupInfo) |
template<typename T > | |
T * | addProperty (const QString &name) |
SessionItem * | addProperty (const QString &name, const QVariant &variant) |
Add new property item and register new tag. name is the tag name and the display name. The property's value will be set to variant. More... | |
virtual bool | allowWritingChildToXml (SessionItem *child) const |
SessionItem * | childAt (int row) const |
Returns the child at the given row. More... | |
QVector< SessionItem * > | children () const |
Returns vector of all children. More... | |
template<typename T > | |
QVector< T * > | childrenOfType () const |
QVector< SessionItem * > | childrenOfType (const QString &model_type) const |
Returns a vector of all children of the given type. More... | |
int | decimals () const |
QString | defaultTag () const |
Get default tag. More... | |
virtual void | deserializeBinaryData (const QByteArray &data) |
QString | displayName () const |
Get display name of item, append index if ambigue. More... | |
void | emitDataChanged (int role=Qt::DisplayRole) |
Notify model about data changes. More... | |
template<typename T > | |
T * | firstChildOfType () const |
SessionItem * | getChildOfType (const QString &type) const |
Returns the first child of the given type. More... | |
SessionItem * | getGroupItem (const QString &groupName) const |
Access subitem of group item. More... | |
SessionItem * | getItem (const QString &tag="", int row=0) const |
Returns item in given row of given tag. More... | |
QVector< SessionItem * > | getItems (const QString &tag="") const |
Returns vector of all items of given tag. More... | |
QVariant | getItemValue (const QString &tag) const |
Directly access value of item under given tag. More... | |
QVector< int > | getRoles () const |
Returns vector of all present roles. More... | |
template<typename T > | |
T & | groupItem (const QString &groupName) const |
bool | hasChildren () const |
Indicates whether this SessionItem has any child items. More... | |
template<typename T > | |
bool | hasModelType () const |
QModelIndex | index () const |
Returns model index of this item. More... | |
void | insertChild (int row, SessionItem *item, const QString &tag="") |
Insert item into given tag into given row. More... | |
bool | isEditable () const |
bool | isEnabled () const |
bool | isTag (const QString &name) const |
Returns true if tag is available. More... | |
template<typename T > | |
T * | item (const QString &tag) const |
QString | itemName () const |
Get item name, return display name if no name is set. More... | |
template<typename T > | |
QVector< T * > | items (const QString &tag="") const |
RealLimits | limits () const |
ModelMapper * | mapper () |
Returns the current model mapper of this item. Creates new one if necessary. More... | |
SessionModel * | model () const |
Returns model of this item. More... | |
QString | modelType () const |
Get model type. More... | |
int | numberOfChildren () const |
Returns total number of children. More... | |
SessionItem * | parentItem () const |
Returns parent of this item. More... | |
int | parentRow () |
Returns the index of the given item within its parent. Returns -1 when no parent is set. More... | |
virtual void | readNonSessionItems (QXmlStreamReader *reader) |
bool | registerTag (const QString &name, int min=0, int max=-1, QStringList modelTypes={}) |
Add new tag to this item with given name, min, max and types. max = -1 -> unlimited, modelTypes empty -> all types allowed. More... | |
QVariant | roleProperty (int role) const |
Returns corresponding variant under given role, invalid variant when role is not present. More... | |
int | rowOfChild (SessionItem *child) const |
Returns row index of given child. More... | |
virtual QByteArray | serializeBinaryData () const |
const SessionItemTags * | sessionItemTags () const |
SessionItem & | setDecimals (int n) |
void | setDefaultTag (const QString &tag) |
Set default tag. More... | |
void | setDisplayName (const QString &display_name) |
Set display name. More... | |
void | setEditable (bool enabled) |
void | setEnabled (bool enabled) |
Flags accessors. More... | |
SessionItem * | setGroupProperty (const QString &groupTag, const QString &modelType) const |
Set the current type of group item. More... | |
template<typename T > | |
T * | setGroupPropertyType (const QString &groupTag) |
void | setItemName (const QString &name) |
Set item name, add property if necessary. More... | |
void | setItemValue (const QString &tag, const QVariant &variant) const |
Directly set value of item under given tag. More... | |
SessionItem & | setLimits (const RealLimits &value) |
bool | setRoleProperty (int role, const QVariant &value) |
Set the contained role property to the given value. See also setTranslatorForRolePropertySetter. More... | |
SessionItem & | setToolTip (const QString &tooltip) |
bool | setValue (QVariant value) |
Set value, ensure that variant types match. More... | |
QString | tagFromItem (const SessionItem *item) const |
Returns the tag name of given item when existing. More... | |
SessionItem * | takeItem (int row, const QString &tag) |
Remove item from given row from given tag. More... | |
SessionItem * | takeRow (int row) |
Removes row from item and returns the item. More... | |
QString | toolTip () const |
QVariant | value () const |
Get value. More... | |
virtual void | writeNonSessionItems (QXmlStreamWriter *writer) const |
Static Public Member Functions | |
static bool | isItemNamePropertyName (const QString &name) |
Private Member Functions | |
void | changeFlags (bool enabled, int flag) |
internal More... | |
void | childDeleted (SessionItem *child) |
int | flags () const |
int | getCopyNumberOfChild (const SessionItem *item) const |
internal More... | |
void | setModel (SessionModel *model) |
void | setParentAndModel (SessionItem *parent, SessionModel *model) |
Private Attributes | |
QVector< SessionItem * > | m_children |
std::unique_ptr< ModelMapper > | m_mapper |
SessionModel * | m_model |
SessionItem * | m_parent |
std::unique_ptr< SessionItemData > | m_properties |
std::unique_ptr< SessionItemTags > | m_tags |
Static Private Attributes | |
static constexpr auto | P_NAME {"Name"} |
Friends | |
class | SessionModel |
|
explicit |
Constructs new item with given model type. The type must be defined.
Definition at line 25 of file SessionItem.cpp.
References modelType(), SessionFlags::ModelTypeRole, setDecimals(), setDisplayName(), setLimits(), and setRoleProperty().
|
virtual |
Destructor deletes all its children and request parent to delete this item.
Definition at line 41 of file SessionItem.cpp.
References childDeleted(), m_children, m_mapper, m_model, m_parent, and setModel().
QVector< QString > SessionItem::acceptableDefaultItemTypes | ( | ) | const |
Returns vector of acceptable default tag types.
Definition at line 193 of file SessionItem.cpp.
References defaultTag(), and m_tags.
bool SessionItem::acceptsAsDefaultItem | ( | const QString & | item_name | ) | const |
Returns true if model type can be added to default tag.
Definition at line 186 of file SessionItem.cpp.
References defaultTag(), and m_tags.
SessionItem * SessionItem::addGroupProperty | ( | const QString & | groupTag, |
const GroupInfo & | groupInfo | ||
) |
Definition at line 306 of file SessionItem.cpp.
References GUI::Model::ItemFactory::CreateItem(), groupItem(), insertChild(), GroupItem::M_TYPE, and registerTag().
Referenced by MinimizerContainerItem::MinimizerContainerItem().
T * SessionItem::addProperty | ( | const QString & | name | ) |
Definition at line 394 of file SessionItem.h.
References insertChild(), registerTag(), and setDisplayName().
SessionItem * SessionItem::addProperty | ( | const QString & | name, |
const QVariant & | variant | ||
) |
Add new property item and register new tag. name is the tag name and the display name. The property's value will be set to variant.
Definition at line 278 of file SessionItem.cpp.
References GUI::Model::ItemFactory::CreateItem(), insertChild(), isTag(), PropertyItem::M_TYPE, GUI::RealSpace::Particles::name(), and registerTag().
Referenced by AmplitudeAxisItem::AmplitudeAxisItem(), BasicAxisItem::BasicAxisItem(), Data1DProperties::Data1DProperties(), Data1DViewItem::Data1DViewItem(), DataItem::DataItem(), DataProperties::DataProperties(), EllipseItem::EllipseItem(), FitParameterItem::FitParameterItem(), FitParameterLinkItem::FitParameterLinkItem(), FitSuiteItem::FitSuiteItem(), GeneticMinimizerItem::GeneticMinimizerItem(), GSLLMAMinimizerItem::GSLLMAMinimizerItem(), GSLMultiMinimizerItem::GSLMultiMinimizerItem(), HorizontalLineItem::HorizontalLineItem(), IntensityDataItem::IntensityDataItem(), JobItem::JobItem(), MaskItem::MaskItem(), MinimizerContainerItem::MinimizerContainerItem(), MinuitMinimizerItem::MinuitMinimizerItem(), PointwiseAxisItem::PointwiseAxisItem(), PolygonItem::PolygonItem(), PolygonPointItem::PolygonPointItem(), RealDataItem::RealDataItem(), RectangleItem::RectangleItem(), SimAnMinimizerItem::SimAnMinimizerItem(), SpecularDataItem::SpecularDataItem(), VerticalLineItem::VerticalLineItem(), and setItemName().
|
virtual |
Definition at line 528 of file SessionItem.cpp.
Referenced by GUI::Session::XML::writeItemAndChildItems().
|
private |
internal
Definition at line 568 of file SessionItem.cpp.
References SessionFlags::FlagRole, flags(), and setRoleProperty().
Referenced by setEditable(), and setEnabled().
SessionItem * SessionItem::childAt | ( | int | row | ) | const |
Returns the child at the given row.
Definition at line 102 of file SessionItem.cpp.
References m_children.
Referenced by SessionModel::index(), and takeRow().
|
private |
Definition at line 533 of file SessionItem.cpp.
References index(), m_children, and rowOfChild().
Referenced by ~SessionItem().
QVector< SessionItem * > SessionItem::children | ( | ) | const |
Returns vector of all children.
Definition at line 95 of file SessionItem.cpp.
References m_children.
Referenced by MaskContainerItem::maskItems(), DataPropertyContainer::propertyItem(), and GUI::Session::XML::writeItemAndChildItems().
QVector< T * > SessionItem::childrenOfType |
QVector< SessionItem * > SessionItem::childrenOfType | ( | const QString & | model_type | ) | const |
Returns a vector of all children of the given type.
Definition at line 127 of file SessionItem.cpp.
References m_children.
Referenced by ProjectionsPlot::projectionItems(), and SaveProjectionsAssistant::projectionItems().
int SessionItem::decimals | ( | ) | const |
Definition at line 484 of file SessionItem.cpp.
References SessionFlags::DecimalRole, and roleProperty().
Referenced by GUI::View::PropertyEditorFactory::CreateEditor().
QString SessionItem::defaultTag | ( | ) | const |
Get default tag.
Definition at line 390 of file SessionItem.cpp.
References SessionFlags::DefaultTagRole, and roleProperty().
Referenced by acceptableDefaultItemTypes(), acceptsAsDefaultItem(), SessionModel::copy(), getItem(), getItems(), insertChild(), SessionModel::insertNewItem(), SessionModel::moveItem(), and takeItem().
|
virtual |
Reimplemented in PointwiseAxisItem, and RealDataItem.
Definition at line 522 of file SessionItem.cpp.
Referenced by GUI::Session::XML::readItems().
QString SessionItem::displayName | ( | ) | const |
Get display name of item, append index if ambigue.
Definition at line 404 of file SessionItem.cpp.
References SessionFlags::DisplayNameRole, getCopyNumberOfChild(), index(), SessionItemTags::isSingleItemTag(), m_parent, roleProperty(), sessionItemTags(), and tagFromItem().
Referenced by SelectionDescriptor< T >::SelectionDescriptor(), and itemName().
void SessionItem::emitDataChanged | ( | int | role = Qt::DisplayRole | ) |
Notify model about data changes.
Definition at line 358 of file SessionItem.cpp.
References index(), SessionModel::indexOfItem(), and m_model.
Referenced by GroupItem::onValueChange(), IntensityDataItem::setDatafield(), SpecularDataItem::setDatafield(), setRoleProperty(), and PointwiseAxisItem::updateIndicators().
T * SessionItem::firstChildOfType |
|
private |
Definition at line 557 of file SessionItem.cpp.
References SessionFlags::EDITABLE, SessionFlags::ENABLED, SessionFlags::FlagRole, roleProperty(), and SessionFlags::VISIBLE.
Referenced by changeFlags(), isEditable(), and isEnabled().
SessionItem * SessionItem::getChildOfType | ( | const QString & | type | ) | const |
Returns the first child of the given type.
Definition at line 116 of file SessionItem.cpp.
References m_children.
Referenced by GroupItemController::currentItem(), GroupItemController::getItemOfType(), and GroupItemController::setCurrentType().
|
private |
internal
Definition at line 580 of file SessionItem.cpp.
References item(), m_children, and P_NAME.
Referenced by displayName().
SessionItem * SessionItem::getGroupItem | ( | const QString & | groupName | ) | const |
Access subitem of group item.
Definition at line 327 of file SessionItem.cpp.
Referenced by groupItem(), and setGroupPropertyType().
SessionItem * SessionItem::getItem | ( | const QString & | tag = "" , |
int | row = 0 |
||
) | const |
Returns item in given row of given tag.
Definition at line 200 of file SessionItem.cpp.
References defaultTag(), index(), m_children, and m_tags.
Referenced by FitParameterItem::FitParameterItem(), EllipseItem::angle(), DataItem::axesUnits(), Data1DViewItem::axesUnitsDescriptor(), BasicAxisItem::binsItem(), FitSuiteItem::createFitParametersContainer(), JobItem::createFitSuiteItem(), FitSuiteItem::createMinimizerContainer(), JobItem::dataItem(), RealDataItem::dataItem(), JobItem::dataItemView(), JobItem::fitSuiteItem(), DataItem::getAxesUnitsItem(), getItemValue(), IntensityDataItem::gradient(), RealDataItem::initDataItem(), FitParameterItem::initMinMaxValues(), JobItem::intensityDataItem(), JobItem::isValidForFitting(), item(), FitParameterLinkItem::linkItem(), AmplitudeAxisItem::logScaleItem(), IntensityDataItem::maskContainerItem(), MaskItem::maskValueItem(), BasicAxisItem::max(), FitParameterItem::maximumItem(), BasicAxisItem::maxItem(), BasicAxisItem::min(), FitParameterItem::minimumItem(), BasicAxisItem::minItem(), RealDataItem::nativeData(), MinimizerContainerItem::normFunction(), MinimizerContainerItem::objectiveMetric(), VerticalLineItem::posX(), HorizontalLineItem::posY(), IntensityDataItem::projectionContainerItem(), JobItem::realDataItem(), BasicAxisItem::serialize(), PolygonPointItem::serialize(), AmplitudeAxisItem::serialize(), RectangleItem::serialize(), PolygonItem::serialize(), VerticalLineItem::serialize(), HorizontalLineItem::serialize(), EllipseItem::serialize(), MaskAllItem::serialize(), PointwiseAxisItem::serialize(), setItemValue(), FitParameterItem::setLimitEnabled(), RealDataItem::setNativeDataUnits(), FitParameterItem::startValueItem(), BasicAxisItem::titleItem(), FitParameterItem::typeItem(), MinuitMinimizerItem::valueDescriptorsForUI(), GSLMultiMinimizerItem::valueDescriptorsForUI(), GeneticMinimizerItem::valueDescriptorsForUI(), SimAnMinimizerItem::valueDescriptorsForUI(), GSLLMAMinimizerItem::valueDescriptorsForUI(), BasicAxisItem::visibilityItem(), EllipseItem::xCenter(), RectangleItem::xLow(), EllipseItem::xRadius(), RectangleItem::xUp(), EllipseItem::yCenter(), RectangleItem::yLow(), EllipseItem::yRadius(), and RectangleItem::yUp().
QVector< SessionItem * > SessionItem::getItems | ( | const QString & | tag = "" | ) | const |
Returns vector of all items of given tag.
Definition at line 221 of file SessionItem.cpp.
References defaultTag(), index(), m_children, and m_tags.
Referenced by MaskUnitsConverter::convertIntensityDataItem(), SessionModel::copy(), GroupItem::groupItems(), items(), SessionModel::moveItem(), DataPropertyContainer::propertyItem(), DataPropertyContainer::propertyItems(), and takeRow().
QVariant SessionItem::getItemValue | ( | const QString & | tag | ) | const |
Directly access value of item under given tag.
Definition at line 292 of file SessionItem.cpp.
References getItem(), isTag(), and value().
Referenced by FitParameterItem::attLimits(), Data1DViewItem::axesUnits(), JobItem::beginTime(), BasicAxisItem::binCount(), FitSuiteItem::chi2(), Data1DProperties::color(), Data1DProperties::colorName(), MaskUnitsConverter::convertCoordinate(), MinimizerContainerItem::createMetric(), MinuitMinimizerItem::createMinimizer(), GSLMultiMinimizerItem::createMinimizer(), GeneticMinimizerItem::createMinimizer(), SimAnMinimizerItem::createMinimizer(), GSLLMAMinimizerItem::createMinimizer(), RectangleItem::createShape(), VerticalLineItem::createShape(), HorizontalLineItem::createShape(), EllipseItem::createShape(), DataProperties::dataItem(), JobItem::endTime(), DataItem::fileName(), JobItem::getComments(), IntensityDataItem::getGradient(), JobItem::getIdentifier(), JobItem::getProgress(), JobItem::getStatus(), PointwiseAxisItem::getUnitsLabel(), FitParameterItem::initMinMaxValues(), RealDataItem::instrumentId(), JobItem::instrumentName(), PolygonItem::isClosed(), IntensityDataItem::isInterpolated(), AmplitudeAxisItem::isLocked(), AmplitudeAxisItem::isLogScale(), BasicAxisItem::isTitleVisible(), FitParameterItem::isValid(), MaskItem::isVisibleValue(), itemName(), FitSuiteItem::iterationCount(), Data1DProperties::line(), FitParameterLinkItem::link(), MaskItem::maskValue(), FitParameterItem::maximum(), FitParameterItem::minimum(), RealDataItem::nativeDataUnits(), Data1DProperties::nextColorName(), PropertyRepeater::onPropertyChanged(), FitParameterItem::parameterType(), PolygonPointItem::posX(), PolygonPointItem::posY(), JobItem::presentationType(), Data1DProperties::scatter(), DataItem::selectedCoords(), PropertyRepeater::setOnChildPropertyChange(), FitParameterItem::startValue(), BasicAxisItem::title(), FitParameterLinkItem::title(), and FitSuiteItem::updateInterval().
QVector< int > SessionItem::getRoles | ( | ) | const |
Returns vector of all present roles.
Definition at line 351 of file SessionItem.cpp.
References m_properties.
Referenced by GUI::Session::XML::writeItemAndChildItems().
T & SessionItem::groupItem | ( | const QString & | groupName | ) | const |
Definition at line 413 of file SessionItem.h.
References getGroupItem().
Referenced by addGroupProperty().
bool SessionItem::hasChildren | ( | ) | const |
Indicates whether this SessionItem has any child items.
Definition at line 81 of file SessionItem.cpp.
References numberOfChildren().
Referenced by IntensityDataItem::hasProjections().
bool SessionItem::hasModelType |
Definition at line 421 of file SessionItem.h.
References modelType().
Referenced by MaskViewFactory::createMaskView(), FitParameterModel::flags(), FitParameterModel::index(), FitParameterModel::indexOfItem(), FitParameterWidget::onFitParametersSelectionChanged(), FitParameterModel::rowCount(), and MaskGraphicsScene::updateViews().
QModelIndex SessionItem::index | ( | ) | const |
Returns model index of this item.
Definition at line 74 of file SessionItem.cpp.
References SessionModel::indexOfItem(), and model().
Referenced by childDeleted(), MaskContainerItem::clear(), FitParameterContainerItem::createParameters(), displayName(), emitDataChanged(), getItem(), getItems(), insertChild(), FitParameterModel::isValidSourceItem(), ParameterItem::linkToSessionItem(), JobModel::removeJob(), FitParameterContainerItem::setValuesInParameterContainer(), IntensityDataProjectionsWidget::subscribeToItem(), tagFromItem(), and takeItem().
void SessionItem::insertChild | ( | int | row, |
SessionItem * | item, | ||
const QString & | tag = "" |
||
) |
Insert item into given tag into given row.
Definition at line 233 of file SessionItem.cpp.
References defaultTag(), index(), item(), m_children, m_model, and m_tags.
Referenced by GroupItemController::GroupItemController(), JobItem::addDataViewItem(), addGroupProperty(), DataPropertyContainer::addItem(), MaskContainerItem::addMask(), PolygonItem::addPoint(), addProperty(), GUI::Model::ItemFactory::CreateItem(), GroupItemController::getItemOfType(), MaskItems::insertMask(), MaskContainerItem::insertMask(), SessionModel::insertNewItem(), SessionModel::moveItem(), and GroupItemController::setCurrentType().
bool SessionItem::isEditable | ( | ) | const |
Definition at line 468 of file SessionItem.cpp.
References SessionFlags::EDITABLE, and flags().
Referenced by SessionModel::flags().
bool SessionItem::isEnabled | ( | ) | const |
Definition at line 463 of file SessionItem.cpp.
References SessionFlags::ENABLED, and flags().
Referenced by SessionModel::flags().
|
static |
Definition at line 446 of file SessionItem.cpp.
References GUI::RealSpace::Particles::name(), and P_NAME.
bool SessionItem::isTag | ( | const QString & | name | ) | const |
Returns true if tag is available.
Definition at line 166 of file SessionItem.cpp.
References m_tags, and GUI::RealSpace::Particles::name().
Referenced by addProperty(), MaskUnitsConverter::convertCoordinate(), getItemValue(), JobItem::isValidForFitting(), itemName(), setItemName(), setItemValue(), and FitParameterItem::setLimitEnabled().
T * SessionItem::item | ( | const QString & | tag | ) | const |
Definition at line 353 of file SessionItem.h.
References getItem().
Referenced by MinimizerContainerItem::MinimizerContainerItem(), PolygonItem::createShape(), DataProperties::dataItem(), DataPropertyContainer::dataItems(), JobItem::fitParameterContainerItem(), FitParameterContainerItem::fitParameterItem(), FitParameterContainerItem::fitParameterNames(), getCopyNumberOfChild(), insertChild(), items(), Data1DViewItem::jobItem(), DataPropertyContainer::propertyItems(), DataProperties::setDataItem(), setGroupPropertyType(), tagFromItem(), takeRow(), SessionModel::topItems(), DataItem::updateAxesUnits(), JobItem::updateIntensityDataFileName(), and RealDataItem::updateNonXMLDataFileNames().
QString SessionItem::itemName | ( | ) | const |
Get item name, return display name if no name is set.
Definition at line 432 of file SessionItem.cpp.
References displayName(), getItemValue(), isTag(), and P_NAME.
Referenced by SessionModel::data(), RealDataItem::dataName(), JobItem::jobName(), MaskItem::maskName(), GUI::Session::XML::readItems(), MaskGraphicsScene::setItemName(), Plot1D::subscribeToItem(), SpecularPlot::subscribeToItem(), ColorMap::subscribeToItem(), ProjectionsPlot::subscribeToItem(), and JobItem::updateIntensityDataFileName().
QVector< T * > SessionItem::items | ( | const QString & | tag = "" | ) | const |
Definition at line 361 of file SessionItem.h.
References getItems(), and item().
Referenced by DataPropertyContainer::dataItems(), takeRow(), and SessionModel::topItem().
RealLimits SessionItem::limits | ( | ) | const |
Definition at line 473 of file SessionItem.cpp.
References SessionFlags::LimitsRole, and roleProperty().
Referenced by GUI::View::PropertyEditorFactory::CreateEditor(), FitParameterContainerItem::createParameters(), and FitParameterItem::initMinMaxValues().
ModelMapper * SessionItem::mapper | ( | ) |
Returns the current model mapper of this item. Creates new one if necessary.
Definition at line 508 of file SessionItem.cpp.
References m_mapper.
Referenced by Data1DViewItem::Data1DViewItem(), FitParameterItem::FitParameterItem(), FitParameterModel::FitParameterModel(), GroupItem::GroupItem(), IShape2DView::IShape2DView(), FitParameterModel::~FitParameterModel(), IntensityDataPropertyWidget::~IntensityDataPropertyWidget(), PropertyRepeater::addItem(), MaskEditorPropertyPanel::addMaskCheckBox(), MaskEditorPropertyPanel::addMaskSpinBox(), IShape2DView::disconnectFromItem(), SessionItemController::onControllerDestroy(), SpecularDataPropertyWidget::setCurrentItem(), MaskEditorPropertyPanel::setCurrentMaskItem(), IntensityDataPropertyWidget::setItem(), FitSessionController::setItem(), SessionItemController::setItem(), RunFitControlWidget::subscribeToItem(), IntensityDataCanvas::subscribeToItem(), FitFlowWidget::subscribeToItem(), Plot1D::subscribeToItem(), SpecularPlot::subscribeToItem(), ColorMap::subscribeToItem(), ProjectionsPlot::subscribeToItem(), SessionItemController::unsubscribe(), RunFitControlWidget::unsubscribeFromChildren(), and ProjectionsPlot::unsubscribeFromChildren().
SessionModel * SessionItem::model | ( | ) | const |
Returns model of this item.
Definition at line 60 of file SessionItem.cpp.
References m_model.
Referenced by FitParameterModel::FitParameterModel(), DataPropertyContainer::addItem(), FitParameterItem::addLink(), MaskContainerItem::clear(), JobItem::copyRealDataIntoJob(), JobItem::createDataViewItem(), FitParameterContainerItem::createFitParameter(), FitSuiteItem::createFitParametersContainer(), JobItem::createFitSuiteItem(), FitSuiteItem::createMinimizerContainer(), Data1DViewItem::createPropertyContainerItem(), JobItem::createRealDataItem(), DataProperties::dataItem(), IntensityDataItem::getOrCreateMaskContainerItem(), IntensityDataItem::getOrCreateProjectionContainerItem(), index(), RealDataItem::initDataItem(), FitParameterWidget::onRemoveFitParAction(), GUI::Session::XML::readItems(), FitParameterItem::removeLink(), JobItem::setDataType(), ModelMapper::setItem(), setModel(), setParentAndModel(), FitParameterModel::sourceModel(), ParameterTuningWidget::subscribeToItem(), ItemStackWidget::validateItem(), and GUI::Session::XML::writeModel().
QString SessionItem::modelType | ( | ) | const |
Get model type.
Definition at line 368 of file SessionItem.cpp.
References SessionFlags::ModelTypeRole, and roleProperty().
Referenced by GSLMultiMinimizerItem::GSLMultiMinimizerItem(), MinuitMinimizerItem::MinuitMinimizerItem(), RectangleItem::RectangleItem(), SessionItem(), GUI::Model::Path::ancestor(), MaskViewFactory::createMaskView(), FitParameterHelper::getParameterItem(), ProjectionsPlot::graphForItem(), hasModelType(), SessionModel::insertItem(), SessionModel::moveItem(), MaskGraphicsScene::processPolygonItem(), MaskGraphicsScene::processRectangleShapeItem(), GroupItem::setCurrentType(), ProjectionsPlot::setGraphFromItem(), setGroupProperty(), MaskGraphicsScene::setItemName(), MaskEditor::setMaskContext(), MaskGraphicsScene::setMaskContext(), SpecularPlot::subscribeToItem(), ColorMap::subscribeToItem(), ProjectionsPlot::subscribeToItem(), and GUI::Session::XML::writeItemAndChildItems().
int SessionItem::numberOfChildren | ( | ) | const |
Returns total number of children.
Definition at line 88 of file SessionItem.cpp.
References m_children.
Referenced by MaskContainerItem::clear(), SessionModel::dropMimeData(), hasChildren(), SessionModel::insertNewItem(), MaskEditorActions::isSendToBackPossible(), FitParameterModel::rowCount(), and SessionModel::rowCount().
SessionItem * SessionItem::parentItem | ( | ) | const |
Returns parent of this item.
Definition at line 67 of file SessionItem.cpp.
References m_parent.
Referenced by DataPropertyContainer::addItem(), GUI::Model::Path::ancestor(), FitComparison1DViewController::deleteDiffViewItem(), FitParameterHelper::getParameterItem(), FitParameterModel::indexOfItem(), SessionModel::indexOfItem(), MaskEditorActions::isSendToBackPossible(), Data1DViewItem::jobItem(), SessionModel::moveItem(), ModelMapper::nestlingDepth(), ModelMapper::onDataChanged(), FitParameterWidget::onFitParametersSelectionChanged(), ProjectionsEditorCanvas::onLeavingColorMap(), FitParameterModel::parent(), SessionModel::parent(), parentRow(), GUI::Session::XML::readItems(), GUI::Session::XML::readProperty(), IntensityDataCanvas::rotateData(), PropertyRepeater::setOnChildPropertyChange(), and GUI::Session::XML::writeItemAndChildItems().
int SessionItem::parentRow | ( | ) |
Returns the index of the given item within its parent. Returns -1 when no parent is set.
Definition at line 148 of file SessionItem.cpp.
References parentItem(), and rowOfChild().
Referenced by FitParameterModel::indexOfItem(), and FitParameterModel::parent().
|
virtual |
Reimplemented in JobItem.
Definition at line 526 of file SessionItem.cpp.
Referenced by GUI::Session::XML::readItems().
bool SessionItem::registerTag | ( | const QString & | name, |
int | min = 0 , |
||
int | max = -1 , |
||
QStringList | modelTypes = {} |
||
) |
Add new tag to this item with given name, min, max and types. max = -1 -> unlimited, modelTypes empty -> all types allowed.
Definition at line 159 of file SessionItem.cpp.
References m_tags, and GUI::RealSpace::Particles::name().
Referenced by Data1DViewItem::Data1DViewItem(), DataPropertyContainer::DataPropertyContainer(), FitParameterContainerItem::FitParameterContainerItem(), FitParameterItem::FitParameterItem(), FitSuiteItem::FitSuiteItem(), GroupItem::GroupItem(), IntensityDataItem::IntensityDataItem(), JobItem::JobItem(), MaskContainerItem::MaskContainerItem(), PolygonItem::PolygonItem(), ProjectionContainerItem::ProjectionContainerItem(), RealDataItem::RealDataItem(), addGroupProperty(), addProperty(), and SessionModel::createRootItem().
QVariant SessionItem::roleProperty | ( | int | role | ) | const |
Returns corresponding variant under given role, invalid variant when role is not present.
Definition at line 334 of file SessionItem.cpp.
References m_properties.
Referenced by GUI::View::PropertyEditorFactory::CreateEditor(), decimals(), defaultTag(), displayName(), flags(), limits(), modelType(), toolTip(), value(), and GUI::Session::XML::writeItemAndChildItems().
int SessionItem::rowOfChild | ( | SessionItem * | child | ) | const |
Returns row index of given child.
Definition at line 109 of file SessionItem.cpp.
Referenced by childDeleted(), SessionModel::indexOfItem(), SessionModel::moveItem(), ProjectionsEditorCanvas::onLeavingColorMap(), and parentRow().
|
virtual |
Reimplemented in PointwiseAxisItem, and RealDataItem.
Definition at line 517 of file SessionItem.cpp.
Referenced by GUI::Session::XML::writeItemAndChildItems().
const SessionItemTags * SessionItem::sessionItemTags | ( | ) | const |
Definition at line 171 of file SessionItem.cpp.
References m_tags.
Referenced by displayName(), SessionModel::insertNewItem(), and SessionModel::moveItem().
SessionItem & SessionItem::setDecimals | ( | int | n | ) |
Definition at line 489 of file SessionItem.cpp.
References SessionFlags::DecimalRole, and setRoleProperty().
Referenced by BasicAxisItem::BasicAxisItem(), and SessionItem().
void SessionItem::setDefaultTag | ( | const QString & | tag | ) |
Set default tag.
Definition at line 397 of file SessionItem.cpp.
References SessionFlags::DefaultTagRole, and setRoleProperty().
Referenced by DataPropertyContainer::DataPropertyContainer(), FitParameterContainerItem::FitParameterContainerItem(), FitParameterItem::FitParameterItem(), GroupItem::GroupItem(), IntensityDataItem::IntensityDataItem(), MaskContainerItem::MaskContainerItem(), PolygonItem::PolygonItem(), ProjectionContainerItem::ProjectionContainerItem(), and RealDataItem::RealDataItem().
void SessionItem::setDisplayName | ( | const QString & | display_name | ) |
Set display name.
Definition at line 426 of file SessionItem.cpp.
References SessionFlags::DisplayNameRole, and setRoleProperty().
Referenced by SessionItem(), addProperty(), FitParameterContainerItem::createFitParameter(), and GUI::Session::XML::readItems().
void SessionItem::setEditable | ( | bool | enabled | ) |
Definition at line 458 of file SessionItem.cpp.
References changeFlags(), and SessionFlags::EDITABLE.
Referenced by JobItem::JobItem(), and FitParameterItem::setLimitEnabled().
void SessionItem::setEnabled | ( | bool | enabled | ) |
Flags accessors.
Definition at line 453 of file SessionItem.cpp.
References changeFlags(), and SessionFlags::ENABLED.
Referenced by FitParameterItem::FitParameterItem(), MaskAllItem::MaskAllItem(), PointwiseAxisItem::PointwiseAxisItem(), GroupItemController::getItemOfType(), and FitParameterItem::setLimitEnabled().
SessionItem * SessionItem::setGroupProperty | ( | const QString & | groupTag, |
const QString & | modelType | ||
) | const |
Set the current type of group item.
Definition at line 320 of file SessionItem.cpp.
References modelType().
Referenced by setGroupPropertyType().
T * SessionItem::setGroupPropertyType | ( | const QString & | groupTag | ) |
Definition at line 404 of file SessionItem.h.
References getGroupItem(), item(), and setGroupProperty().
void SessionItem::setItemName | ( | const QString & | name | ) |
Set item name, add property if necessary.
Definition at line 438 of file SessionItem.cpp.
References addProperty(), isTag(), GUI::RealSpace::Particles::name(), P_NAME, and setItemValue().
Referenced by EllipseItem::EllipseItem(), HorizontalLineItem::HorizontalLineItem(), JobItem::JobItem(), MaskAllItem::MaskAllItem(), PolygonItem::PolygonItem(), PolygonPointItem::PolygonPointItem(), RealDataItem::RealDataItem(), RectangleItem::RectangleItem(), VerticalLineItem::VerticalLineItem(), RealDataItem::setDataName(), MaskGraphicsScene::setItemName(), JobItem::setJobName(), and MaskItem::setMaskName().
void SessionItem::setItemValue | ( | const QString & | tag, |
const QVariant & | variant | ||
) | const |
Directly set value of item under given tag.
Definition at line 300 of file SessionItem.cpp.
References getItem(), isTag(), and setValue().
Referenced by MaskUnitsConverter::convertCoordinate(), PointwiseAxisItem::init(), FitParameterItem::initMinMaxValues(), RealDataItem::linkToInstrument(), EllipseItem::setAngle(), Data1DViewItem::setAxesUnits(), DataItem::setAxesUnits(), JobItem::setBeginTime(), BasicAxisItem::setBinCount(), FitSuiteItem::setChi2(), Data1DProperties::setColorProperty(), JobItem::setComments(), DataProperties::setDataItem(), JobItem::setEndTime(), DataItem::setFileName(), IntensityDataItem::setGradient(), JobItem::setIdentifier(), JobItem::setInstrumentName(), IntensityDataItem::setInterpolated(), PolygonItem::setIsClosed(), MaskItem::setIsVisibleValue(), setItemName(), FitSuiteItem::setIterationCount(), Data1DProperties::setLineProperty(), FitParameterLinkItem::setLink(), AmplitudeAxisItem::setLocked(), AmplitudeAxisItem::setLogScale(), BasicAxisItem::setLowerBound(), MaskItem::setMaskValue(), FitParameterItem::setMaximum(), FitParameterItem::setMinimum(), PolygonPointItem::setPosX(), VerticalLineItem::setPosX(), PolygonPointItem::setPosY(), HorizontalLineItem::setPosY(), JobItem::setPresentationType(), JobItem::setProgress(), Data1DProperties::setScatterProperty(), FitParameterItem::setStartValue(), JobItem::setStatus(), BasicAxisItem::setTitle(), FitParameterLinkItem::setTitle(), FitSuiteItem::setUpdateInterval(), BasicAxisItem::setUpperBound(), BasicAxisItem::setVisibilityValue(), EllipseItem::setXCenter(), RectangleItem::setXLow(), EllipseItem::setXRadius(), RectangleItem::setXUp(), EllipseItem::setYCenter(), RectangleItem::setYLow(), EllipseItem::setYRadius(), RectangleItem::setYUp(), and RealDataItem::unlinkFromInstrument().
SessionItem & SessionItem::setLimits | ( | const RealLimits & | value | ) |
Definition at line 478 of file SessionItem.cpp.
References SessionFlags::LimitsRole, setRoleProperty(), and value().
Referenced by BasicAxisItem::BasicAxisItem(), EllipseItem::EllipseItem(), FitParameterItem::FitParameterItem(), HorizontalLineItem::HorizontalLineItem(), PolygonPointItem::PolygonPointItem(), RectangleItem::RectangleItem(), SessionItem(), VerticalLineItem::VerticalLineItem(), and FitParameterItem::initMinMaxValues().
|
private |
Definition at line 546 of file SessionItem.cpp.
References m_children, m_mapper, m_model, and model().
Referenced by ~SessionItem(), SessionModel::createRootItem(), and setParentAndModel().
|
private |
Definition at line 540 of file SessionItem.cpp.
References m_parent, model(), and setModel().
Referenced by takeItem().
bool SessionItem::setRoleProperty | ( | int | role, |
const QVariant & | value | ||
) |
Set the contained role property to the given value. See also setTranslatorForRolePropertySetter.
Set variant to role, create role if not present yet.
Definition at line 341 of file SessionItem.cpp.
References emitDataChanged(), m_properties, and value().
Referenced by SessionItem(), changeFlags(), GUI::Session::XML::readProperty(), SessionModel::setData(), setDecimals(), setDefaultTag(), setDisplayName(), setLimits(), setToolTip(), and setValue().
SessionItem & SessionItem::setToolTip | ( | const QString & | tooltip | ) |
Definition at line 500 of file SessionItem.cpp.
References setRoleProperty().
Referenced by GeneticMinimizerItem::GeneticMinimizerItem(), GSLLMAMinimizerItem::GSLLMAMinimizerItem(), GSLMultiMinimizerItem::GSLMultiMinimizerItem(), MinimizerContainerItem::MinimizerContainerItem(), MinuitMinimizerItem::MinuitMinimizerItem(), and SimAnMinimizerItem::SimAnMinimizerItem().
bool SessionItem::setValue | ( | QVariant | value | ) |
Set value, ensure that variant types match.
Definition at line 382 of file SessionItem.cpp.
References GUI::Util::Variant::CompatibleVariantTypes(), setRoleProperty(), and value().
Referenced by DoubleDescriptor::DoubleDescriptor(), SelectionDescriptor< T >::SelectionDescriptor(), UIntDescriptor::UIntDescriptor(), IntensityDataPropertyWidget::createCheckBox(), SpecularDataPropertyWidget::createCheckBox(), IntensityDataPropertyWidget::createTextEdit(), SpecularDataPropertyWidget::createTextEdit(), setItemValue(), RealDataItem::setNativeDataUnits(), and GroupItem::updateComboValue().
QString SessionItem::tagFromItem | ( | const SessionItem * | item | ) | const |
Returns the tag name of given item when existing.
Definition at line 178 of file SessionItem.cpp.
References index(), item(), m_children, and m_tags.
Referenced by displayName(), ModelMapper::onDataChanged(), PropertyRepeater::setOnChildPropertyChange(), takeRow(), and GUI::Session::XML::writeItemAndChildItems().
SessionItem * SessionItem::takeItem | ( | int | row, |
const QString & | tag | ||
) |
Remove item from given row from given tag.
Definition at line 258 of file SessionItem.cpp.
References defaultTag(), index(), m_children, m_model, m_tags, and setParentAndModel().
Referenced by SessionModel::moveItem(), and takeRow().
SessionItem * SessionItem::takeRow | ( | int | row | ) |
Removes row from item and returns the item.
Definition at line 139 of file SessionItem.cpp.
References childAt(), getItems(), item(), items(), tagFromItem(), and takeItem().
Referenced by FitComparison1DViewController::deleteDiffViewItem(), SessionModel::moveItem(), ProjectionsEditorCanvas::onLeavingColorMap(), and SessionModel::removeRows().
QString SessionItem::toolTip | ( | ) | const |
Definition at line 495 of file SessionItem.cpp.
References roleProperty().
Referenced by SelectionDescriptor< T >::SelectionDescriptor().
QVariant SessionItem::value | ( | ) | const |
Get value.
Definition at line 375 of file SessionItem.cpp.
References roleProperty().
Referenced by SelectionDescriptor< T >::SelectionDescriptor(), IntensityDataPropertyWidget::createCheckBox(), SpecularDataPropertyWidget::createCheckBox(), GUI::View::PropertyEditorFactory::CreateEditor(), IntensityDataPropertyWidget::createTextEdit(), SpecularDataPropertyWidget::createTextEdit(), SessionModel::data(), SessionModel::flags(), getItemValue(), FitParameterItem::initMinMaxValues(), FitParameterItem::isValid(), GroupItem::onValueChange(), BasicAxisItem::setBinCount(), setLimits(), AmplitudeAxisItem::setLogScale(), BasicAxisItem::setLowerBound(), Data1DViewItem::setLowerX(), IntensityDataItem::setLowerX(), SpecularDataItem::setLowerX(), Data1DViewItem::setLowerY(), IntensityDataItem::setLowerY(), SpecularDataItem::setLowerY(), setRoleProperty(), BasicAxisItem::setUpperBound(), Data1DViewItem::setUpperX(), IntensityDataItem::setUpperX(), SpecularDataItem::setUpperX(), Data1DViewItem::setUpperY(), IntensityDataItem::setUpperY(), SpecularDataItem::setUpperY(), setValue(), BasicAxisItem::visibilityValue(), and GUI::Session::XML::writeItemAndChildItems().
|
virtual |
Reimplemented in JobItem.
Definition at line 524 of file SessionItem.cpp.
Referenced by GUI::Session::XML::writeItemAndChildItems().
|
friend |
Definition at line 205 of file SessionItem.h.
|
private |
Definition at line 332 of file SessionItem.h.
Referenced by ~SessionItem(), childAt(), childDeleted(), children(), childrenOfType(), firstChildOfType(), getChildOfType(), getCopyNumberOfChild(), getItem(), getItems(), insertChild(), numberOfChildren(), setModel(), tagFromItem(), and takeItem().
|
private |
Definition at line 335 of file SessionItem.h.
Referenced by ~SessionItem(), mapper(), and setModel().
|
private |
Definition at line 331 of file SessionItem.h.
Referenced by ~SessionItem(), emitDataChanged(), insertChild(), model(), setModel(), and takeItem().
|
private |
Definition at line 330 of file SessionItem.h.
Referenced by ~SessionItem(), displayName(), parentItem(), and setParentAndModel().
|
private |
Definition at line 333 of file SessionItem.h.
Referenced by getRoles(), roleProperty(), and setRoleProperty().
|
private |
Definition at line 334 of file SessionItem.h.
Referenced by acceptableDefaultItemTypes(), acceptsAsDefaultItem(), getItem(), getItems(), insertChild(), isTag(), registerTag(), sessionItemTags(), tagFromItem(), and takeItem().
|
staticconstexprprivate |
Definition at line 208 of file SessionItem.h.
Referenced by getCopyNumberOfChild(), isItemNamePropertyName(), itemName(), and setItemName().