【问题标题】:QML module not found (QtQuick.Studio.Components 1.0 )未找到 QML 模块(QtQuick.Studio.Components 1.0)
【发布时间】:2021-04-16 05:56:12
【问题描述】:

我在 Ubuntu 18.04 上为我的 Raspberry pi 4 交叉编译了 Qt 5.14.1,

对于我的应用程序,我需要 arcs,当我搜索时我发现 arc 属于 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 import qml cross-compiling pi


    【解决方案1】:

    您正在从一个额外的 qt 模块获取导入。所以编译并安装https://codereview.qt-project.org/gitweb?p=qt-labs/qtquickdesigner-components.git;a=tree 到你的 raoberry 上的 qt 安装中。

    【讨论】:

    • 很抱歉我的重播迟了。感谢您的帮助。但我不明白我该怎么做。我尝试使用wget https://codereview.qt-project.org/gitweb?p=qt-labs/qtquickdesigner-components.git;a=blob;f=qtquickdesigner-components.pro;h=ce6617ea754f85f96a43fbfbaddfff1be0b6e468;hb=HEAD 下载它,但我只有一个文档。如何下载这些库?我应该在创建 sysroot 和编译 Qt 之前将它们下载到我的树莓派中吗?
    【解决方案2】:

    我能够解决这个问题。首先安装Qt Design Studio(可以在Qt安装目录下添加组件,如C:\Qt,运行MaintenanceTool.exe

    安装后,导航到 Qt 安装目录中的以下路径:

    [Wherever Installed]\Qt\Tools\QtDesignStudio\bin\qml\QtQuick

    然后在那里,复制整个Studio 文件夹,并将其粘贴到:

    [Wherever Installed]\Qt\Tools\QtCreator\bin\Qml\QtQuick

    然后重新启动 Qt Creator,它应该会看到它。

    注意:通过将[path]\Qt\Tools\QtCreator\bin\Qml\ 目录添加到导入路径,可能有一种更优雅的方式从 Qt Design Studio 导入模块,但这对我不起作用,所以我只是使用上面的方法.

    【讨论】:

      猜你喜欢
      • 2019-04-02
      • 1970-01-01
      • 2021-11-15
      • 2019-10-14
      • 2016-03-19
      • 2018-01-29
      • 1970-01-01
      • 2021-04-27
      • 2018-04-15
      相关资源
      最近更新 更多