GithubHelp home page GithubHelp logo

tonka3000 / vscode-qt-tools Goto Github PK

View Code? Open in Web Editor NEW
40.0 8.0 10.0 630 KB

Qt tools extension for Visual Studio Code

License: MIT License

TypeScript 94.64% PowerShell 1.38% JavaScript 3.98%
qt qt5 cpp c vscode vscode-ex

vscode-qt-tools's Introduction

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

  • CMake
  • PATH environment variable

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

Features

  • Support for Qt 5 and Qt 6
  • Launch Qt Designer
  • Edit .ui file in Qt Designer
  • Launch Qt Assistant
  • Launch Qt online documentation
  • Launch Visual Studio (Windows only)
  • Launch Qt Creator
    .ui and .qrc files can be opened in Qt Creator. You can also open the whole workspace in Qt Creator too.
    This extension try to detect the Qt Creator installation automatically (on Windows and MacOS). You can set the executable path via qttools.creator settings if the extension can't find Qt Creator (for whatever reason)
  • Extract the Qt file locations from the cmake cache
  • Extract the Qt file locations via PATH environment variable
  • Debugger extensions (via natvis files)
    The Qt natvis file from this extension will automatically get injected into your existing launch.json file (per default). If you don't like that feature you can turn it of via qttools.injectNatvisFile setting.
    You can also set your custom created/downloaded qt natvis file instead of the bundled one (which implement a few Qt types) by setting qttools.visualizerFile to a filepath or url (f.e. you can set qttools.visualizerFile to the natvis file from the offical Qt Visual Studio Tools https://github.com/qt-labs/vstools/blob/dev/QtVsTools.Package/qt5.natvis.xml). When you set an url, the extension will only download it ones and cache it and will use the cached local version
    NOTE: I cannot bundle the Qt Visual Studio Tools natvis file into the extension itself because of it's license restrictions (MIT vs GPL)!
  • ...

Requirements

  • You need to have the CMake Tools installed if you have activated the cmake mode, because this extension extracts some data from it!
  • C/C++ extension is highly recommended

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

  • There are some situation where the automatic detection mechanism of Qt is not working. If that is the case you can always trigger the Scan for Qt kits command in the command palette.
  • The debugger extension use normal natvis xml files (used via the launch.json setting visualizerFile from the C/C++ extension ). They work really well on windows, but on mac and linux there are some problems, because it is not based on the same implementation. If you have any problems with them create an issue on their issue tracker.

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:

  • Qt: Online help
    This will open the Qt documentation. When you are in a .cpp or .h file and your cursor is inside a text block then the command will search that word as a class in the documentation.
  • Qt: Search online help
    This command will create a textbox inside vscode where you can enter your search term. This search term will be send to the search of the Qt Documentation.

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

The integrate webview has some limitations:

  • Open the find menu via CTRL + F does not work in many scenarios, see #96307
    Most of the time it works when you can click on the document tab (Qt online help) and then press CTRL + F
  • The normal mouse-click on a link which would open a new tab also don't work
    You can click the middle mouse button on that link and it will open in your external browser.
  • No navigation buttons

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

vscode-qt-tools's People

Contributors

dependabot[bot] avatar dnsmichi avatar ecstrema avatar jannkoeker avatar kralicky avatar new-world-2019 avatar tonka3000 avatar wouterloeve avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-qt-tools's Issues

Support debug in Qt source code

You can provide a file path which contains Qt source code in setting. Then using it replaces default source file path, such as "\Users\qt\work\qt", "C:\work\build\qt5_workdir\w\s". The Qt Creator has the feature like this in Debugger.

Cannot view content of QVariant

I've setup a qt5.natvis file to see some qt debug info.

For QString and QVector it works.

However for QVariant, it doesn't show anything.
I'm in linux using gdb.

image

Cannot view content of QString

I've setup a qt5.natvis.xml file to see some qt debug info.
For QString and QVector it works.
However for QString , it doesn't show anything.

os: Window platform

image

[feature] Provide `Qt: Deploy executable` in Command Palette.

Problem to solve

For example, after building an executable depended upon Qt on Windows, here is a problem I usually face.

If I don't put the bin directory of Qt Kits into PATH environment variable, the system will pop up the error of "lack-of-dll". The solution of it is to copy those dll files that it need into the directory of executables generaeted by us. But it is quite complex for Qt, so we can use windeployqt tool to do so.

Proposal

I suggest that qttools provide a command called Qt: Deploy executable in Command Palette.

And set the configuration of deployment arguments in settings.json.

Further details

The configuration of deployment arguments in settings.json could be like:

{
  "qttools.deployqtArgs": {
    "executablePath": "${command:cmake.launchTargetPath}"
    "windeployqt": [
      "--verbose 1"
      "--no-translation",
      "--no-opengl-sw"
    ],
    "macdeployqt": [],
    "androiddeployqt": []
  }
}

QString: No DisplayString and StringView view on Mac

I'm not getting the DisplayString nor the StringView in my Watch window, only a {...} using both the default and the one from MS. The "size" and "referenced" show up on expansion.

VSCode info:
Version: 1.54.1
Commit: f30a9b73e8ffc278e71575118b6bf568f04587c8
Date: 2021-03-04T22:42:18.719Z
Electron: 11.3.0
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Darwin x64 19.6.0

Add variable substitution limitations to readme

Right now it is not possible to support most of the variable substitutions from cmake tools because there is no API to get the values (see #17 (comment))

Only buildType and buildKit can be supported because there are commands to get the values.

So this information should be visible in the limitations section in the readme

[feature] Provide "Qt Linguist" in Command Palette and Right Click Menu.

Feature Request

  • When we press "Ctrl+Shift+P" and type "Qt" in Command Palette, it shows some options, including:

    • Qt: Launch Qt Designer
    • Qt: Launch Qt Creator
    • Qt: Launch Qt Assistant
  • When we "right click" the *.ui file, it shows two options in Right Click Menu:

    • Edit in Qt Creator
    • Edit in Qt Designer

I hope this extension provide "Qt Linguist" in the above two places.

  • Providing "Qt: Launch Qt Linguist" in command palette.
  • When we right click the *.ts, *.qph, *.po, *.xlf files, it should show "Edit in Qt Linguist".

Screenshots

image
image

Versions

  • VSCode: 1.68.0
  • Qt tools: 0.11.0

[question] What is the mechanism of `"qttools.searchMode": "cmake"`?

Excuse me, I want to verify the mechanism of "qttools.searchMode": "cmake". Here is my opinion:

  1. If we use find_package(Qt6) or find_package(Qt5) in CMakeLists.txt, then the Cache Variable Qt6_DIR or Qt5_DIR will be written in the CMakeCache.txt after configuring the CMake project.

  2. Then qttools will use this Qt6_DIR or Qt5_DIR to locate some tools such as designer.exe relatively.

Am I correct?

[feature] Provide International Translations of the plugin.

I translate the followings in "zh-tw(cht)" locale.

Command

  • Scan for Qt Kit: 掃描 Qt 套件
  • Launch Qt Creator: 啟動 Qt Creator
  • Launch Qt Designer: 啟動 Qt Designer
  • Launch Qt Assistant: 啟動 Qt Assistant
  • Launch workspace in Qt Creator: 在 Qt Creator 中啟動工作區
  • Launch in Visual Studio: 在 Visual Studio 中啟動
  • Delete natvis download cache: 刪除 natvis 下載快取
  • Online help: 線上說明文件
  • Search Online help: 搜索線上說明文件

Right Click Menu

  • Edit in Qt Creator: 在 Qt Creator 中編輯
  • Edit in Qt Designer: 在 Qt Designer 中編輯

Settings.json

  • Qttools: Creator

    • absolute filepath to the Qt Creator executable.
      • Qt Creator 執行檔的絕對路徑。
  • Qttools: Extra Directories

    • Extra search directories for Qt tools. Required when the Qt tools like designer are not installed next to qmake.
      • Qt 工具額外的搜索路徑。當 Qt 工具像是 designer 不是安裝在 qmake 旁邊時需要使用。
  • Qttools: Inject Natives File

    • automatically inject the natvis.xml of Qt into existing launch.json entries.
      • 自動注入 Qt 的 natvis.xml 到現有的 launch.json 項目。
  • Qttools: Loglevel

    • set the loglevel.
      • 設定記錄層級。
  • Qttools: Search Mode

    • Qt search mode.
      • Qt 搜索模式。
    • Search Qt based on cmake. The cmake project needs to be configured before Qt can be found.
      • 基於 CMake 搜索 Qt。必須先設定好 CMake 專案才能夠找到 Qt。
    • Search Qt in the PATH variable.
      • 在 PATH 變數中搜索 Qt。
  • Qttools: Use External Browser

    • use external browser for online help.
      • 使用外部瀏覽器來查看線上說明文件。
  • Qttools: Visualizer File

    • filepath or url to a natvis.xml file which will be used instead of the bundled one. You can use f.e. https://code.qt.io/cgit/qt-labs/vstools.git/plain/src/qtvstools/qt5.natvis.xml when you want to use the file from Qt Visual Studio tools
      • 使用的 natvis.xml 檔案的檔案路徑或 url 網址,而不是捆綁的選項。當你想要從 Qt Visual Studio tools 中使用它時,你可以使用像是 https://code.qt.io/cgit/qt-labs/vstools.git/plain/src/qtvstools/qt5.natvis.xml

Add diagnostic mode

For now it is really hard to trace down a problem when Qt is not found on a user device. Because there are so many variantions in Qt packaging, a diagnostic mode should be available, which can be opt-in by the user to make easier to see what the problem is (hopefully).

The log output should be good enough that it can be pasted on GitHub.

Add debugger extension support

f.e. QString is based on pimpl idom, so it is extremely hard to see the content of it by just visualize the members.

We should add debugger extension support via natvis files, because it is directly support by the C/C++ extension from Microsoft through the visualizerFile property in the launch.json file. The extension should the that property automatically.

The Visual Studio Qt tools use also natvis files, but the license (GPL) restriction make it impossible to use it directly, so writing our own one is the only good option here.

Add support for finding Qt without cmake configure

Right now the extension supports "just" cmake (directly via cmake files or via cmake extension) and has the big benfit that the extension see exactly the same as cmake itself. But there is the limitation that the user must configure cmake (cmake -H. ......) before the extension could find Qt itself.

This limitation will be "seen" by the user if the "OS use" a shared Qt version across multiple applications.
On Windows and Mac there is typically not a globally available Qt version, but e.g. Linux often has a shared Qt version. From a technical perspective all OS can have a global qt version.

This limitation affects tools like

  • Qt Designer
  • qmake
  • Qt linguist

because they are typically bundled with Qt itself.

This limitation don't affects

  • Qt Creator

Search via PATH directly

One alternative would be to directly search in the PATH environment variable for qmake. This would make it possible to find Qt without the configure stage from cmake but the downside is that it makes the finding of Qt non deterministic when the user use cmake and the search via PATH, because the found path could different here.

Bad scenario

  • user starts VSCode
  • extension find Qt via the PATH directly
  • use configure cmake and has choosen a different Qt version (e.g. via package managers like conan)
  • user has now a different qmake version as before the cmake configure, which could lead to all kinds of problems

Open Points

  • Add different modes?

    cmake vs PATH mode
  • Ignore the fact that there can be different version?

    Would not be a good default setting

Unable to find Qt

Hello! This extension cannot detect Qt. But I have it installed and I can build Qt applications (I also have vscode-cmake-tools installed). I am using Arch Linux and QtCreator with other tools just available from PATH. Could you add automatic search in system PATH?

Qt not found is visible, but Qt is found on arch distro

Summary

Qt not found is visible in the status bar, but Qt is found and works normally.

What is the current bug behavior?

Trigger Scan for Qt don't change the visible state in the status bar.

What is the expected correct behavior?

Display Qt found

Relevant logs and/or screenshots

See #51 (comment)

Possible fixes

Compiling it on the target machine fix the problem. Maybe upgrade typescript and webpack could help.

cannot scan for QT

I'm just new to both QT and this extension and my tool just cannot scan for qt, can anyone help me with this ?

Automatic natvis injection makes it impossible to clean my git workspace

Summary

While this extension was enabled, it would insist that the launch.json file be formatted on save, with no setting to turn it off, making it so I could not make my git workspace clean.

Steps to reproduce

I don't know how to reproduce it from scratch, but I do know it was happening, and that it didn't happen with extensions off, and I disabled extensions one by one until I disabled Qt tools and the errant behavior stopped. If I turned Qt tools back on, it wouldn't always reformat it right away. Usually it would inexplicably wait until I turned another extension back on to format launch.json.

What is the current bug behavior?

Every time I would attempt to revert launch.json, it would instantly be returned to its formatted state, removing all of my comments, reindenting everything, and most pressingly, making it impossible for me to make my git workspace clean so I could rebase.

What is the expected correct behavior?

It shouldn't be formatting anything without my permission or command! And if it must, there should be a way to turn it off. I despise when IDEs insist on formatting my code for me. I have all of that turned off.

Relevant logs and/or screenshots

update state of ExtensionManager
inject natvis file into launch.json
update state of ExtensionManager

Possible fixes

Make the natvis injection (which is apparently what it was doing, given the logs, and not just randomly formatting the file) a command instead of automatic. And especially don't make it automatic on save. Barring that, make it a setting I can turn off.

First time project configuration

The documentation mentions the need to configure the project for the first time.

For someone new to VS Code, CMake Tools and QT VS Tools etc.. How is this accomplished?

Qt not found when cmake.buildDirectory uses variables

The extension can not find Qt in our case because the cmake.buildDirectory uses variables. In our example the buildDirectory is ${workspaceFolder}/../CMakeBuild/vscode/${buildKit}/${buildType}

The error message reported:
ENOENT: no such file or directory, watch 'c:\Projects\XXX/../CMakeBuild/vscode/${buildKit}/${buildType}'

Opening wrong file from the explorer

When trying to open a file from explorer widget via the context menu in Qt Creator or Qt Designer, the wrong file opens.

Steps to reproduce

  1. Open any file in editor.
  2. Navigate to file explorer and use right mouse click on any file that not currently opened.
  3. Select "Edit in Qt Creator" or "Edit in Qt Designer"

Expected behavior

The file selected in the explorer widget opens.

Current behavior

The extension tried to open currently opened file in editor instead.

Compiled succeed, but failed to link.

I had installed Qt6 with llvm-mingw 64-bit kit on Windows 11.
And I create a Qt project on VSCode, It compiled succeed but failed to link.

[main] Building folder: FramelessWindow 
[build] Starting build
[proc] Executing command: "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" --build c:/Users/tgs/Documents/Qt/FramelessWindow/build --config Debug --target all -j 8 --
[build] [  0%] Built target FramelessWindow_autogen_timestamp_deps
[build] [ 16%] Built target FramelessWindow_autogen
[build] [ 33%] Linking CXX executable FramelessWindow.exe
[build] ld.lld: error: undefined symbol: __declspec(dllimport) QObjectData::dynamicMetaObject() const
[build] >>> referenced by C:\Users\tgs\Documents\Qt\FramelessWindow\build\FramelessWindow_autogen/UVLADIE3JM/moc_FramelessWindow.cpp:78
[build] >>>               objects.a(mocs_compilation.cpp.obj):(FramelessWindow::metaObject() const)
[build] 
[build] ld.lld: error: undefined symbol: __declspec(dllimport) QMainWindow::qt_metacast(char const*)
[build] >>> referenced by C:\Users\tgs\Documents\Qt\FramelessWindow\build\FramelessWindow_autogen/UVLADIE3JM/moc_FramelessWindow.cpp:86
[build] >>>               objects.a(mocs_compilation.cpp.obj):(FramelessWindow::qt_metacast(char const*))
[build] 
[build] ld.lld: error: undefined symbol: __declspec(dllimport) QMainWindow::qt_metacall(QMetaObject::Call, int, void**)
[build] >>> referenced by C:\Users\tgs\Documents\Qt\FramelessWindow\build\FramelessWindow_autogen/UVLADIE3JM/moc_FramelessWindow.cpp:91
[build] >>>               objects.a(mocs_compilation.cpp.obj):(FramelessWindow::qt_metacall(QMetaObject::Call, int, void**))
[build] 
[build] ld.lld: error: undefined symbol: __declspec(dllimport) QMainWindow::staticMetaObject
[build] >>> referenced by C:/Users/tgs/anaconda3/Library/include/qt/QtCore/qobjectdefs.h:577
[build] >>>               objects.a(mocs_compilation.cpp.obj):(QMetaObject const* QMetaObject::staticMetaObject<QMainWindow::staticMetaObject>())
[build] 
[build] ld.lld: error: undefined symbol: QMainWindow::event(QEvent*)
[build] >>> referenced by objects.a(mocs_compilation.cpp.obj):(vtable for FramelessWindow)
[build] 
[build] ld.lld: error: undefined symbol: QObject::eventFilter(QObject*, QEvent*)
[build] >>> referenced by objects.a(mocs_compilation.cpp.obj):(vtable for FramelessWindow)
[build] 
[build] ld.lld: error: undefined symbol: QObject::timerEvent(QTimerEvent*)
[build] >>> referenced by objects.a(mocs_compilation.cpp.obj):(vtable for FramelessWindow)
[build] 
[build] ld.lld: error: undefined symbol: QObject::childEvent(QChildEvent*)
[build] >>> referenced by objects.a(mocs_compilation.cpp.obj):(vtable for FramelessWindow)
[build] 
[build] ld.lld: error: undefined symbol: QObject::customEvent(QEvent*)
[build] >>> referenced by objects.a(mocs_compilation.cpp.obj):(vtable for FramelessWindow)
[build] 
[build] ld.lld: error: undefined symbol: QObject::connectNotify(QMetaMethod const&)
[build] >>> referenced by objects.a(mocs_compilation.cpp.obj):(vtable for FramelessWindow)
[build] 
[build] ld.lld: error: undefined symbol: QObject::disconnectNotify(QMetaMethod const&)
[build] >>> referenced by objects.a(mocs_compilation.cpp.obj):(vtable for FramelessWindow)
[build] 
[build] ld.lld: error: undefined symbol: QWidget::devType() const
[build] >>> referenced by objects.a(mocs_compilation.cpp.obj):(vtable for FramelessWindow)
[build] 
[build] ld.lld: error: undefined symbol: QWidget::setVisible(bool)
[build] >>> referenced by objects.a(mocs_compilation.cpp.obj):(vtable for FramelessWindow)
[build] 
[build] ld.lld: error: undefined symbol: QWidget::sizeHint() const
[build] >>> referenced by objects.a(mocs_compilation.cpp.obj):(vtable for FramelessWindow)
[build] 
[build] ld.lld: error: undefined symbol: QWidget::minimumSizeHint() const
[build] >>> referenced by objects.a(mocs_compilation.cpp.obj):(vtable for FramelessWindow)
[build] 
[build] ld.lld: error: undefined symbol: QWidget::heightForWidth(int) const
[build] >>> referenced by objects.a(mocs_compilation.cpp.obj):(vtable for FramelessWindow)
[build] 
[build] ld.lld: error: undefined symbol: QWidget::hasHeightForWidth() const
[build] >>> referenced by objects.a(mocs_compilation.cpp.obj):(vtable for FramelessWindow)
[build] 
[build] ld.lld: error: undefined symbol: QWidget::paintEngine() const
[build] >>> referenced by objects.a(mocs_compilation.cpp.obj):(vtable for FramelessWindow)
[build] 
[build] ld.lld: error: undefined symbol: QWidget::mousePressEvent(QMouseEvent*)
[build] >>> referenced by objects.a(mocs_compilation.cpp.obj):(vtable for FramelessWindow)
[build] 
[build] ld.lld: error: undefined symbol: QWidget::mouseReleaseEvent(QMouseEvent*)
[build] >>> referenced by objects.a(mocs_compilation.cpp.obj):(vtable for FramelessWindow)
[build] 
[build] ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
[build] clang-17: error: linker command failed with exit code 1 (use -v to see invocation)
[build] mingw32-make[2]: *** [CMakeFiles\FramelessWindow.dir\build.make:144: FramelessWindow.exe] Error 1
[build] mingw32-make[1]: *** [CMakeFiles\Makefile2:85: CMakeFiles/FramelessWindow.dir/all] Error 2
[build] mingw32-make: *** [Makefile:90: all] Error 2
[proc] The command: "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" --build c:/Users/tgs/Documents/Qt/FramelessWindow/build --config Debug --target all -j 8 -- exited with code: 2
[driver] Build completed: 00:00:00.811
[build] Build finished with exit code 2

Why it use Visual Studio to build the project? I had choose the llvm kit.

Can‘t open *.ui file with "Qt: Edit in Qt Designer" command.

Can‘t open *.ui file with "Qt: Edit in Qt Designer" command, but OK with right click and pick "Edit in Qt Designer". When I use the command an error window poped out:

Command"Qt: Edit in Qt Designer” lead to error (Running the contributed command: 'qttools.currentfileindesigner' failed.)

I've checked the issue#51, seems it is not concerning a cmake problem for it did work in a way. I tried both qt5 and qt6 on my both computers, both got the error.

Is there any difference excuting the same command between typing command and right click pick?

Online help for methods

Currently, the Qt: Online help seems to work for classes, but not for methods. For example, if I highlight mid in the following code:

QString a;
a.mid(3);

Then select Qt: Online help, I get 404 - Page Not Found because the URL it opens is:

https://doc.qt.io/qt-5/mid.html

Whereas it should be:

https://doc.qt.io/qt-5/qstring.html#mid

I don't know how this Qt plugin works, but it obviously can't work out that URL just by looking at the highlighted text, as that doesn't include QString at all.

However, Intellisense does know exactly which method is being referred to:

image

Is there a way to hook in to Intellisense to get the info needed to create the correct URL?

Provide create ui class in explorer

Problem to solve

I want to create ui class(generate .h, .cpp, .ui) in explorer, right click directory item in explorer.
Something like that cpp-class-creator, but for qt template in qt creator, like(widget, dialog, mianwindow ...).

Proposal

Further details

Links / references

[feature] Support more Variable Substitution of `cmake tools`.

Problem to solve

According to the README.md, it looks like qt-tools only supports ${buildType}, ${buildKit}, and ${workspaceFolder} now. If we use another Variable Substitution in cmake.buildDirectory, the bottom status bar of qt-tools will show "Qt not found". Therefore, we cannot use the command such as Qt: Launch Qt Designer.

Can qt-tools support more Variable Substitution of cmake-tools?

Screenshots

img--qt_not_found+qtdesigner_not_exists

Platform and Version:

  • OS: Windows 11
  • Qt Tools: 0.10.1
  • VSCode: 1.65.2

Search in documentation

In QtCreator, you can press F1 and get help with the current class. Is it possible to add similar functionality to the command palette to open a web page with the selected class? I would suggest providing a search and if it is empty then the class under the cursor will be found.

[feature] Provide "Command Substitutions" for `launch.json` or `tasks.json`.

Problem to solve

@tonka3000 About what you said in this reply,

For dev scenario it would be better to inject the PATH variable automatically into launch.json. There is a dedicated variable name environment for that. That way it would be automatically done for you without any copy of files.

If we use this method, we have to manually prepend those bin directory into environment variable PATH. Then, if we change another version of Qt, we also need to modify the value of that. It's very cumbersome.

Proposal

Here's my advise. After Qt-Tools found the Qt Kits, it can provides some Command Substitutions just like CMake-Tools does. After that, we can prepend PATH with the bin directory of Qt that variable in launch.json. Moreover, we may use them in program of tasks.json.

Further details

Provide some Command Substitutions like:

  • qt.getQtPrefixPath: "C:\Qt\6.2.0\msvc2019"
  • qt.getDeployqtPath: "C:\Qt\6.2.0\msvc2019\bin\windeployqt.exe"
  • qt.getQmakePath: "C:\Qt\6.2.0\msvc2019\bin\qmake.exe"
  • qt.getUicPath: "C:\Qt\6.2.0\msvc2019\bin\uic.exe"
  • qt.getMocPath: "C:\Qt\6.2.0\msvc2019\bin\moc.exe"

Case 1: Prepend the bin directory to environment variable PATH:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "(CMake) Launch",
      "type": "cppvsdbg",
      "request": "launch",
      "program": "${command:cmake.launchTargetPath}",
      "args": [],
      "cwd": "${command:cmake.launchTargetDirectory}",
      "stopAtEntry": false,
      "environment": [
        {
          "name": "PATH",
          "value": "${command:qt.getQtPrefixPath}/bin;${env:PATH}"
        }
      ],
      "console": "externalTerminal"
    }
  ]
}

Case 2: Use it in program of tasks.json:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Qt Deploy executable",
      "type": "shell",
      "command": "${command:qt.getDeployqtPath}",
      "args": [
        "${command:cmake.launchTargetPath}"
        "--verbose 2",
        "--no-translations"
      ],
      "problemMatcher": []
    }
  ]
}

vscode-qt-tools over SSH and X Server for Windows

Summary

On Windows I have installed xming ( X Server for Windows)
I start Visual Studio Code on Windows
over "Remote explorer" connect to remote linux over SSH

I try run "Edit in Qt Creator" on UI file but nothing happens

    "qttools.creator": "/usr/bin/qtcreator",
    "qttools.loglevel": "debug",
    "qttools.searchMode": "path",
    "qttools.useExternalBrowser": true

If i run in VSC console command "/usr/bin/qtcreator mainwindow.ui" I have correct qtcreator with my file on Windows

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.