mercredi 23 août 2017

How to use class instance, based on QObject in static class

How I can work from static member with non-static instance member from another class, based on QObject. For example, two classes:

class Foo : public QObject
{
    Q_OBJECT
public:
    explicit Foo (QObject *parent = 0);
    API *instance = new API(); // API also based on QObject
}


class Bar
{
public:
    inline static int getValueWithAPI(*API api) {
        return api->method();
    }
}

Headers already included, but I've got error:

'API' was not declared in this scope

I need to get access to instanse of API for calling methods from static functions, how I can do it?

Aucun commentaire:

Enregistrer un commentaire