我在Ubuntu 18.04,上为我的树莓派4交叉编译了Qt 5.14.1
对于我的应用程序,我需要圆弧,当我搜索时,我发现圆弧属于QtQuick.Studio.Components 1.0
https://doc.qt.io/qtdesignstudio/qml-qtquick-studio-components-arc.html
但当我在main.qml
中添加import QtQuick.Studio.Components 1.0
时,我出现了一个错误QML module not found (QtQuick.Studio.Components 1.0 ) import paths : /opt/RaspberryQt/sysroot/usr/local/RaspberryQt/qml
所以在我的.pro
文件中,我添加了QML_IMPORT_PATH = /opt/RaspberryQt/sysroot/usr/local/RaspberryQt/qml
但是我仍然有这个错误
这些是我在交叉编译之前安装在Raspberry pi 4上的库。你能告诉我少了哪一个吗?
sudo apt-get build-dep qt5-qmake
sudo apt-get build-dep libqt5gui5
sudo apt-get build-dep libqt5webengine-data
sudo apt-get build-dep libqt5webkit5
sudo apt-get install libudev-dev libinput-dev libts-dev libxcb-xinerama0-dev libxcb-xinerama0 gdbserver
这是我的配置
cd /opt/RaspberryQt/build
../qt-everywhere-src-5.14.1/configure -release -opengl es2 -eglfs -device linux-rasp-pi4-v3d-g++ -device-option CROSS_COMPILE=/opt/RaspberryQt/tools/rpi-gcc-8.3.0/bin/arm-linux-gnueabihf- -sysroot /opt/RaspberryQt/sysroot -prefix /usr/local/RaspberryQt -opensource -confirm-license -skip qtscript -skip qtwayland -skip qtwebengine -nomake tests -nomake examples -make libs -pkg-config -no-use-gold-linker -v -recheck
提前感谢
我能够解决这个问题。首先安装Qt Design Studio(您可以通过转到Qt安装目录将组件添加到Qt安装中,例如C:Qt
并运行MaintenanceTool.exe
安装后,导航到Qt安装目录中的以下路径:
[Wherever Installed]QtToolsQtDesignStudiobinqmlQtQuick
然后在那里,复制整个Studio
文件夹,并将其粘贴到:
[Wherever Installed]QtToolsQtCreatorbinQmlQtQuick
然后重新启动Qt创建者,它应该会看到它。
注意:可能有一种更优雅的方法可以通过将[path]QtToolsQtCreatorbinQml
目录添加到导入路径来从QtDesignStudio导入模块,但这对我来说不起作用,所以我只是使用上面的方法。
您正在从一个额外的qt模块获取导入。所以编译并安装https://codereview.qt-project.org/gitweb?p=qt-labs/qtquickdesigner-components.git;a=树也插入到raoberry上的qt安装中。
跟进ThioJoe的答案:
如果您已经尝试过ThioJoe方法,但面临相同的问题,请尝试以下方法:
1.复制位于以下位置的Studio
文件夹:[Wherever Installed]QtToolsQtDesignStudiobinqmlQtQuick
。
2.将复制的Studio
文件夹粘贴到:[Wherever Installed]Qt6.2.3mingw_64qmlQtQuick
(注意,6.2.3可能根据您的版本而有所不同(。
3。重新启动Qt呼吸器