BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
SampleListView.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/SampleDesigner/SampleListView.h
6 //! @brief Defines class SampleListView
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2021
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SAMPLELISTVIEW_H
16 #define BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SAMPLELISTVIEW_H
17 
18 #include <QListView>
19 
20 class SampleListModel;
21 class MultiLayerItem;
22 class ProjectDocument;
23 
24 //! List view to select one sample (left side of layer-oriented sample editor)
25 class SampleListView : public QListView {
26  Q_OBJECT
27 public:
28  SampleListView(QWidget* parent, ProjectDocument* document);
29 
30  void setCurrentSample(MultiLayerItem* sample);
32 
33  //! Select first sample, if any sample exists
34  void selectFirstSample();
35 
36  QAction* newSampleAction();
37  QAction* importSampleAction();
38  QAction* chooseFromLibraryAction();
39 
40  QSize sizeHint() const override;
41 
42 signals:
44 
45 public slots:
46  void onSampleModified();
47 
48 private:
49  void createNewSample();
50  void createSampleFromLibrary(const QString& classname, const QString& title,
51  const QString& description);
53  QList<QAction*> getOverlayActions(const QModelIndex& index, bool asHover);
54  void onCurrentChanged(const QModelIndex& index);
55  void removeSample(MultiLayerItem* item);
56 
57  QAction* createRemoveAction(QObject* parent, MultiLayerItem* item);
58 
59  void showContextMenu(const QPoint& pos);
60 
61 private:
67 };
68 
69 #endif // BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SAMPLELISTVIEW_H
Project document class handles all data related to the opened project (sample, job,...
List model for sample selection (used in the left pane of the layer oriented sample editor)
List view to select one sample (left side of layer-oriented sample editor)
MultiLayerItem * currentSample()
QAction * m_chooseFromLibraryAction
QAction * chooseFromLibraryAction()
ProjectDocument * m_document
QSize sizeHint() const override
SampleListModel * m_model
QList< QAction * > getOverlayActions(const QModelIndex &index, bool asHover)
void setCurrentSample(MultiLayerItem *sample)
QAction * createRemoveAction(QObject *parent, MultiLayerItem *item)
QAction * importSampleAction()
void currentSampleChanged(MultiLayerItem *current)
void selectFirstSample()
Select first sample, if any sample exists.
QAction * newSampleAction()
void onCurrentChanged(const QModelIndex &index)
void showContextMenu(const QPoint &pos)
QAction * m_newSampleAction
void createSampleFromLibrary(const QString &classname, const QString &title, const QString &description)
void importSampleFromPython()
QAction * m_importSampleAction
void removeSample(MultiLayerItem *item)
SampleListView(QWidget *parent, ProjectDocument *document)