Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Qt Class GeneratorNew to Visual Studio Code? Get it now.
Qt Class Generator

Qt Class Generator

Mahmoud Essam

|
4 installs
| (1) | Free
Create Qt class folders with .h, .cpp, .pri and update .pro
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Qt Class Generator

Qt Class Generator Logo

Qt Class Generator is a Visual Studio Code extension that allows you to quickly create Qt class folders with .h, .cpp, and .pri files. It also organizes the files into a folder with the class name and automatically updates your project.pro.

Features

  • Creates a Header file (.h) with #pragma once.
  • Creates a CPP file (.cpp) ready for implementation.
  • Creates a PRI file (.pri) and prepares it for inclusion in your Qt project.
  • Generates a folder named after the class containing all files.
  • Automatically updates your Qt project (project.pro) with include() for the new PRI file.
  • Saves time when creating new Qt classes.

Installation

  1. Open Visual Studio Code.
  2. Go to Extensions (Ctrl+Shift+X).
  3. Search for Qt Class Generator or use the Marketplace link.
  4. Click Install.

You can also install the extension from a .vsix file if you exported it manually.

Usage

  1. Press Ctrl+Shift+P to open the Command Palette.
  2. Search for Create Qt Class and run it.
  3. Enter the class name (e.g., HomeWidget).
  4. Choose the target folder where you want the folder and files to be created.
  5. The following files will be created inside a folder with the class name:
HomeWidget/
  ├── HomeWidget.h
  ├── HomeWidget.cpp
  └── HomeWidget.pri
  1. If a project.pro file exists in the selected folder, the following line will be added automatically:
include(HomeWidget/HomeWidget.pri)

Generated Files Example

HomeWidget.h

#pragma once
#include <QWidget>

class HomeWidget : public QWidget {
    Q_OBJECT
public:
    explicit HomeWidget(QWidget *parent = nullptr);
};

HomeWidget.cpp

#include "HomeWidget.h"

HomeWidget::HomeWidget(QWidget *parent) : QWidget(parent) {
    // TODO: UI setup
}

HomeWidget.pri

HEADERS += \
    $$PWD/HomeWidget.h

SOURCES += \
    $$PWD/HomeWidget.cpp

Links

  • VSCode Marketplace
  • GitHub Repository
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft