Hi,I have the next enum that I created to organize my console.log :
#ifndef MYLOGTYPE_H
#define MYLOGTYPE_H
#include <QObject>
class MyLogType: public QObject
{
Q_OBJECT
public:
MyLogType(QObject *parent = nullptr);
enum Value{
ERROR = 10,
INFO = 20,
LOG = 30,
DEBUG = 40,
WARN = 50
};
Q_ENUM(Value)
};
#endif // MYLOGTYPE_H
I imported it, like any other c++ class:
qmlRegisterType<MyLogType>("com.iubo.app.types.mylogtype", 1, 0, "MyLogType");
on viewhelper.qml
import com.iubo.app.types.mylogtype 1.0
import QtQuick 2.0
import Felgo 3.0
...
...
function logMyEvent ( logType, componentName, functionName, msg){
switch(logType){
case MyLogType.WARN:
console.warn( componentName+":"+functionName+" msg:" + msg )
break;
case MyLogType.ERROR:
console.error( componentName+":"+functionName+" msg:" + msg )
break;
case MyLogType.INFO:
console.info( componentName+":"+functionName+" msg:" + msg )
break;
case MyLogType.LOG:
console.log( componentName+":"+functionName+" msg:" + msg )
break;
case MyLogType.DEBUG:
default:
console.debug( componentName+":"+functionName+" msg:" + msg )
break;
}
return;
}
Even when I type ‘MyLogType. ' on my QML the correct values of the enums are showed Im getting this error:
Warning: QML import could not be resolved in any of the import paths: com.iubo.app.types.mylogtype
and on the app shows: “viewHelper.qml:1:1: modulecom.iubo.app.types.mylogtype is not installed"
I cleaned, rebuild and qmake my project but I don’t see the error, is the same procedure I have done for other classes.