Answer the question
In order to leave comments, you need to log in
Is it possible to get the currently loaded QQmlApplicationEngine from an arbitrary class?
The engine is loaded in main.cpp
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
Answer the question
In order to leave comments, you need to log in
New components can be added directly to qml:
Button {
text: "Click to create dynamic component"
onClicked : {
// Create the component and add it to the Container
var createdControl = compDef.createObject();
rootContainer.add(createdControl);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question