Error 2660: qmlRegisterType fails when applying to class which inherits from 2 base classes



  • Hi All,

    I want to register my class DA_RailCarrier to QML via

    qmlRegisterType<DA_RailCarrier>("DA_RailCarrier", 1, 0, "DA_RailCarrier");

    The class is declared as follows:
    class DA_RailCarrier : public QObject, public WST_FSM

    When compiling, I get the following message:
    C2660: 'WST_FSM::operator new': function does not take 2 arguments

    The error references to createInto in qqmlprivate.h:

    {
        void Q_QML_EXPORT qdeclarativeelement_destructor(QObject *);
        template<typename T>
        class QQmlElement : public T
        {
        public:
            virtual ~QQmlElement() {
                QQmlPrivate::qdeclarativeelement_destructor(this);
            }
        };
    
        template<typename T>
        void createInto(void *memory) { new (memory) QQmlElement<T>; }
    

    I tried to add#include <new>to WST_FSM, same result.
    WST_FSM is in general not a Q_OBJECT derived class, but I've also tried it with QObject as base class.

    Does anyone know a solution? thanks in advance,

    Markus

    System Info:

    • Qt 5.4.1
    • Compiler MSVC2013

  • Lifetime Qt Champion

    Hi,

    Can you show the declaration of WST_FSM and DA_RailCarrier ?



  • @SGaist
    Hi,

    WST_FSM:

    class WST_FSM {
        ////    Constructors and destructors    ////
        //## operation WST_FSM(WST_TSK)
        WST_FSM();
        
        //## operation ~WST_FSM()
        virtual ~WST_FSM( void );
    ...
    

    DA_RailCarrier:

    class DA_RailCarrier : public QObject, public WST_FSM {
            Q_OBJECT
            Q_PROPERTY( QVariantList Order_t READ getQmlOrder_t NOTIFY guiRefresh)    
        
    

  • Lifetime Qt Champion

    That's not enough to identify the problem at hand, you should post the complete declaration of both classes


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.