Label is not a Type (only with 5.12)
-
Hi.
In my app, I load this piece of qml inside a QQuickView. It works fine on all platforms and versions, but Qt 5.12 for iOS.Only on Qt 5.12 for iOS I get the error "Ctrls.Label is not a type"
Does somebody have any idea how and where to debug?
import QtQuick 2.12 import QtQuick.Controls 2.5 as Ctrls Rectangle { id: window visible: true Column { spacing: 2 width: parent.width Ctrls.Label { width: parent.width wrapMode: Label.Wrap height: implicitHeight horizontalAlignment: Qt.AlignHCenter text: "This is just a Label." } } }
-
The problem is solved by adding this line of code in the main() :
QQuickStyle::setStyle("Fusion");main.cpp
int main(int argc, char *argv[]) { QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); QQuickStyle::setStyle("Fusion"); ... }
-
I tried on your issue.
However, My environment is Ubuntu 16.04 LTS x64 (linux) / Qt 5.12 :(
Unfortunately, I don't have iOS develop environment....It isn't iOS, but it was able to execute normally.
import QtQuick.Controls 2.5 as Ctrls
As far as I see Qt document, I think that QtQuick.Controls version is correct at 5.12.
http://doc.qt.io/qt-5/qtquickcontrols-index.html#versionsimport QtQuick.Controls 2.12 as Ctrls
Please confirm it.
-
Thank you very much for replying. You are right, should be QtQuick.Controls 2.12.
I tried the code on another project and it works fine. So, the problem is only on my main project. It looks like is not including the necessary components in the bundle deployed to the device.
But I have no idea where to look for such an issue.
-
Hi,
Compare your projects .pro file for any difference in the modules used for example.
-
@JoZCaVaLLo ,
thk reply @SGaist, and my others solution.For iOS, I think that the necessary modules will be automatically deployed for iOS.
If QML module error occurs in iOS, it may be improved by distclean and deploy,again.
In Android case, I could improved similarity issue. -
The problem is solved by adding this line of code in the main() :
QQuickStyle::setStyle("Fusion");main.cpp
int main(int argc, char *argv[]) { QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); QQuickStyle::setStyle("Fusion"); ... }