Compile QT 5.8 to cross-compile Beaglebone
-
@Andrey-Shmelew You're using a relative path:
view.setSource(QUrl::fromLocalFile("main.qml"));
Depending from where you start your app the file will not be found.
You should construct an absolute path at runtime using http://doc.qt.io/qt-5/qcoreapplication.html#applicationDirPath -
@Andrey-Shmelew Something like this:
QString path = QCoreApplication::applicationDirPath() + '/' + "main.qml"; QQuickView view; view.setSource(QUrl::fromLocalFile(path)); view.show();
-
@jsulm
thanks, but it don't works for mefile:///usr/main.qml: File not found
note that when i deploy with qt 5.5 kit it enables to deploy without any path stuff
so if i upload main.qml to beaglebone's /usr/ folder then i get :
QQuickView only supports loading of root objects that derive from QQuickItem. If your example is using QML 2, (such as qmlscene) and the .qml file you loaded has 'import QtQuick 1.0' or 'import Qt 4.7', this error will occur. To load files with 'import QtQuick 1.0' or 'import Qt 4.7', use the QDeclarativeView class in the Qt Quick 1 module.
-
@Andrey-Shmelew "/usr"?!
Where is you app located? -
@Andrey-Shmelew Quite unusual location.
Can you describe how the layout of your app is?
Is it like this:/usr/YOUR_APP_EXECUTABLE /usr/main.qml
?
-
@Andrey-Shmelew can you please show how it looks like in /usr? Is it like I asked above? So, how does the deploy directory (/usr in your case) look like?
-
@Andrey-Shmelew You should really upload a bigger picture - it is nearly impossible to see anything. I tried hard but could not find main.qml file there. So, where is it?
-
@Andrey-Shmelew And you should not pollute /usr with files of your app. It is better to use /opt/YOUR_APP_NAME.
-
@Andrey-Shmelew That's why it is not working
-
@jsulm
so if i upload main.qml to beaglebone's /usr/ folder then i get :QQuickView only supports loading of root objects that derive from QQuickItem.
If your example is using QML 2, (such as qmlscene) and the .qml file you
loaded has 'import QtQuick 1.0' or 'import Qt 4.7', this error will occur.To load files with 'import QtQuick 1.0' or 'import Qt 4.7', use the
QDeclarativeView class in the Qt Quick 1 module. -
@Andrey-Shmelew said in Compile QT 5.8 to cross-compile Beaglebone:
QDeclarativeView
It says what you should do: use QDeclarativeView instead of QQuickView
-
This post is deleted!
-
ok, i solved the problem:
put manually main.qml into /usr/ foldermain.cpp
#include <QGuiApplication> #include <QQmlApplicationEngine> int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("/usr/main.qml"))); return app.exec(); }
-
@Andrey-Shmelew You should take a look at "Installing Files" in http://doc.qt.io/qt-5/qmake-advanced-usage.html to avoid manually copying the file. And you should construct the path at runtime, as I suggested before, else if you change the installation directory later you will need to change your code and rebuild the app.