QObjects可以有多个同名的静态属性吗?

时间:2016-03-25 23:14:44

标签: c++ qt qobject moc qproperty

Parent QObject的用户自制子类是否可以有多个同名的Q_PROPERTY(可能有不同的类型)?如果我将Parent子类化为Child,并将 命名为Q_PROPERTY,该怎么办?像这样:

#include <QObject>

class Parent : public QObject {
  Q_OBJECT

  Q_PROPERTY(int something MEMBER m_something)
  Q_PROPERTY(double something MEMBER m_somethingElse)
  Q_PROPERTY(QString third MEMBER m_third)

  int m_something;
  double m_somethingElse;
  QString m_third;
};

class Child : public Parent {
  Q_OBJECT

  Q_PROPERTY(QString third MEMBER m_fourth)

  QString m_fourth;
};

0 个答案:

没有答案