Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error 2660: qmlRegisterType fails when applying to class which inherits from 2 base classes
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
qml register
4 Posts 2 Posters 2.0k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CertaBit
    wrote on last edited by CertaBit
    #1

    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
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Can you show the declaration of WST_FSM and DA_RailCarrier ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      C 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Can you show the declaration of WST_FSM and DA_RailCarrier ?

        C Offline
        C Offline
        CertaBit
        wrote on last edited by
        #3

        @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)    
            
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

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

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved