First compile.
This commit is contained in:
58
main.cpp
58
main.cpp
@@ -27,16 +27,42 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include <bcmainwindow.h>
|
||||
#include <bc.h>
|
||||
#include <QApplication>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMetaEnum>
|
||||
|
||||
// main.cpp
|
||||
#include <QCoreApplication>
|
||||
#include <QTimer>
|
||||
#include <QDebug>
|
||||
|
||||
#include <bcmainwindow.h>
|
||||
#include <bcvalue.h>
|
||||
|
||||
|
||||
/*
|
||||
#include <QMetaEnum>
|
||||
|
||||
void parseString(const QString &inputString) {
|
||||
QMetaEnum metaEnum = QMetaEnum::fromType<BCValue::ID>();
|
||||
|
||||
bool ok = false;
|
||||
// keyToValue parst den String ("x1") und liefert den int-Wert
|
||||
int intVal = metaEnum.keyToValue(inputString.toLatin1().constData(), &ok);
|
||||
|
||||
if (ok) {
|
||||
BCValue::ID id = static_cast<BCValue::ID>(intVal);
|
||||
// Erfolg!
|
||||
} else {
|
||||
// Fehler: String existiert nicht im Enum
|
||||
qWarning() << "Unbekannter Enum String:" << inputString;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include <QThread>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@@ -52,9 +78,27 @@ int main(int argc, char *argv[])
|
||||
|
||||
qDebug() << " --- sach bloss das geht: " << x << " ui: " << uint8_t(x) << " : " << map[Color::Red];
|
||||
|
||||
QApplication a(argc, argv);
|
||||
//BCMainWindow w;
|
||||
//w.show();
|
||||
return a.exec();
|
||||
|
||||
QApplication app(argc, argv);
|
||||
BCMainWindow w;
|
||||
w.show();
|
||||
|
||||
QMetaEnum metaEnum = QMetaEnum::fromType<BC::ID>();
|
||||
|
||||
bool ok = false;
|
||||
QString inputString = "x3";
|
||||
BC::ID yyy{};
|
||||
|
||||
// keyToValue parst den String ("x1") und liefert den int-Wert
|
||||
int intVal = metaEnum.keyToValue(inputString.toLatin1().constData(), &ok);
|
||||
if (ok)
|
||||
yyy = static_cast<BC::ID>(intVal);
|
||||
|
||||
auto xxx = BC::ID::Battery_Config_Force_Done;
|
||||
//QString result = fullString.section("::", -1);
|
||||
qDebug() << " schön: " << xxx << " -- " << uint8_t(xxx) << " : " << yyy;
|
||||
qDebug() << " nice: " << metaEnum.enumName() << " : " <<metaEnum.name() << ": " << metaEnum.enclosingMetaObject()->className();
|
||||
|
||||
return app.exec();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user