My class does indeed inherit from QObject. My question is ... how do I specify the methods for runtime introspection using a macro similar to Q_PROPERTY?
{
Q_OBJECT
Q_PROPERTY(int mData
READ getData()
WRITE setData()
RESET resetData())
Q_METHOD(??? // <--- How do I do this?
public:
cMyClass() : mData(7) {}
type0 someMethod(type1 foo1, type2 foo2, type3 foo3, ...);
int const getData() { return mData; }
void setData(int data) { mData = data; }
void resetData() { mData = 0; }
private:
int mData;
};
class cMyClass : public QObject
{
Q_OBJECT
Q_PROPERTY(int mData
READ getData()
WRITE setData()
RESET resetData())
Q_METHOD(??? // <--- How do I do this?
public:
cMyClass() : mData(7) {}
type0 someMethod(type1 foo1, type2 foo2, type3 foo3, ...);
int const getData() { return mData; }
void setData(int data) { mData = data; }
void resetData() { mData = 0; }
private:
int mData;
};
To copy to clipboard, switch view to plain text mode
So that I can query like this ...
cMyClass * instance(new cMyClass);
cout << "Inspecting methods ..." << endl;
int count(instance->metaObject()->methodCount());
for(int i=0; i<count; i++)
{
cout << "\t" << instance->metaObject()->method(i).signature() << endl;
}
cMyClass * instance(new cMyClass);
cout << "Inspecting methods ..." << endl;
int count(instance->metaObject()->methodCount());
for(int i=0; i<count; i++)
{
cout << "\t" << instance->metaObject()->method(i).signature() << endl;
}
To copy to clipboard, switch view to plain text mode
Bookmarks