Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › Error importing an enum from c++ class

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #23509

    jrrobles79

    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.

     

    #23511

    jrrobles79
Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded