15 #ifndef BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SAMPLELISTMODEL_H
16 #define BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_SAMPLELISTMODEL_H
18 #include <QAbstractItemModel>
28 int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
29 QVariant
data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const override;
30 Qt::ItemFlags
flags(
const QModelIndex& index)
const override;
31 bool setData(
const QModelIndex& index,
const QVariant& value,
int role)
override;
46 const QString& description);
48 #ifdef BORNAGAIN_PYTHON
Main model to hold sample items.
List model for sample selection (used in the left pane of the layer oriented sample editor)
QModelIndex createSample()
Create a new sample (sample) and return the index of it.
Qt::ItemFlags flags(const QModelIndex &index) const override
SampleListModel(QObject *parent, MultiLayerItems *model)
QModelIndex createSampleFromPython()
Create sample from an imported python code.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
void removeSample(MultiLayerItem *item)
Remove the given sample. nullptr is allowed.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
MultiLayerItem * itemForIndex(const QModelIndex &index) const
bool setData(const QModelIndex &index, const QVariant &value, int role) override
MultiLayerItems * m_sampleItems
QModelIndex createSampleFromExamples(const QString &className, const QString &title, const QString &description)
Create sample from list of built-in examples.
QModelIndex indexForItem(MultiLayerItem *item) const