Then you are doing something wrong.
#include <QtGui>
#include <QDebug>
Q_OBJECT
Q_PROPERTY(int propA READ propA WRITE setPropA USER true)
public:
int propA() const {return m_propA;}
void setPropA(int propA) {m_propA = propA;}
private:
int m_propA;
};
class B: public A {
Q_OBJECT
Q_PROPERTY(int propB READ propB WRITE setPropB USER true)
public:
int propB() const {return m_propB;}
void setPropB(int propB) {m_propB = propB;}
private:
int m_propB;
};
int main(int argc, char *argv[])
{
qWarning() << o->className();
for(int i = 0; i < o->propertyCount(); ++i)
properties <<
QString::fromLatin1(o
->property
(i
).
name());
qWarning() << properties;
delete b;
return 0;
}
#include "main.moc"
#include <QtGui>
#include <QDebug>
class A: public QObject {
Q_OBJECT
Q_PROPERTY(int propA READ propA WRITE setPropA USER true)
public:
int propA() const {return m_propA;}
void setPropA(int propA) {m_propA = propA;}
private:
int m_propA;
};
class B: public A {
Q_OBJECT
Q_PROPERTY(int propB READ propB WRITE setPropB USER true)
public:
int propB() const {return m_propB;}
void setPropB(int propB) {m_propB = propB;}
private:
int m_propB;
};
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QObject *b = new B;
const QMetaObject *o = b->metaObject();
qWarning() << o->className();
QStringList properties;
for(int i = 0; i < o->propertyCount(); ++i)
properties << QString::fromLatin1(o->property(i).name());
qWarning() << properties;
delete b;
return 0;
}
#include "main.moc"
To copy to clipboard, switch view to plain text mode
works perfect.
Bookmarks