@J-Hilk said in QML -AnfängerFrage:
QQuickWidget
Danke für die schelle Antwort.
Ich hatte kein QQuickWidget, ich habe eine neue QMl-Anwendung angemeldet und den Standarttext
Window {
width: 640
height: 480
visible: true
title: qsTr("Hello World")
}
durch
Rectangle{
width: 100
height: 100
color: "red"
border.color: "black"
boder.width: 5
radius: 10
visible: true
}
ersetzt, aber in der main.cpp war die QQmlApplicationEngine:
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
const QUrl url(u"qrc:/viereck/main.qml"_qs);
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
&app, [url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl)
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
engine.load(url);
return app.exec();
}