You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.1 KiB
56 lines
1.1 KiB
#ifndef EMENUTAB_H
|
|
#define EMENUTAB_H
|
|
|
|
#include <QtCore>
|
|
#include <QMetaType>
|
|
|
|
class EMenuTab : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
private:
|
|
//Private constructor prevent the enumeration class from being instantiated
|
|
explicit EMenuTab(QObject* parent = nullptr);
|
|
|
|
public:
|
|
enum eMenuTab : quint8
|
|
{
|
|
EMPTY_TAB,
|
|
B_TAB,
|
|
M_TAB,
|
|
C_TAB,
|
|
PW_TAB,
|
|
PD_TAB,
|
|
CINE_TAB,
|
|
TGC_TAB
|
|
};
|
|
|
|
Q_ENUM(eMenuTab)
|
|
|
|
static int qtEnumToInt(const eMenuTab qtEnum)
|
|
{
|
|
return QMetaEnum::fromType<eMenuTab>().value(qtEnum);
|
|
}
|
|
|
|
static QString qtEnumToString(const eMenuTab qtEnum)
|
|
{
|
|
return QString(QMetaEnum::fromType<eMenuTab>().valueToKey(qtEnum));
|
|
}
|
|
|
|
static eMenuTab qtStringToEnum(const QString stringEnum)
|
|
{
|
|
auto e = QMetaEnum::fromType<eMenuTab>();
|
|
for(int i = 0; i < e.keyCount(); i++)
|
|
{
|
|
const char* name = e.key(i);
|
|
if(QString(name) == stringEnum)
|
|
{
|
|
return static_cast<EMenuTab::eMenuTab>(e.value(i));
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
Q_DECLARE_METATYPE(EMenuTab::eMenuTab);
|
|
|
|
#endif //EMENUTAB_H
|
|
|