一、下载
Index of /archive/qt/5.12/5.12.8
linux下载.run即可
二、安装
1.下载完成后在终端打开下载的路径
2.赋予执行权限 并执行
sudo chmod +x qt-opensource-linux-x64-5.12.8.run
./qt-opensource-linux-x64-5.12.8.run
3..之后的步骤与Windows下安装一致
三、命令行安装(可选)
除了直接下载.run文件安装外,还可以直接使用apt命令行来安装Qt,通常使用在开发版测试环境中
1.安装Qt的基本库与IDE
sudo apt-get install qt5-default
sudo apt-get install qtcreator
2.安装qmake Cmake
sudo apt-get install qt5-qmake
sudo apt install cmake
3.安装g++,gcc
sudo apt install g++ gcc
4.安装QtQucik库 用来开发qml页面
sudo apt-get install qtdeclarative5-dev
5.安装QMLmodule
sudo apt install qml-module-qtquick-controls2
6.安装QtMultimedia库
sudo apt-get install qtmultimedia5-dev
sudo apt-get install libqt5multimedia5-plugins
7.其他开发库
sudo apt install qml-module-qtquick-extras
sudo apt install qml-module-qt-labs-platform
8.编译安装mqtt
cd /home/linaro/kaifa
git init
git clone git://code.qt.io/qt/qtmqtt.git
git branch -a
cd qtmqtt/
git checkout origin/5.15.2
qmake
make -j8
等待编译完成后安装
make install
9.编译QtLocation 解决Unknown module(s) in QT: location-private positioning-private
cd /home/linaro/kaifa
git init
git clone git://code.qt.io/qt/qtlocation.git
git branch -a
cd qtlocation/
git checkout origin/5.15
mkdir build
cd build
sudo apt install qtbase5-private-dev qtdeclarative5-private-dev
qmake ../qtlocation.pro
make -j8
等待编译完成后安装
make install
10.位置定位相关
sudo apt install qtbase5-private-dev
sudo apt install qtlocation5-dev qtpositioning5-dev
安装qt例子
apt-get install qtbase5-examples
总结
1.在qt的pro文件缺少Qt+=的模块时 需要源码编译或使用命令直接安装
直接安装:
Unknown module(s) in QT: webchannel webengine
sudo apt install qtwebengine5-dev
Unknown module(s) in QT: webview
sudo apt install libqt5webview5-dev
下载源码编译:安装mqtt
2.在qml中import导入的包可以直接使用命令下载
QML module not found(QtQuick.Controls)
apt-get install qml qmlscene
apt-get install qtdeclarative5-dev
apt -y install qml-module-qtquick-controls
apt -y install qml-module-qtquick-controls2
QML module not found(QtQuick.Dialogs)
apt install qml-module-qtquick-dialogs
module "QtQuick.Shapes" is not installed
apt install qml-module-qtquick-shapes
"Qt.labs.folderlistmodel" is not installed
apt install qml-module-qt-labs-folderlistmodel
"Qt.labs.settings" is not installed
apt install qml-module-qt-labs-settings
“QtWebChannel” is not installed
sudo apt install qml-module-qtwebengine
sudo apt install qml-module-qtwebview文章来源:https://www.toymoban.com/news/detail-402866.html
sudo apt install qml-module-qtwebchannel文章来源地址https://www.toymoban.com/news/detail-402866.html
如果在运行某些程序报错原因是缺少某些库
可用sudo apt install lib* 或者qml*来模糊匹配可能需要的库(根据遇到的错误报告来安装)
到了这里,关于Linux(Ubuntu20)下安装Qt5.12.8 包含直接命令行安装(2)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!