A rather minimal example would be:
main.cpp
#include
#include
int main(int argc, char** argv)
{
QGuiApplication app(argc, argv);
QQuickView view;
view.resize(800, 480);
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl("qrc:///foo.qml"));
view.show();
return app.exec();
}
foo.qml (here bundled as resource):
import QtQuick 2.0
Rectangle {
color: "lightsteelblue"
Text {
anchors.centerIn: parent
text: "Hello"
}
}