BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Tree model for instrument item selection. Used e.g. for the instrument library.
Definition at line 25 of file InstrumentsTreeModel.h.
Public Types | |
enum | InstrumentType { None = 0x0 , Gisas = 0x1 , Offspec = 0x2 , Specular = 0x4 , DepthProbe = 0x8 , All = Gisas | Offspec | Specular | DepthProbe } |
Public Member Functions | |
InstrumentsTreeModel (QObject *parent, InstrumentCollection *model) | |
int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
void | enableEmptyHeadlines (bool b) |
Qt::ItemFlags | flags (const QModelIndex &index) const override |
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
QModelIndex | indexForItem (InstrumentItem *item) const |
QModelIndex | indexOfHeadline (InstrumentType type) const |
bool | isHeadline (const QModelIndex &index) const |
InstrumentItem * | itemForIndex (const QModelIndex &index) const |
QModelIndex | parent (const QModelIndex &index) const override |
void | refreshAfterModelChange () |
void | removeItem (InstrumentItem *item) |
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
bool | setData (const QModelIndex &index, const QVariant &value, int role) override |
void | setTypeEnabled (InstrumentType type, bool b) |
InstrumentItem * | topMostItem () const |
The topmost visible item. Can be null of course. More... | |
Static Public Member Functions | |
static InstrumentType | instrumentType (InstrumentItem *item) |
Private Member Functions | |
void | clear () |
QVector< InstrumentItem * > | instruments (InstrumentType type) const |
QList< InstrumentType > | visibleTypes () const |
Private Attributes | |
bool | m_enableEmptyHeadlines |
InstrumentCollection * | m_model = nullptr |
bool | m_namesAreEditable |
VisibleInstrumentTypes | m_visibleTypes |
Enumerator | |
---|---|
None | |
Gisas | |
Offspec | |
Specular | |
DepthProbe | |
All |
Definition at line 29 of file InstrumentsTreeModel.h.
InstrumentsTreeModel::InstrumentsTreeModel | ( | QObject * | parent, |
InstrumentCollection * | model | ||
) |
Definition at line 23 of file InstrumentsTreeModel.cpp.
|
private |
Definition at line 63 of file InstrumentsTreeModel.cpp.
|
override |
Definition at line 163 of file InstrumentsTreeModel.cpp.
|
override |
Definition at line 181 of file InstrumentsTreeModel.cpp.
References appSettings, DepthProbe, Gisas, ApplicationSettings::Palette::headlineBackground, ApplicationSettings::Palette::headlineText, index(), indexOfHeadline(), instrumentType(), isHeadline(), itemForIndex(), Offspec, Specular, and ApplicationSettings::styleSheetPalette().
Referenced by InstrumentLibraryEditor::TreeModel::data().
void InstrumentsTreeModel::enableEmptyHeadlines | ( | bool | b | ) |
Definition at line 32 of file InstrumentsTreeModel.cpp.
References m_enableEmptyHeadlines.
Referenced by InstrumentLibraryEditor::InstrumentLibraryEditor().
|
override |
Definition at line 258 of file InstrumentsTreeModel.cpp.
References index(), isHeadline(), and m_namesAreEditable.
|
override |
Definition at line 132 of file InstrumentsTreeModel.cpp.
References indexOfHeadline(), instruments(), parent(), and visibleTypes().
Referenced by data(), flags(), isHeadline(), itemForIndex(), parent(), removeItem(), and setData().
QModelIndex InstrumentsTreeModel::indexForItem | ( | InstrumentItem * | item | ) | const |
Definition at line 300 of file InstrumentsTreeModel.cpp.
References instruments(), and visibleTypes().
Referenced by InstrumentLibraryEditor::execAdd(), and removeItem().
QModelIndex InstrumentsTreeModel::indexOfHeadline | ( | InstrumentType | type | ) | const |
Definition at line 120 of file InstrumentsTreeModel.cpp.
References visibleTypes().
Referenced by data(), index(), parent(), and rowCount().
|
private |
Definition at line 87 of file InstrumentsTreeModel.cpp.
References DepthProbe, Gisas, InstrumentCollection::instrumentItems(), m_model, Offspec, and Specular.
Referenced by index(), indexForItem(), parent(), rowCount(), topMostItem(), and visibleTypes().
|
static |
Definition at line 331 of file InstrumentsTreeModel.cpp.
References DepthProbe, Gisas, InstrumentItem::is(), None, Offspec, and Specular.
Referenced by data(), and InstrumentLibraryEditor::execAdd().
bool InstrumentsTreeModel::isHeadline | ( | const QModelIndex & | index | ) | const |
Definition at line 323 of file InstrumentsTreeModel.cpp.
References index().
Referenced by data(), flags(), and InstrumentLibraryEditor::getOverlayActions().
InstrumentItem * InstrumentsTreeModel::itemForIndex | ( | const QModelIndex & | index | ) | const |
Definition at line 292 of file InstrumentsTreeModel.cpp.
References index().
Referenced by InstrumentLibraryEditor::createWidgetsForCurrentInstrument(), data(), InstrumentLibraryEditor::getOverlayActions(), InstrumentLibraryEditor::onCurrentChangedForChoose(), InstrumentLibraryEditor::onInstrumentChangedByEditor(), InstrumentLibraryEditor::onItemDoubleClickedForChoose(), parent(), and setData().
|
override |
Definition at line 147 of file InstrumentsTreeModel.cpp.
References index(), indexOfHeadline(), instruments(), itemForIndex(), and visibleTypes().
Referenced by index(), and rowCount().
void InstrumentsTreeModel::refreshAfterModelChange | ( | ) |
Definition at line 50 of file InstrumentsTreeModel.cpp.
void InstrumentsTreeModel::removeItem | ( | InstrumentItem * | item | ) |
Definition at line 312 of file InstrumentsTreeModel.cpp.
References index(), indexForItem(), m_model, and InstrumentCollection::removeInstrument().
Referenced by InstrumentLibraryEditor::getOverlayActions().
|
override |
Definition at line 168 of file InstrumentsTreeModel.cpp.
References indexOfHeadline(), instruments(), parent(), and visibleTypes().
|
override |
Definition at line 272 of file InstrumentsTreeModel.cpp.
References index(), itemForIndex(), InstrumentItem::setDescription(), and InstrumentItem::setInstrumentName().
Referenced by InstrumentLibraryEditor::onInstrumentDescriptionEdited(), and InstrumentLibraryEditor::onInstrumentNameEdited().
void InstrumentsTreeModel::setTypeEnabled | ( | InstrumentType | type, |
bool | b | ||
) |
Definition at line 41 of file InstrumentsTreeModel.cpp.
References m_visibleTypes.
Referenced by InstrumentLibraryEditor::execAdd(), InstrumentLibraryEditor::setDepthProbeEnabled(), InstrumentLibraryEditor::setGisasEnabled(), InstrumentLibraryEditor::setOffspecEnabled(), and InstrumentLibraryEditor::setSpecularEnabled().
InstrumentItem * InstrumentsTreeModel::topMostItem | ( | ) | const |
The topmost visible item. Can be null of course.
Definition at line 111 of file InstrumentsTreeModel.cpp.
References instruments(), and visibleTypes().
|
private |
Definition at line 69 of file InstrumentsTreeModel.cpp.
References DepthProbe, Gisas, instruments(), m_enableEmptyHeadlines, m_visibleTypes, Offspec, and Specular.
Referenced by index(), indexForItem(), indexOfHeadline(), parent(), rowCount(), and topMostItem().
|
private |
Definition at line 74 of file InstrumentsTreeModel.h.
Referenced by enableEmptyHeadlines(), and visibleTypes().
|
private |
Definition at line 71 of file InstrumentsTreeModel.h.
Referenced by instruments(), and removeItem().
|
private |
Definition at line 73 of file InstrumentsTreeModel.h.
Referenced by flags().
|
private |
Definition at line 72 of file InstrumentsTreeModel.h.
Referenced by setTypeEnabled(), and visibleTypes().