Qt Support

Qt Support extension, supports creating/importing CMake-based Qt projects, adding common Qt components such as resource files, translation files, classes, designer form classes, etc. Use the Shift+F1
shortcut to view Qt documentation, run Qt Designer, Qt Linguist, and other tools. This extension depends on several other extensions:
- CMake Tools
KylinIdeTeam.kylin-cmake-tools
- Kylin clangd
kylinideteam.kylin-clangd
- C/C++ Debug
kylinideteam.cppdebug
- CMake Intellisense
kylinideteam.cmake-intellisence
Feedback
If you encounter any issues, please go to Gitee to provide feedback.
Notes
Qt installation location: qt-support.qtInstallDirectories
The extension will scan the default installation location of Qt at startup. If your installed Qt is not found, you can set this option to specify the Qt installation location. This location should be set to the root directory of the Qt installation, such as D:\apps\Qt
, /home/user/.Qt
, etc.
Required software
ninja-build
: Only with the ninja generator can CMake generate the compile_commands.json
file needed by clangd on all platforms, so please install this software first.
cmake
: Please install version 3.20 or higher of CMake.
- About Qt documentation: If your Qt is installed via the Qt online installer, the documentation is likely already installed. If you are on a Linux platform and your Qt is installed via the system package manager, you generally need to install the Qt documentation separately.
- For systems based on the apt package manager:
sudo apt install qt5-doc qt5-doc-html
- For systems based on the yum/dnf package manager:
sudo dnf install qt5-qtbase-doc qt5-qtdoc
- Other software
- For systems based on the apt package manager:
sudo apt install build-essential ninja-build gdb cmake clangd qt5-default qttools5-dev-tools qttools5-dev qt5-qmake
- For systems based on the yum/dnf package manager:
sudo dnf install gcc gcc-c++ make-devel ninja-build gdb cmake clang-tools-extra qt5-devel
- On Windows, Qt is generally installed via the online installer. Additionally, please install tools like
ninja-build cmake clangd
yourself.
About Qt Kit
After scanning Qt, a qt-kits.json
file will be generated in the system cache. The CMake Tools extension will read this configuration file and display it in the Kit list of the CMake Tools extension, making it easy to select different versions of Qt. The Qt Kits provided by this extension are prefixed with [Qt Support]
. Additionally, this extension provides a button on the left side of the status bar for selecting Qt Kits.
Features
This extension provides the following features:
- Qt project creation
- Import CMake-based Qt projects
- Add Qt project files
- Designer Form Class
- Designer Form
- C++ class
- Translation
- Resource
Shift + F1
shortcut to view Qt documentation
- qrc resource editor
- Open .ui files with Qt Designer
- Open .ts files with Qt Linguist
- Open projects with Qt Creator
- Open projects with Visual Studio
Create and import projects
You can use the create/import project feature in the following four ways:
- Search for the command
Qt Support: Create Qt Project...
in the command palette
- When no folder is open, press
Ctrl + Shift + E
to open the explorer, and click the Create Qt Project
button in the welcome view
- When a folder is open, there is a
Create Qt Project
option in the right-click menu of the explorer
- Click the File menu > New File, and select
Create Qt Project
in the Quick Pick that appears
Add Qt components
When a Qt project is open, press Ctrl + Shift + E
, right-click in the explorer of VSCode, and there will be a context menu Add new file to Qt project
. Select the corresponding submenu to add the related type of file to the project.
Shift + F1
shortcut to view Qt documentation
After selecting the Qt Kit, open a C++ file, place the cursor over the function, class, or method name you want to view the documentation for, and press the Shift + F1
shortcut to display the documentation for the corresponding symbol. The experience is similar to the F1 documentation view feature in Qt Creator. If this feature is unavailable, try the following methods:
- After placing the mouse over the function name, press
Ctrl + Shift + p
to open the command palette, search for the command Qt Support: Show symbol documentation under cursor
, and execute it.
- If the above method works, check the shortcut key configuration to see if there is a shortcut key conflict, and set it to the desired shortcut key.
Qt resource editor
This extension provides a Qt resource editor that makes it easy to edit Qt resource files. When you click on a .qrc file, VSCode will use the Qt resource editor provided by this extension to open the .qrc file by default.
You can call Qt Designer to open .ui files and call Qt Linguist to open .ts files. There are several ways to call the relevant commands:
- Right-click the corresponding type of file in the VSCode explorer, and there will be related commands in the right-click menu.
- When a .ui / .ts file is open, there will be related buttons in the editor's title bar.
- When a .ts file is open, there will also be related buttons in the editor's context menu.
- After clicking on a .ui file, a webview will be displayed, and there will be a button in the webview. Clicking the button will open Qt Designer.
Open projects with other IDEs
You can open projects with Qt Creator and Visual Studio (Windows only). When opening a project with Visual Studio, a CMakeSettings.json
file required by Visual Studio will be automatically generated, allowing you to directly run and debug CMake-based Qt applications in Visual Studio.
Press Ctrl + Shift + p
to open the command palette, search for the keyword Qt Support: Open project in
, and you will see the relevant commands.