Important: Please read the Qt Code of Conduct -

[SOLVED] Unable to call a Q_INVOKABLE method upon multilevel inheritence

  • Hi,

    I am having a BaseClass which inherits QObject. Now, this BaseClass is inherited by all of my class files in the application.

    BaseClass.h will look like.
    @class BaseClass: public QObject{
    BaseClass(AbstractPane *pane);

    Inherited class header file looks like

    @class ApplicationUI : public BaseClass
    ApplicationUI(bb::cascades::Application *app);
    virtual ~ApplicationUI() {}

    Q_INVOKABLE void screenTriggered();
    AbstractPane *root;


    I'm binding a QML file for ApplicationUI class which has a Menu option and will call screenTriggered() method upon menu click.

    The issue is the screenTriggered() method is not working in my case. A log saying "TypeError: Result of expression 'cppObj.screenTriggered' [undefined] is not a function." is displayed in Terminal.

    Without Baseclass implementation, inheriting the QObject directly to ApplicationUI class is working perfectly.

    Please help me out.


  • Hi!
    You should add
    to every clas which inherits QObject.

  • That worked out.

    Thank you very much.

  • You're welcome.
    Will be great if you mark this thread as solved. Just edit first topic and add [Solved] to caption.

Log in to reply