在尝试使用qmlrs时,我遇到了以下问题:

~/rustqml/qmlrs$ cargo run --example factorial
Compiling qmlrs v0.0.1 (file:///home/dally/rustqml/qmlrs)
Running target/debug/examples/factorial
QQmlApplicationEngine failed to load component
file:///home/dally/rustqml/qmlrs/examples/factorial_ui.qml:2 module "QtQuick.Controls" is not installed
file:///home/dally/rustqml/qmlrs/examples/factorial_ui.qml:3 module "QtQuick.Layouts" is not installed
file:///home/dally/rustqml/qmlrs/examples/factorial_ui.qml:2 module "QtQuick.Controls" is not installed
file:///home/dally/rustqml/qmlrs/examples/factorial_ui.qml:3 module "QtQuick.Layouts" is not installed

搜索之后,我安装了libqt5qml-quickcontrols。我现在收到有关要求版本1.2的错误:
~/rustqml/qmlrs$ cargo run --example factorial
Running target/debug/examples/factorial
QQmlApplicationEngine failed to load component
file:///home/dally/rustqml/qmlrs/examples/factorial_ui.qml:2 module "QtQuick.Controls" version 1.2 is not installed

最佳答案

因此,我在qmlrs项目中找到了名为factorial_ui.qml的文件,并更改其内容所在的行:
更改QtQuick.Controls的版本:import QtQuick.Controls 1.1(在我的情况下是1.1,它解决了我的版本)

否则请 checkout :
https://github.com/cyndis/qmlrs/blob/master/.travis.yml

language: rust
install:
  - sudo add-apt-repository "deb mirror://mirrors.ubuntu.com/mirrors.txt trusty main restricted universe multiverse" -y
  - sudo apt-get update -qq
  - sudo apt-get install -qq libqt5core5a libqt5gui5 libqt5quick5 libqt5qml5 qtbase5-dev qtdeclarative5-dev cmake

安装它们在项目中的需求;

我知道我的解决方案是快速破解以使其正常运行。但是,嘿,我正在使用Rust中的GUI运行:)

09-06 06:26