Search code examples
pythonc++qtenumssquish

Squish: Enum as function parameter


Do someone know a workaround for use a enum as a function parameter in a c++ function and call them function with squish? The Enum was declared in a other class and namespace as the function itself. Following code is in use and works in qt:

Enum-class:

namespace prem {
     namespace space {

         class Controller : public QObject {
             Q_OBJECT
             Q_ENUMS(ID)

         public:

            enum ID { ONE, TWO, THREE };
          //.... other Stuff

         };
     } 
}

Using class:

namespace prem {
    namespace area {

        class Handler: public QObject {

        //...... some stuff

        public slot:

             void slotHandelID(prem::space::Controller::ID id) {
             // do some stuff 
             } 

        };
    }
}

Now I want to call in the python test script the slotHandelID Function.

controller = findObject("m_controller")
handler = findObject("m_handler")
handler.slotHandelID(controller.ONE)

But I get this

SyntaxError: No matching 'slotHandelID(int)' overload found: Following overloads are available:
    prem::area::Handler::slotHandelID(undefined)

When I define the slotHandelID(prem::space::Controller::ID id) in the Controller class the code works fine.


Solution

  • The bug is fixed during the new squish version 6.0.