我的main.cpp
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include "BackEnd.h"
#include "Execute.h"
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return app.exec();
}
还有我的main.qml
Window
{
id: mainWindow
visible: true
width: 280
height: 570
property var prop;
}
如何从c ++设置prop
属性?我只找到了从c ++创建qml对象的解决方案。