BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Holds all tag info for SessionItem. More...
Classes | |
struct | TagInfo |
Public Member Functions | |
void | addChild (const QString &tagName) |
int | childCount (const QString &tagName) |
int | childMax (const QString &tagName) |
int | indexFromTagRow (const QString &tagName, int row) const |
Returns index in SessionItem's m_children corresponding to given row in tagName. More... | |
int | insertIndexFromTagRow (const QString &tagName, int row) |
Returns index in SessionItem's m_children to insert new item. More... | |
bool | isSingleItemTag (const QString &tagName) |
bool | isValid (const QString &tagName, const QString &modelType="") const |
Returns true if there is a registered tag with such name. More... | |
bool | maximumReached (const QString &tagName) const |
QStringList | modelTypesForTag (const QString &tagName) const |
Returns list of modelTypes the given tagName is intended for. More... | |
bool | registerTag (const QString &name, int min, int max, const QStringList &modelTypes) |
Register tag with given parameters. More... | |
void | removeChild (const QString &tagName) |
QString | tagFromIndex (int index) const |
int | tagStartIndex (const QString &tagName) const |
Returns start index of given tagName corresponding to the index of SessionItem's m_children. More... | |
Private Member Functions | |
TagInfo & | tagInfo (const QString &tagName) |
const TagInfo & | tagInfo (const QString &tagName) const |
Private Attributes | |
QVector< TagInfo > | m_tags |
Holds all tag info for SessionItem.
Definition at line 24 of file SessionItemTags.h.
void SessionItemTags::addChild | ( | const QString & | tagName | ) |
Definition at line 114 of file SessionItemTags.cpp.
References SessionItemTags::TagInfo::childCount, maximumReached(), and tagInfo().
int SessionItemTags::childCount | ( | const QString & | tagName | ) |
Definition at line 104 of file SessionItemTags.cpp.
References SessionItemTags::TagInfo::childCount, and tagInfo().
Referenced by indexFromTagRow().
int SessionItemTags::childMax | ( | const QString & | tagName | ) |
Definition at line 109 of file SessionItemTags.cpp.
References SessionItemTags::TagInfo::max, and tagInfo().
int SessionItemTags::indexFromTagRow | ( | const QString & | tagName, |
int | row | ||
) | const |
Returns index in SessionItem's m_children corresponding to given row in tagName.
Definition at line 70 of file SessionItemTags.cpp.
References childCount(), tagInfo(), and tagStartIndex().
int SessionItemTags::insertIndexFromTagRow | ( | const QString & | tagName, |
int | row | ||
) |
Returns index in SessionItem's m_children to insert new item.
If number of items for given tagName exceeds maximum allowed, returns -1;
Definition at line 80 of file SessionItemTags.cpp.
References maximumReached(), tagInfo(), and tagStartIndex().
bool SessionItemTags::isSingleItemTag | ( | const QString & | tagName | ) |
Definition at line 131 of file SessionItemTags.cpp.
References isValid(), and tagInfo().
Referenced by SessionItem::displayName().
bool SessionItemTags::isValid | ( | const QString & | tagName, |
const QString & | modelType = "" |
||
) | const |
Returns true if there is a registered tag with such name.
If modelType is not empty, than an additional check is performed if tag is intended for the given modelType.
Definition at line 36 of file SessionItemTags.cpp.
References m_tags.
Referenced by SessionModel::insertNewItem(), isSingleItemTag(), modelTypesForTag(), SessionModel::moveItem(), and registerTag().
bool SessionItemTags::maximumReached | ( | const QString & | tagName | ) | const |
Definition at line 152 of file SessionItemTags.cpp.
References tagInfo().
Referenced by addChild(), insertIndexFromTagRow(), and SessionModel::moveItem().
QStringList SessionItemTags::modelTypesForTag | ( | const QString & | tagName | ) | const |
Returns list of modelTypes the given tagName is intended for.
Definition at line 50 of file SessionItemTags.cpp.
References isValid(), SessionItemTags::TagInfo::modelTypes, and tagInfo().
bool SessionItemTags::registerTag | ( | const QString & | name, |
int | min, | ||
int | max, | ||
const QStringList & | modelTypes | ||
) |
Register tag with given parameters.
Returns true in case of success. Returns false if parameters are invalid or such tag was already registered.
Definition at line 21 of file SessionItemTags.cpp.
References isValid(), m_tags, and RealSpace::Particles::name().
void SessionItemTags::removeChild | ( | const QString & | tagName | ) |
Definition at line 122 of file SessionItemTags.cpp.
References tagInfo().
QString SessionItemTags::tagFromIndex | ( | int | index | ) | const |
|
private |
Definition at line 139 of file SessionItemTags.cpp.
Referenced by addChild(), childCount(), childMax(), indexFromTagRow(), insertIndexFromTagRow(), isSingleItemTag(), maximumReached(), modelTypesForTag(), and removeChild().
|
private |
int SessionItemTags::tagStartIndex | ( | const QString & | tagName | ) | const |
Returns start index of given tagName corresponding to the index of SessionItem's m_children.
Definition at line 57 of file SessionItemTags.cpp.
References m_tags.
Referenced by indexFromTagRow(), and insertIndexFromTagRow().
|
private |
Definition at line 61 of file SessionItemTags.h.
Referenced by isValid(), registerTag(), tagFromIndex(), tagInfo(), and tagStartIndex().