Nomenclature now use properly the element type 'thumbnail'

Use function provided by ElementData to check element type and
master type instead of use plain text (code is more strong)
This commit is contained in:
joshua
2022-06-01 22:29:12 +02:00
parent 3dd0986c4f
commit 2e70d2e599
7 changed files with 79 additions and 39 deletions

View File

@@ -345,6 +345,13 @@ ElementData::Type ElementData::typeFromString(const QString &string)
return ElementData::Simple;
}
QString ElementData::masterTypeToString() const {
if (m_type == Master)
return masterTypeToString(m_master_type);
else
return QLatin1String();
}
QString ElementData::masterTypeToString(ElementData::MasterType type)
{
switch (type) {

View File

@@ -43,6 +43,7 @@ class ElementData : public PropertiesInterface
Terminale = 32,
Thumbnail = 64};
Q_ENUM(Type)
Q_DECLARE_FLAGS(Types, Type)
enum MasterType {
Coil,
@@ -109,6 +110,7 @@ class ElementData : public PropertiesInterface
static QString typeToString(ElementData::Type type);
static ElementData::Type typeFromString(const QString &string);
QString masterTypeToString() const;
static QString masterTypeToString(ElementData::MasterType type);
static ElementData::MasterType masterTypeFromString(const QString &string);
@@ -157,4 +159,7 @@ class ElementData : public PropertiesInterface
private:
void kindInfoFromXml(const QDomElement &xml_element);
};
Q_DECLARE_OPERATORS_FOR_FLAGS(ElementData::Types)
#endif // ELEMENTDATA_H