BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Classes | |
struct | SessionModelImpl |
Pimpl class for SessionModel. More... | |
Signals | |
void | modelLoaded () |
Public Member Functions | |
SessionModel (QString model_tag, QObject *parent=0) | |
virtual | ~SessionModel () |
QVector< QString > | acceptableDefaultItemTypes (const QModelIndex &parent) const |
virtual bool | canDropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const |
virtual void | clear () |
virtual int | columnCount (const QModelIndex &parent) const |
template<typename T > | |
T * | copyItem (const T *item_to_copy, SessionItem *new_parent=0, const QString &tag="") |
virtual SessionModel * | createCopy (SessionItem *parent=0) |
void | createRootItem () |
virtual QVariant | data (const QModelIndex &index, int role) const |
virtual bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) |
virtual Qt::ItemFlags | flags (const QModelIndex &index) const |
QString | getModelName () const |
QString | getModelTag () const |
virtual QVariant | headerData (int section, Qt::Orientation orientation, int role) const |
virtual QModelIndex | index (int row, int column, const QModelIndex &parent) const |
QModelIndex | indexOfItem (SessionItem *item) const |
virtual void | initFrom (SessionModel *model, SessionItem *parent) |
template<typename T > | |
T * | insertItem (const QModelIndex &parent, int row=-1, QString tag="") |
template<typename T > | |
T * | insertItem (SessionItem *parent=nullptr, int row=-1, QString tag="") |
SessionItem * | insertNewItem (QString model_type, const QModelIndex &parent_item, int row=-1, QString tag="") |
SessionItem * | insertNewItem (QString model_type, SessionItem *parent_item=nullptr, int row=-1, QString tag="") |
SessionItem * | itemForIndex (const QModelIndex &index) const |
void | load (const QString &filename="") |
virtual QMimeData * | mimeData (const QModelIndexList &indexes) const |
virtual QStringList | mimeTypes () const |
SessionItem * | moveItem (SessionItem *item, SessionItem *new_parent=0, int row=-1, const QString &tag="") |
Move given parameterized item to the new_parent at given row. More... | |
virtual QVector< SessionItem * > | nonXMLItems () const |
virtual QModelIndex | parent (const QModelIndex &child) const |
virtual void | readFrom (QXmlStreamReader *reader, MessageService *messageService=0) |
void | removeItem (SessionItem *item) |
virtual bool | removeRows (int row, int count, const QModelIndex &parent) |
SessionItem * | rootItem () const |
virtual int | rowCount (const QModelIndex &parent) const |
void | save (const QString &filename="") |
virtual bool | setData (const QModelIndex &index, const QVariant &value, int role) |
void | setDraggedItemType (const QString &type) |
virtual bool | setHeaderData (int, Qt::Orientation, const QVariant &, int=Qt::EditRole) |
virtual Qt::DropActions | supportedDragActions () const |
virtual Qt::DropActions | supportedDropActions () const |
template<typename T = SessionItem> | |
T * | topItem () const |
Returns first item in list of topItems. More... | |
template<typename T = SessionItem> | |
QVector< T * > | topItems () const |
template<typename T = SessionItem> | |
QVector< T * > | topItems (std::function< bool(const T &)> accept) const |
virtual void | writeTo (QXmlStreamWriter *writer, SessionItem *parent=0) |
Protected Member Functions | |
void | setRootItem (SessionItem *root) |
Private Member Functions | |
SessionItem * | copy (const SessionItem *item_to_copy, SessionItem *new_parent=0, const QString &tag="") |
Copy given item to the new_parent at given row. More... | |
Private Attributes | |
QString | m_dragged_item_type |
QString | m_model_tag |
model tag (SampleModel, InstrumentModel) More... | |
QString | m_name |
model name More... | |
SessionItem * | m_root_item |
Friends | |
class | SessionItem |
Definition at line 23 of file SessionModel.h.
|
explicit |
Definition at line 30 of file SessionModel.cpp.
References createRootItem().
|
virtual |
Definition at line 44 of file SessionModel.cpp.
References m_root_item.
QVector< QString > SessionModel::acceptableDefaultItemTypes | ( | const QModelIndex & | parent | ) | const |
Definition at line 299 of file SessionModel.cpp.
References itemForIndex(), and parent().
Referenced by canDropMimeData(), flags(), and SampleTreeWidget::showContextMenu().
|
virtual |
Definition at line 199 of file SessionModel.cpp.
References acceptableDefaultItemTypes(), data(), SessionXML::ItemMimeType, SessionXML::ItemTag(), SessionXML::ModelTypeAttribute(), and parent().
Referenced by dropMimeData().
|
virtual |
Reimplemented in JobModel.
Definition at line 308 of file SessionModel.cpp.
References createRootItem(), and m_root_item.
Referenced by JobModel::clear(), DetectorMaskDelegate::createIntensityDataItem(), load(), MaterialEditorDialog::onOKButton(), readFrom(), and ApplicationModels::resetModels().
|
virtual |
Definition at line 119 of file SessionModel.cpp.
References SessionFlags::MAX_COLUMNS, and parent().
Referenced by data(), and index().
|
private |
Copy given item to the new_parent at given row.
Item intended for copying can belong to another model and it will remain intact. Returns pointer to the new child.
Definition at line 419 of file SessionModel.cpp.
References SessionItem::defaultTag(), SessionItem::getItems(), m_root_item, SessionXML::readItems(), and SessionXML::writeItemAndChildItems().
Referenced by copyItem().
T * SessionModel::copyItem | ( | const T * | item_to_copy, |
SessionItem * | new_parent = 0 , |
||
const QString & | tag = "" |
||
) |
Definition at line 136 of file SessionModel.h.
References copy().
Referenced by JobModel::addJob(), MaterialModel::cloneMaterial(), JobModelFunctions::copyRealDataItem(), DetectorItem::importMasks(), MaterialItemContainer::insertCopy(), InstrumentViewActions::onCloneInstrument(), JobModelFunctions::setupJobItemInstrument(), and JobModelFunctions::setupJobItemSampleData().
|
virtual |
Reimplemented in InstrumentModel, SampleModel, and MaterialModel.
Definition at line 437 of file SessionModel.cpp.
References parent().
void SessionModel::createRootItem | ( | ) |
Definition at line 36 of file SessionModel.cpp.
References ItemFactory::CreateEmptyItem(), m_root_item, SessionItem::registerTag(), SessionItem::setDefaultTag(), and SessionItem::setModel().
Referenced by SessionModel(), and clear().
|
virtual |
Definition at line 70 of file SessionModel.cpp.
References columnCount(), index(), SessionFlags::ITEM_NAME, SessionFlags::ITEM_VALUE, itemForIndex(), m_root_item, and SessionItemUtils::ToolTipRole().
Referenced by canDropMimeData(), RealDataTreeModel::data(), dropMimeData(), gui2::JobModel::updateSLDProfile(), and gui2::JobModel::updateSpecularData().
|
virtual |
Definition at line 227 of file SessionModel.cpp.
References canDropMimeData(), data(), itemForIndex(), SessionXML::ItemMimeType, and parent().
|
virtual |
Definition at line 51 of file SessionModel.cpp.
References acceptableDefaultItemTypes(), index(), SessionItem::isEditable(), SessionItem::isEnabled(), SessionFlags::ITEM_VALUE, itemForIndex(), m_dragged_item_type, and SessionItem::value().
Referenced by RealDataTreeModel::flags().
|
inline |
Definition at line 196 of file SessionModel.h.
References m_name.
Referenced by SessionXML::writeTo().
|
inline |
Definition at line 191 of file SessionModel.h.
References m_model_tag.
Referenced by ModelTreeView::ModelTreeView(), SessionXML::readItems(), and SessionXML::writeTo().
|
virtual |
Definition at line 98 of file SessionModel.cpp.
References SessionFlags::ITEM_NAME, and SessionFlags::ITEM_VALUE.
|
virtual |
Definition at line 126 of file SessionModel.cpp.
References SessionItem::childAt(), columnCount(), itemForIndex(), m_root_item, and parent().
Referenced by SampleViewAligner::alignSample(), JobModel::cancelJob(), MaterialModel::cloneMaterial(), MaskResultsPresenter::createMaskPresentation(), data(), MaskGraphicsScene::deleteViews(), DesignerScene::deleteViews(), flags(), JobModel::generateJobName(), SampleTreeWidget::getIndexAtColumnZero(), JobModel::getJobItemForIdentifier(), JobModel::getJobItemForIndex(), MaterialEditor::init_views(), ModelPath::isValidItem(), itemForIndex(), MaterialModel::materialFromIndex(), ModelMapper::onBeginRemoveRows(), MaterialPropertyController::onMaterialRowsAboutToBeRemoved(), ModelMapper::onRowRemoved(), MaskGraphicsScene::onRowsAboutToBeRemoved(), RealSpaceCanvas::onRowsAboutToBeRemoved(), DesignerScene::onRowsAboutToBeRemoved(), ItemStackWidget::onRowsAboutToBeRemoved(), ModelMapper::onRowsInserted(), removeItem(), JobModel::removeJob(), JobModel::runJob(), ItemSelectorWidget::selectLast(), setData(), MaskGraphicsScene::setItemName(), MaskGraphicsScene::setZValues(), ItemSelectorWidget::showEvent(), topItems(), JobQueueData::updateGlobalProgress(), InstrumentViewActions::updateSelection(), SampleViewAligner::updateViews(), MaskGraphicsScene::updateViews(), and DesignerScene::updateViews().
QModelIndex SessionModel::indexOfItem | ( | SessionItem * | item | ) | const |
Definition at line 251 of file SessionModel.cpp.
References m_root_item, SessionItem::parent(), and SessionItem::rowOfChild().
Referenced by SampleTreeWidget::addItem(), SampleViewAligner::alignSample(), MaskGraphicsScene::cancelCurrentDrawing(), MaskEditorActions::changeMaskStackingOrder(), RealDataTreeModel::data(), SessionItem::emitDataChanged(), RealDataTreeModel::flags(), SessionItem::index(), DetectorMaskDelegate::initMaskEditorContext(), MaskGraphicsScene::onSceneSelectionChanged(), DesignerScene::onSceneSelectionChanged(), MaskGraphicsScene::onSessionSelectionChanged(), DesignerScene::onSessionSelectionChanged(), MaskGraphicsScene::processLineItem(), MaskGraphicsScene::processPolygonItem(), removeItem(), and MaterialEditor::setInitialMaterialProperty().
|
virtual |
Definition at line 443 of file SessionModel.cpp.
References modelLoaded(), readFrom(), and writeTo().
Referenced by MaterialModel::createCopy(), SampleModel::createCopy(), InstrumentModel::createCopy(), and MaterialEditorDialog::onOKButton().
T * SessionModel::insertItem | ( | const QModelIndex & | parent, |
int | row = -1 , |
||
QString | tag = "" |
||
) |
Definition at line 130 of file SessionModel.h.
References itemForIndex(), and parent().
T * SessionModel::insertItem | ( | SessionItem * | parent = nullptr , |
int | row = -1 , |
||
QString | tag = "" |
||
) |
Definition at line 125 of file SessionModel.h.
References insertNewItem(), SessionItem::modelType(), and parent().
Referenced by IntensityDataFFTPresenter::IntensityDataFFTPresenter(), FitComparison1DViewController::createDiffViewItem(), FitParameterHelper::createFitParameter(), DetectorMaskDelegate::createIntensityDataItem(), DetectorItem::createMaskContainer(), ParameterTreeUtils::createParameterTree(), DesignerScene::dropEvent(), TestComponentView::init_source(), InstrumentViewActions::initAddInstrumentMenu(), RealDataItem::initDataItem(), JobModelFunctions::initDataView(), TestComponentView::onAddItemRequest(), ProjectionsEditorCanvas::onEnteringColorMap(), ParameterTreeUtils::parameterDictionary(), ParameterTreeUtils::parameterNameToLinkedItem(), GUIObjectBuilder::populateDocumentModel(), ParameterTreeUtils::populateParameterContainer(), MaskGraphicsScene::processHorizontalLineItem(), MaskGraphicsScene::processMaskAllItem(), MaskGraphicsScene::processPolygonItem(), MaskGraphicsScene::processVerticalLineItem(), ApplicationModels::resetModels(), JobModelFunctions::setupJobItemOutput(), JobModelFunctions::setupJobItemSampleData(), TestView::test_MinimizerSettings(), TestView::test_specular_data_widget(), and GUIDomainSampleVisitor::visit().
SessionItem * SessionModel::insertNewItem | ( | QString | model_type, |
const QModelIndex & | parent_item, | ||
int | row = -1 , |
||
QString | tag = "" |
||
) |
Definition at line 286 of file SessionModel.cpp.
References insertNewItem(), and itemForIndex().
SessionItem * SessionModel::insertNewItem | ( | QString | model_type, |
SessionItem * | parent_item = nullptr , |
||
int | row = -1 , |
||
QString | tag = "" |
||
) |
Definition at line 260 of file SessionModel.cpp.
References ItemFactory::CreateItem(), SessionItem::defaultTag(), SessionItem::insertItem(), SessionItemTags::isValid(), m_root_item, SessionItem::numberOfChildren(), and SessionItem::sessionItemTags().
Referenced by SampleTreeWidget::addItem(), FitParameterHelper::addToFitParameter(), DesignerScene::dropEvent(), MultiLayerView::dropEvent(), GUIDomainSampleVisitor::InsertIParticle(), insertItem(), insertNewItem(), RealDataMaskWidget::maskContainer(), InstrumentViewActions::onCloneInstrument(), MaskGraphicsScene::processRectangleShapeItem(), and IntensityDataProjectionsWidget::projectionContainer().
SessionItem * SessionModel::itemForIndex | ( | const QModelIndex & | index | ) | const |
Definition at line 347 of file SessionModel.cpp.
References index(), and m_root_item.
Referenced by acceptableDefaultItemTypes(), MaskEditorActions::changeMaskStackingOrder(), SessionDecorationModel::createIcon(), MaskResultsPresenter::createMaskPresentation(), data(), DataProperties::dataItem(), DesignerScene::deleteSelectedItems(), MaskGraphicsScene::deleteViews(), DesignerScene::deleteViews(), dropMimeData(), flags(), JobModel::generateJobName(), ModelPath::getItemFromPath(), JobModel::getJobItemForIndex(), ParameterTuningModel::getParameterItem(), SampleViewAligner::getViewForIndex(), index(), insertItem(), insertNewItem(), MaskEditorActions::isSendToBackPossible(), ModelPath::isValidItem(), ParameterItem::linkedItem(), MaterialModel::materialFromIndex(), mimeData(), ModelMapper::onBeginRemoveRows(), InstrumentViewActions::onCloneInstrument(), PySampleWidget::onDataChanged(), RealSpaceCanvas::onDataChanged(), ComponentFlatView::onDataChanged(), ModelMapper::onDataChanged(), MaterialPropertyController::onMaterialDataChanged(), MaterialPropertyController::onMaterialRowsAboutToBeRemoved(), ModelMapper::onRowRemoved(), ItemStackWidget::onRowsAboutToBeRemoved(), ModelMapper::onRowsInserted(), ItemSelectorWidget::onSelectionChanged(), MaskEditorPropertyPanel::onSelectionChanged(), MaterialEditor::onSelectionChanged(), TestComponentView::onSelectionChanged(), FitParameterProxyModel::onSourceDataChanged(), MaskEditorActions::onToggleMaskValueAction(), parent(), ComponentProxyStrategy::processSourceIndex(), MaterialPropertyController::relatedSampleItems(), removeRows(), rowCount(), setData(), MaskGraphicsScene::setItemName(), MaskEditor::setMaskContext(), MaskGraphicsScene::setMaskContext(), MaskEditorPropertyPanel::setPanelHidden(), MaskGraphicsScene::setZValues(), ComponentProxyModel::sourceDataChanged(), SessionDecorationModel::textColor(), topItems(), MaskGraphicsScene::updateScene(), RealSpaceCanvas::updateScene(), MaskGraphicsScene::updateViews(), and DesignerScene::updateViews().
void SessionModel::load | ( | const QString & | filename = "" | ) |
Definition at line 316 of file SessionModel.cpp.
References clear(), ItemFactory::CreateEmptyItem(), FileSystemUtils::filename(), m_root_item, and SessionXML::readItems().
|
virtual |
Definition at line 183 of file SessionModel.cpp.
References itemForIndex(), SessionXML::ItemMimeType, and SessionXML::writeItemAndChildItems().
|
virtual |
Definition at line 178 of file SessionModel.cpp.
References SessionXML::ItemMimeType.
|
signal |
Referenced by initFrom(), and MaterialPropertyController::setModels().
SessionItem * SessionModel::moveItem | ( | SessionItem * | item, |
SessionItem * | new_parent = 0 , |
||
int | row = -1 , |
||
const QString & | tag = "" |
||
) |
Move given parameterized item to the new_parent at given row.
If new_parent is not defined, use root_item as a new parent.
Definition at line 384 of file SessionModel.cpp.
References SessionItem::defaultTag(), SessionItem::getItems(), SessionItem::insertItem(), SessionItemTags::isValid(), m_root_item, SessionItemTags::maximumReached(), SessionItem::modelType(), SessionItem::parent(), SessionItem::rowOfChild(), SessionItem::sessionItemTags(), SessionItem::takeItem(), and SessionItem::takeRow().
Referenced by MaskEditorActions::changeMaskStackingOrder(), ILayerView::mouseReleaseEvent(), DesignerScene::onEstablishedConnection(), and DesignerScene::removeConnection().
|
virtual |
Reimplemented in RealDataModel, JobModel, and InstrumentModel.
Definition at line 466 of file SessionModel.cpp.
|
virtual |
Definition at line 139 of file SessionModel.cpp.
References itemForIndex(), m_root_item, SessionItem::parent(), and SessionItemUtils::ParentRow().
Referenced by acceptableDefaultItemTypes(), canDropMimeData(), columnCount(), createCopy(), MaterialModel::createCopy(), SampleModel::createCopy(), InstrumentModel::createCopy(), SampleTreeWidget::deleteItem(), dropMimeData(), SampleTreeWidget::getIndexAtColumnZero(), index(), insertItem(), InstrumentModel::onRowsChange(), RealDataModel::onRowsChange(), removeRows(), rowCount(), and writeTo().
|
virtual |
Reimplemented in RealDataModel, JobModel, and InstrumentModel.
Definition at line 356 of file SessionModel.cpp.
References ASSERT, clear(), m_model_tag, m_name, m_root_item, SessionXML::ModelNameAttribute(), and SessionXML::readItems().
Referenced by initFrom(), InstrumentModel::readFrom(), JobModel::readFrom(), and RealDataModel::readFrom().
void SessionModel::removeItem | ( | SessionItem * | item | ) |
Definition at line 292 of file SessionModel.cpp.
References index(), indexOfItem(), and removeRows().
Referenced by RealDataTreeModel::removeItem().
|
virtual |
Definition at line 168 of file SessionModel.cpp.
References itemForIndex(), m_root_item, parent(), and SessionItem::takeRow().
Referenced by MaskGraphicsScene::cancelCurrentDrawing(), SampleTreeWidget::deleteItem(), DesignerScene::deleteSelectedItems(), ProjectionsEditorActions::onDeleteAction(), MaskEditorActions::onDeleteMaskAction(), InstrumentViewActions::onRemoveInstrument(), MaterialEditorToolBar::onRemoveMaterialAction(), removeItem(), and JobModel::removeJob().
SessionItem * SessionModel::rootItem | ( | ) | const |
Definition at line 461 of file SessionModel.cpp.
References m_root_item.
Referenced by ModelPath::getIndexFromPath(), and ModelMapper::nestlingDepth().
|
virtual |
Definition at line 111 of file SessionModel.cpp.
References itemForIndex(), SessionItem::numberOfChildren(), and parent().
Referenced by SampleViewAligner::alignSample(), MaskResultsPresenter::createMaskPresentation(), MaskGraphicsScene::deleteViews(), DesignerScene::deleteViews(), JobModel::generateJobName(), JobModel::getJobItemForIdentifier(), ModelPath::isValidItem(), ItemSelectorWidget::selectLast(), MaskGraphicsScene::setItemName(), MaskGraphicsScene::setZValues(), ItemSelectorWidget::showEvent(), topItems(), JobQueueData::updateGlobalProgress(), InstrumentViewActions::updateSelection(), SampleViewAligner::updateViews(), MaskGraphicsScene::updateViews(), and DesignerScene::updateViews().
void SessionModel::save | ( | const QString & | filename = "" | ) |
Definition at line 331 of file SessionModel.cpp.
References FileSystemUtils::filename(), GUIHelpers::getBornAgainVersionString(), m_root_item, and SessionXML::writeItemAndChildItems().
|
virtual |
Definition at line 155 of file SessionModel.cpp.
References index(), and itemForIndex().
|
inline |
Definition at line 201 of file SessionModel.h.
References m_dragged_item_type.
Referenced by ItemTreeView::dragMoveEvent().
|
inlinevirtual |
Definition at line 176 of file SessionModel.h.
|
inlineprotected |
|
inlinevirtual |
Definition at line 181 of file SessionModel.h.
|
inlinevirtual |
Definition at line 186 of file SessionModel.h.
T * SessionModel::topItem |
Returns first item in list of topItems.
Definition at line 141 of file SessionModel.h.
QVector< T * > SessionModel::topItems |
Definition at line 147 of file SessionModel.h.
References index(), SessionItem::item(), itemForIndex(), and rowCount().
Referenced by JobModel::clear(), MaterialItemUtils::defaultMaterialProperty(), PySampleWidget::generateCodeSnippet(), SimulationDataSelectorWidget::selectedInstrumentItem(), SimulationDataSelectorWidget::selectedMultiLayerItem(), and ModelUtils::topItemNames().
QVector< T * > SessionModel::topItems | ( | std::function< bool(const T &)> | accept | ) | const |
Definition at line 161 of file SessionModel.h.
References index(), SessionItem::item(), itemForIndex(), and rowCount().
|
virtual |
Definition at line 374 of file SessionModel.cpp.
References m_root_item, parent(), and SessionXML::writeTo().
Referenced by initFrom().
|
friend |
Definition at line 25 of file SessionModel.h.
|
private |
Definition at line 120 of file SessionModel.h.
Referenced by flags(), and setDraggedItemType().
|
private |
model tag (SampleModel, InstrumentModel)
Definition at line 122 of file SessionModel.h.
Referenced by getModelTag(), and readFrom().
|
private |
model name
Definition at line 121 of file SessionModel.h.
Referenced by getModelName(), and readFrom().
|
private |
Definition at line 119 of file SessionModel.h.
Referenced by ~SessionModel(), clear(), copy(), createRootItem(), data(), index(), indexOfItem(), insertNewItem(), itemForIndex(), load(), moveItem(), parent(), readFrom(), removeRows(), rootItem(), save(), setRootItem(), and writeTo().