tonka3000 / vscode-qt-tools

Qt tools extension for Visual Studio Code
MIT License
41 stars 10 forks source link
c cpp qt qt5 vscode vscode-ex

Qt Visual Studio Code Tools

This extension is work in progress, so some command/settings can change over time.

This is NOT an official tool by The Qt Company!!

This is a Qt extension for VSCode. It is designed to be a similar tool to the Qt Visual Studio Tools from The Qt Company, but it tries to cooperate with other extensions for some functionality like e.g. debugging.

The extension supports Qt file location extractions via

Choosing a different Qt version from disk via this extension is not supported!

Features

Requirements

Qt search mode

The search mode defines how this extension search the Qt binaries like qmake, Qt designer and so on.

CMake (default mode)

"qttools.searchMode": "cmake"

Extract the Qt file locations from the cmake cache (CMakeCache.txt). The cmake build directory is extracted from the VSCode extension CMake Tools setting cmake.buildDirectory. You need to configure your project for the first time and afterwards every Qt tool is found automatically (when it is installed on your disk ;-) ) otherwise the launch of commands like Launch Qt Designer will fail.

The benefit of this mode is that VSCode see the same Qt version as cmake is using, so it is automatically configured for you.

PATH

"qttools.searchMode": "path"

Search Qt in the PATH environment variable like it is done in the terminal. This mode helpful when you have a system wide Qt installation like on Linux based operating systems.

You don't need to configure anything to be able to use the commands of this extension.

Limitations

Variable substitution

The cmake.buildDirectory from cmake tools support variable substitution which looks like ${myvariable} (example ${generator}).

This extension supports every variable substitution from cmake tools when the cmake tools extension is installed and active.

If cmake tools is not active the extension will fallback to the content of the cmake.buildDirectory. In this mode only ${buildType}, ${buildKit} and ${workspaceFolder} are supported variable substitutions!

Online help

The Qt online help can be used with this extension. Right now only the latest Qt 5 version will be searched.

You have 2 commands:

By default the qt website will be opened inside VSCode itself.

The integrate webview has some limitations:

You can also turn of the embedded webview for the online help and use your external browser by setting the qttools.useExternalBrowser to true. Be aware that you will get a popup from VSCode which informs you about opening an external website. To avoid getting this popup every time just press on Configure Trusted Domains and choose trust qt.io and all its subdomains.

Troubleshooting

If you have problems with the extension just file a issue on GitHub. It's mostly a good idea to attach the log output of this extension to the issue. You can active the logger by adding "qttools.loglevel": "debug" to your settings.json file. Just copy the content of the Qt output pane into your GitHub issue.

Contributions

Pull requests are welcome :-D

License

MIT