Solved QQML Component: Component is Not Ready
-
Hello Folks
Quick query for you:
I am trying to embed some QML componenets into a pretty large existing C++/QT project built in visual studio 2013
I've read every thread on here with no joy
My QML is so simple:**import QtQuick.Controls 2.0
import QtQuick 2.0Button {
objectName: "buttonTest"
}**My C++ is:
QQmlEngine engine; QQmlComponent component(&engine, QUrl(QStringLiteral("qrc:/aos.qml"))); QObject *object = component.create(); QObject* item = object->findChild<QObject *>("buttonTest");
I've tried both below, with still the same error QQML Component: Component is Not Ready:
QQmlComponent component(&engine, QUrl(QStringLiteral("qrc:/aos.qml")));
QQmlComponent component(&engine, QUrl::fromLocalFile(QDir::currentPath() + "\Resources\videos\aos.qml")); -
Have you tried to print
component.errors()
? -
@IntruderExcluder said in QQML Component: Component is Not Ready:
component.errors()
No I haven't tried that, I will now though. Thanks
What would be the best way to go about that? -
You can use QDebug to print errors to console:
#include <QDebug> ... qDebug() << component.errors();
They are pretty readable. If you do not know what errors mean, you can post them here.
-
@IntruderExcluder Thats great, thanks a lot for the advice. I'll let you know how it goes
-
@IntruderExcluder That debug was great advice and pointed me to my issue.
The issue been - module “QtQuick.Controls” is not installed
But when I go to the QT Project Settings within visual studio the option to add this module (Quick Controls 2) is greyed out.
I can add Qt Quick & Qt Quick Widgets no problem
Would you know how to install Quick Controls for Visual Studio 2013 & QT5.5 ? -
@celica said in QQML Component: Component is Not Ready:
Would you know how to install Quick Controls for Visual Studio 2013 & QT5.5 ?
Not possible.
See https://doc.qt.io/qt-5/qtquickcontrols-index.html
"The module was introduced in Qt 5.7". -
@jsulm Thanks, that would explain it so.
Is it possible to generate a tumbler from 5.5 ? -
@celica said in QQML Component: Component is Not Ready:
Is it possible to generate a tumbler from 5.5 ?
As I said in https://forum.qt.io/topic/110586/tumbler-and-qt5-5, add
import QtQuick.Extras 1.4
to your *.qml file -
@JKSH Thanks for the input. import QtQuick.Extras 1.4 still gives me the QML component not found error.
So i updated the main project to visual studio 2017 with QT 5.12 and now I have it working.