New Qt Extension for Visual Studio Code 1.0 published!
Visual Studio Code 1.0的新Qt扩展发布!
September 10, 2024 by Jörg Bornemann | Comments
2024年9月10日由Jörg Bornemann发表|评论
We're happy to announce the first 1.0 release of our Qt Extension for Visual Studio Code!
我们很高兴地宣布Visual Studio Code Qt扩展的第一个1.0版本!
We are excited about expanding Qt's availability across various IDEs to provide better support for specific use cases and to empower users to leverage their favorite tools while using the Qt technology stack. Visual Studio Code supports a wide range of programming languages, making it suitable for projects using technologies in addition to Qt. This integration allows users to effortlessly incorporate Qt into their preferred development environment, or they can opt for Qt Creator for a comprehensive, out-of-the-box Qt development solution, which continues to be actively developed as well.
我们很高兴能在各种IDE中扩展Qt的可用性,为特定用例提供更好的支持,并使用户在使用Qt技术栈时能够利用他们最喜欢的工具。Visual Studio Code支持多种编程语言,使其适用于使用Qt以外技术的项目。这种集成允许用户轻松地将Qt整合到他们喜欢的开发环境中,或者他们可以选择Qt Creator来获得全面的、开箱即用的Qt开发解决方案,该解决方案也将继续积极开发。
The Qt Extension for Visual Studio Code allows you to harness the power of Qt in the world of Visual Studio Code. It provides QML syntax highlighting, refactoring, and code completion, ensuring a smoother and faster coding experience for all your Qt 6 projects when developing QML applications. The extension integrates with CMake, making it easy to build Qt projects and debug Qt's C++ types. You can also use Qt Widgets Designer to build your Qt Widget UIs visually. Additionally, Qt documentation is integrated and visible side-by-side with your code editor in VS Code.
Visual Studio代码的Qt扩展允许在Visual Studio代码世界中利用Qt的力量。它提供QML语法突出显示、重构和代码完成,确保在开发QML应用程序时为所有Qt 6项目提供更流畅、更快的编码体验。该扩展与CMake集成,使构建Qt项目和调试Qt的C++类型变得容易。还可以使用Qt Widget设计器直观地构建Qt Widget UI。此外,Qt文档与VS code中的代码编辑器集成在一起,并排可见。
Visit the Visual Studio Marketplace and experience our new extension!
访问Visual Studio市场,体验我们的新扩展!
Installation
安装
Qt Language Server
Qt语言服务器
The Qt Extension for Visual Studio Code utilizes the new Qt Language Server from Qt 6.8 to provide support for the QML language. Even if your project is based on an older version of Qt 6, the Qt Language Server from 6.8 will be compatible with it. The extension will automatically detect and use the latest installed Qt Language Server for all Qt 6 versions.
Visual Studio代码的Qt扩展利用Qt 6.8中的新Qt语言服务器为QML语言提供支持。即使项目基于旧版本的Qt 6,6.8版本的Qt语言服务器也将与之兼容。该扩展将自动检测并使用所有Qt 6版本的最新安装Qt语言服务器。
You can find the Qt Language Server component in the Qt Installer under Qt → Qt 6.8.0 → Additional Libraries → Qt Language Server.
可以在Qt安装程序中的Qt→Qt 6.8.0→附加库→Qt语言服务器下找到Qt语言服务器组件。
Qt Framework
Qt框架
In addition to Qt Language Server 6.8, you will need to have the Qt 6 framework installed. Qt can be found in the Qt Installer under Qt → Qt 6.x.x.
除了Qt语言服务器6.8,还需要安装Qt 6框架。Qt可以在Qt安装程序中的Qt→Qt 6.x.x下找到。
See the complete Qt installation instructions.
请参阅完整的Qt安装说明。
Install Qt Extension for Visual Studio Code
为Visual Studio Code安装Qt扩展
Qt Extension for Visual Studio Code is an extension pack. By installing it, you get complete Qt support in VS Code.
Visual Studio代码的Qt扩展是一个扩展包。通过安装它,可以在VS Code中获得完整的Qt支持。
Install the Qt Extension via the Visual Studio MarketPlace.
通过Visual Studio MarketPlace安装Qt扩展。
CMake and CMake Tools extensions will also be installed automatically as dependencies.
CMake和CMake工具扩展也将作为依赖项自动安装。
Setup
设置
Tell the extension where Qt is installed.
告诉扩展Qt的安装位置。
Run "Qt: Register Qt Installation" via the command palette.
通过命令面板运行“Qt:注册Qt安装”。
This creates a bunch of CMake kits that can be used in your projects.
这将创建一组可用于项目的CMake工具包。
The kits are stored in your user-local kits file, which can be opened with the command "CMake: Edit User-Local CMake Kits".
这些工具包存储在用户本地工具包文件中,可以使用命令“CMake:编辑用户本地CMake工具包”打开该文件。
Usage
使用
Open the folder of a Qt project and select one of the Qt kits. Build and run your project with "CMake: Build" and "CMake: Run without Debugging".
打开Qt项目的文件夹,选择一个Qt工具包。使用“CMake:Build”和“CMake:run without Debugging”构建和运行项目。
Debugging C++ Applications
调试C++应用程序
To debug a Qt project, open the "Run and Debug" view and click on "Create a launch.json file". The extension provides new launch templates by clicking on "Show all automatic debug configurations" and then selecting "Add Configuration...".
要调试Qt项目,请打开“运行和调试”视图,然后单击“创建launch.json文件”。该扩展通过单击“显示所有自动调试配置”,然后选择“添加配置…”来提供新的启动模板。
The Qt configurations for launch.json ensure that the correct run environment is set, which is especially important for Windows.
launch.json的Qt配置确保设置了正确的运行环境,这对Windows尤为重要。
Qt Quick
Qt Quick projects benefit from using the QML language server, which provides semantic highlighting, code completion, and refactoring functionality. Make sure to install the Qt Language Server as instructed.
Qt Quick项目受益于使用QML语言服务器,该服务器提供语义突出显示、代码完成和重构功能。确保按照指示安装Qt语言服务器。
In the future, we plan to automatically download the latest stable release of the Qt Language Server from a Qt server.
未来,我们计划从Qt服务器自动下载Qt语言服务器的最新稳定版本。
Qt Widgets
For traditional C++ Qt Widgets development, the Qt Extension for Visual Studio Code provides syntax highlighting for .ui files and an option to open Qt Widgets Designer to work with .ui files using a visual editor.
对于传统的C++ Qt Widgets开发,Visual Studio Code的Qt扩展为.ui文件提供了语法高亮显示,并提供了一个选项,可以打开Qt Widgets设计器,使用可视化编辑器处理.ui文件。
Feedback
反馈
We would love to hear your feedback and any ideas for further development! Click the survey below to take part in the improvement.
我们很乐意听取反馈和任何进一步发展的想法!点击下面的调查以参与改进。
If you encounter any issues with the extension you can report those to the Qt Bug Tracking System.
如果在扩展中遇到任何问题,可以向Qt Bug跟踪系统报告。