ошибка: переменная 'QQmlComponent component' имеет инициализатор, но неполный тип в Qt5
я играю с выставлением атрибутов типов C ++ в QML в Qt5 на основе этого урокаhttp://qt-project.org/doc/qt-5.0/qtqml/qtqml-cppintegration-exposecppattributes.html, когда я запускаю его, я получаю эту ошибку на панели проблемошибка: переменная 'QQmlComponent component ' имеет инициализатор, но неполный тип не только у меня есть эта ошибка у меня также есть эта ошибка, сигнал, который я создал с помощью Q_PROPERTY, не обнаружен
C: \ Users \ Tekme \ Documents \ QtStuf \ quick \ QmlCpp \ message.h: 15: ошибка: 'authorChanged» не был объявлен в этой области emit authorChanged (); ^
мой код
#ifndef MESSAGE_H
#define MESSAGE_H
#include
class Message : public QObject
{
Q_OBJECT
Q_PROPERTY(QString author READ author WRITE setAuthor NOTIFY authorChanged)
public:
void setAuthor(const QString &a) {
if (a != m_author) {
m_author = a;
emit authorChanged();
}
}
QString author() const {
return m_author;
}
private:
QString m_author;
};
#endif
и в моем main.cpp
#include "message.h"
#include
#include
#include
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QQmlEngine engine;
Message msg;
engine.rootContext()->setContextProperty("msg",&msg);
QQmlComponent component(&engine, QUrl::fromLocalFile("main.qml"));
component.create();
return a.exec();
}