简体   繁体   中英

Qt Creator: how to create Qt6 project?

I have installed Qt 6.0.3 and 6.1.0. 在此处输入图像描述

And I want to create Qt 6 Quick project. I start Qt Creator, click "New", "Qt Quick Application - Empty", "Choose...".

Then I type the name of my project and click "Next".

On the "Build System" step I select any build system(qmake, CMake or QBS, it does not affect the next step) and click "Next".

On the next step "Details" there is a drop-down with a list of available Qt versions. But it does not contain Qt 6! 在此处输入图像描述

How to create Qt 6 Qt Quick project?

Latest Qt Creator's (4.14.2 at the time of answering) new project assistant does not provide the option to require Qt 6 as a minimal version yet. There is an open bug about the missing feature in Qt Bug Tracker : New project assistant: no minimal Qt version >= 6.0

However, as @JarMan already commented you actually configure your project for specific kit and selecting eg Qt 6.0.3 kit means that you configure and build your application against that Qt version.

In fact, minimal Qt version selection in Qt Quick application wizard affects versions of the QML import statements used in generated QML files.Eg selecting Qt 5.12 as minimal version means that you get import QtQuick 2.12 and import QtQuick.Window 2.12 written to your main.qml . And selecting Qt 5.15 as minimal version means getting import QtQuick 2.15 and import QtQuick.Window 2.15 , and so on.

In Qt 6 version numbers may be omitted from imports in QML. If the version is omitted, the latest version will be used.

Most probably it means that when Qt Creator starts supporting Qt 6 as minimal version respective generated import statements will be import QtQuick and import QtQuick.Window .

You can actually edit your generated Qt Quick application so that you manually remove version numbers from import statements if you wish. It will turn your application to minimal Qt6 application because that application cannot be built with Qt5 kits anymore.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM