BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
SessionModelView Class Reference

Description

The SessionModelView is a technical view which shows the content all current application models. It appears as an additional view in the main navigation bar on the left, right after the jobView (if corresponding setting of MainWindow is On).

Definition at line 26 of file SessionModelView.h.

Inheritance diagram for SessionModelView:
[legend]
Collaboration diagram for SessionModelView:
[legend]

Public Member Functions

 SessionModelView (QWidget *parent, ProjectDocument *document)
 

Constructor & Destructor Documentation

◆ SessionModelView()

SessionModelView::SessionModelView ( QWidget *  parent,
ProjectDocument document 
)

Definition at line 68 of file SessionModelView.cpp.

69  : QWidget(parent)
70 {
71  auto* layout = new QVBoxLayout(this);
72  layout->setMargin(0);
73 
74  auto* tabs = new QTabWidget(this);
75  auto* m_expandButton = new QToolButton(this);
76  m_expandButton->setText("Expand tree");
77  m_expandButton->setIcon(QIcon(":/images/toolbar_expand_collapse_tree.svg"));
78  m_expandButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
79  connect(m_expandButton, &QToolButton::clicked, [=]() {
80  auto* tree = static_cast<QTreeView*>(tabs->widget(tabs->currentIndex()));
81  tree->expandAll();
82  tree->resizeColumnToContents(0);
83  tree->resizeColumnToContents(1);
84  });
85 
86  auto* m_collapseButton = new QToolButton(this);
87  m_collapseButton->setText("Collapse tree");
88  m_collapseButton->setIcon(QIcon(":/images/toolbar_expand_collapse_tree.svg"));
89  m_collapseButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
90  connect(m_collapseButton, &QToolButton::clicked, [=]() {
91  auto* tree = static_cast<QTreeView*>(tabs->widget(tabs->currentIndex()));
92  tree->collapseAll();
93  });
94 
95  auto* toolbar = new QToolBar;
96  toolbar->addWidget(m_expandButton);
97  toolbar->addWidget(m_collapseButton);
98  layout->addWidget(toolbar);
99  layout->addWidget(tabs);
100 
101  QList<SessionModel*> models{document->realDataModel(), document->jobModel()};
102 
103  for (auto* model : models) {
104  auto* treeView = new QTreeView(this);
106  treeView->setItemDelegate(new SessionModelDelegate(this));
107  treeView->setModel(new SessionDecorationModel(treeView, model));
108  treeView->setEditTriggers(QAbstractItemView::NoEditTriggers); // read-only!
109  tabs->addTab(treeView, model->getModelTag());
110  }
111 }
JobModel * jobModel() const
RealDataModel * realDataModel() const
Provides decorations (text color, icons, etc) for SessionModel in SessionModelView context....
void setPropertyStyle(QTreeView *tree)
Sets style for the tree to use in property editors.
Definition: StyleUtils.cpp:49

References ProjectDocument::jobModel(), ProjectDocument::realDataModel(), and GUI::Util::Style::setPropertyStyle().

Here is the call graph for this function:

The documentation for this class was generated from the following files: