Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个属性:
Q_PROPERTY(int _a READ a WRITE setA NOTIFY aChanged)
我只知道物业的名称_a。我想得到方法的索引setA。
_a
setA
签出QMetaObject::indexOfProperty(const char * name)和QMetaProperty QMetaObject::property(int index)。他们将允许您按名称访问该属性。
QMetaObject::indexOfProperty(const char * name)
QMetaProperty QMetaObject::property(int index)
AFAIK 现在可以通过相应的属性访问 setter 方法。