Qt latest version installation tutorial and domestic image acceleration method

Title: Qt latest version installation tutorial and domestic image acceleration method

Introduction: This article will introduce you how to use domestic mirrors to accelerate the installation of the latest version of Qt. Qt is a cross-platform C++ application development framework with powerful functions and rich toolset. Through the following steps, you can quickly install Qt and use domestic mirrors to speed up the download process and improve installation efficiency.

Tencent mirror: https://mirrors.cloud.tencent.com/qt/
Alibaba Cloud mirror: https://mirrors.aliyun.com/qt/

If using a mirror to obtain metafiles fails during the installation process, please replace the mirror.

centos install qt

Step 1: Download the Qt online installation tool

Visit the Qt official website https://www.qt.io/download-open-source to download Qt Online Installer. This tool helps you choose which Qt components and versions to install.

Step 2: Add execution permissions in Linux

If you are installing on a Linux system, open a terminal and add execute permissions to the downloaded Qt Online Installer file. Enter the following command in the terminal:

chmod +x qt-unified-linux-x64-4.6.0-online.run

This will give the file execution permissions and facilitate the subsequent installation process.

Step 3: Use mirroring to speed up installation in Windows

If you are installing on a Windows system, please directly open the command prompt window and run the qt-unified-windows-x64-4.6.0-online.exe program with startup parameters.

qt-unified-windows-x64-4.6.0-online.exe --mirror https://mirrors.cloud.tencent.com/qt/

When updating, you can use this tool to speed up the download: MaintenanceTool.exe --mirror https://mirrors.cloud.tencent.com/qt/

Step 4: Install Qt

The following steps will take the Linux system as an example, and use the domestic Tencent image to speed up the download process. Please make appropriate adjustments based on your actual situation.

  1. Open a terminal and go to the directory where Qt Online Installer is located.

  2. Run the following command to specify the use of Tencent image for installation:

./qt-unified-linux-x64-4.6.0-online.run --mirror https://mirrors.cloud.tencent.com/qt/

Qt Online Installer will start and display the installation interface.
Qt Online Installer will start and display the installation interface.
Fill in the account and password registered on the Qt official website, click "Next" to continue and verify the username and password information. (shown in the picture above)

  • Qt Online Installer will start and display the installation interface. Based on your needs, select the Qt components and versions to install.

  • Click "Next" to continue, read and accept the license agreement.

  • When selecting an installation path, you can keep the default settings or change them as needed.

  • Click "Next" to continue and Qt Online Installer will start downloading and installing the selected components.

  • After the installation is complete, you can choose to start Qt Creator (Qt's integrated development environment) or exit the installer.

Through the above steps, you can successfully install Qt and speed up the download process, providing a stable and efficient development environment for subsequent development work.

Step 5: Install build-essential and gdb

apt-get install -y build-essential gdb

"apt-get install -y build-essential gdb" is a Linux command used to install packages on Debian and Ubuntu systems. Let's explain step by step what this command means:

  • apt-getis a command line tool for managing software packages on Debian and Ubuntu systems.
  • installIt is a subcommand of apt-get, used to install software packages.
  • -yis an option that automatically answers "yes" during the installation process, eliminating the need for the user to manually confirm the installation.
  • build-essentialis the name of a software package. This software package is a collection of basic tools for software development, including compilers, standard libraries, and other necessary tools.
  • gdbis the name of another package. It is the abbreviation of GNU Debugger, a tool for debugging programs.

Therefore, the purpose of this command is to install the basic toolset (build-essential) and the GNU debugger (gdb) required to compile software on Debian and Ubuntu systems. These tools are very useful for software development and debugging, especially when compiling and debugging C or C++ programs.

There is no "build-essentials" package in CentOS, RHEL. We can install the equivalent software required to build the software:
yum install -y gcc gcc-c++ kernel-devel make gdb
If we need a complete build suite for CentOS, RHEL, we can install the development tools as follows:
yum groupinstall "Development Tools"

Step 6: Open Qt Creator and test whether the IDE can compile the project normally

Insert image description here
Open the installed Qt Creator and create a new Qt Console Application console project for testing.
The project name for this example is Test

The contents of the Test.pro file are as follows:

QT = core network

CONFIG += c++17 cmdline

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
        main.cpp

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

DESTDIR = $$PWD/bin

The contents of the main.cpp file are as follows:

#include <QCoreApplication>
#include <QtCore>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    qDebug() << "HelloWorld";
    return a.exec();
}

Run the program to output HelloWorld printing information.

This article introduces you to how to use domestic mirrors to accelerate the installation of the latest version of Qt. By downloading the Qt Online Installer tool and setting it accordingly according to your operating system, you can quickly install Qt and start application development. Using domestic mirrors to speed up the download process can greatly improve installation efficiency and allow you to obtain the required Qt components and versions faster. I wish you success in Qt development!

Guess you like

Origin blog.csdn.net/cheungxiongwei/article/details/131703475