Qt VS Code Extensions Manual Tests

From Qt Wiki
Revision as of 12:08, 26 March 2025 by Lucie (talk | contribs)
Jump to navigation Jump to search


Pre-requisit Result Annotation
Have VS code installed (https://code.visualstudio.com/docs/setup/setup-overview)
Have a Qt installation (https://account.qt.io/s/downloads)
Remove any Qt related setting in VS Code User settings.json (Preferences: Open User Settings (JSON))
Testing Result Annotation
Qt VS code extension packages

- In VS code, go to EXTENSIONS

- Type "Qt Pack" in the Search Extensions in Marketplace

- The result should show at the top:

- Qt Extension Pack, with 4 extensions
- Qt C++ Extension Pack, with 7 extensions
- Qt WebAssembly Extension Pack, with 9 entensions

- Select Qt Extension Pack, check that the extensions are

 Qt Core, Qt C++, Qt Qml, Qt UI

- Select Qt C++ Extension Pack, check that the extensions are

 Qt Core, Qt C++, Qt Qml, Qt UI, 
 CMake Tools (from microsoft), C/C++ (from microsoft)

- Select Qt WebAssembly Extension Pack, check that the extensions are

 Qt Core, Qt C++, Qt Qml, Qt UI,
 CMake Tools (from microsoft), C/C++ (from microsoft)
 CMake, Live Preview, Qt WebAssembly Extension Pack (from microsoft)
Installation of the Qt VS-code Extentions

- In VS code, go to Extension

- Search for Qt Pack

- Select Qt WebAssembly Extension Pack

- Click install

- Select each Qt extension and make sure the latest version is displayed (1.2.1)

Finding Qt Installation

- In VS code command palette -(shift+command+P) on MacOS or (shift+ctrl+P) on Windows/Linux- search for Qt register

- Two option should appear:

 - Qt: Register Qt Installation
 - Qt: Register Qt Installation (by qtpaths or qmake)

- Try both commands

- Run Preferences: Open User Settings (JSON)

- Check that the path to the selected Qt installation has been added under qt-core.qtInstallationRoot

modify when following suggestions have been implemented

https://bugreports.qt.io/browse/VSCODEEXT-156

https://bugreports.qt.io/browse/VSCODEEXT-157

https://bugreports.qt.io/browse/VSCODEEXT-158

Opening, building, running a Qt project

- Get the projet from https://code.qt.io/cgit/qt-labs/vscodeext.git/tree/doc/tutorials/AddressBook

- Open the AddressBook folder in VS code

- From command palette run Qt: Set the recommended Qt Extensions settings

- A .vscode folder should be created with a settings.json file

- A "No active kit" button should appear in the bottom status bar

- Click on adddialog.ui, a button with "Open this file with Qt Widgets Designer" should appear.

- Click on "Open this file with Qt Widgets Designer" a pop up window should appear asking to select a CMake kit

- Click on "Select CMake Kit" and select a Qt- kit

- The selected kit should now show in place of the "No active kit"

- Click again on "Open this file with Qt Widgets Designer", adddialog.ui should now open in Qt Widgets Designer

- In VS code, select addressbook.ui, click on "Open this file with Qt Widgets Designer", it should open

- Build the AddressBook

- Execute it

Debugging the AddressBook Qt Project

- Following: opening, building and running the AddressBook project

- Make sure a Qt Kit is selected

- Remove .vscode/launch.json if present

- Click on the debugger icon

- Click on "create a launch.json file"

- Select C++ (GDB/LLDB) in the selection window popping up

- In the launch.json file click on "Add Configuration" if the option are not already open

- Select a Qt configuration

- Go to addressbook.cpp and place a breaking point at line 29 (item->setData(Qt::UserRole, email);)

- Start the debugger

- In the AddressBook window click on the "Add" button

- Enter a Name and an Email then click "OK"

- In VS code check that the name and email variable have the entered values

- Finish debugging and close the AddressBook window

Qt: Scan for Qt Kits

- In VS code, open CMake: Edit User-Local CMake Kits

- Remove all the Qt related kits

- Run Qt: Scan for Qt Kits

- Make sure the Qt kits reappeared in the cmake-tools-kits.json

- Make sure the generated kits are compatible with the registered Qt version

- Make sure the generated kits are compatible with the machine OS

Qt: Open Widget Designer

- Run the command in the palette

- One possibility appears corresponding to the selected kit

discuss this behaviour

- In case of "No active kit", the previously available Qt Widget designer version still appears

discuss this behaviour
Qt: Documentation commands

- In VS code run Qt: Documentation: Open Homepage

- A browser to https://doc.qt.io should now be open in VS code

- Run Qt: Documentation: Search

- In the dialog box type Qt related key words and check that the related documentation page opens

could be more specific here

- Go to adddialog.cpp and click on QWidget - Run Qt: Documentation: Search for current word - Page https://doc.qt.io/qt-6/qwidget.html should now be open in the browser

QML language server related commands

- In VS code run Check for QML language server update

- ...

- Run Qt: Download the most recent QML language server

- ...

- Run Qt: Restart QML language server

to do
Qt: Open Qt Settings
to do
Qt: Reset Qt Tools Extension State (For troubleshooting)
to do