How to use a custom Qt type with a QML signal?
问题 I've created a custom type inside my Qt 5.2 qml application class Setting : public QObject { Q_OBJECT Q_PROPERTY(QString key READ key WRITE setKey) Q_PROPERTY(QVariant value READ value WRITE setValue) public: Setting(QObject * parent = 0); QString key() const; void setKey(QString const & key); QVariant value() const; void setValue(QVariant const & value); private: QString m_key; QVariant m_value; }; and registered it in my main function: int main(int argc, char *argv[]) { QApplication app