Qt QML Component Generator

VerifiedSafe

Generates well-structured QML components with property bindings, signal/slot connections, and Qt Quick Controls integration following Qt best practices.

Sby Skills Guide Bot
DevelopmentIntermediate
3/2/2026
Claude Code
#qt#qml#qt-quick#ui-components#code-generation

Recommended for

Automated summary

Generates structured QML components with properties, signals, and C++ connections from a project and component specification.

Strengths

  • Handles properties, signals, and QML/C++ connections in a single generation flow.
  • Supports several component types: item, control, popup, view, delegate, and singleton.
  • Also produces C++ registration code and related CMake files when requested.
  • Lets you choose a Qt Quick Controls style such as basic, material, universal, or fusion.

Limitations

  • Output quality depends heavily on the input schema and the project details provided.
  • Does not guarantee compilation or actual execution in the target Qt project.
  • May require manual adjustments to match existing Qt conventions and versions.
When to use it

Use this skill to quickly scaffold a reusable QML component or a small component library in a Qt project.

When not to use it

Avoid it for debugging an existing QML runtime issue or for fine-grained refactoring that requires deep knowledge of the codebase.

Security analysis

Safe
Quality score88/100

The skill generates QML and C++ source files and project configuration content. It does not instruct destructive actions, exfiltration, obfuscation, or execution of untrusted code. The declared Bash tool is not used for any risky operations in the skill body, and the generated code is standard Qt/QML boilerplate.

No concerns found

How this analysis is made

Examples

Primary button component
Generate a reusable QML control named PrimaryButton in ./ui/components with text, backgroundColor, textColor, and loading properties, plus clicked and pressAndHold signals. Use the Qt Quick Controls basic style.
List view with delegate
Create a QML ListView component named DeviceList in ./ui/views with a custom delegate, a model property, and a clicked(int index) signal; include Qt Quick Controls integration.
C++-backed singleton
Generate a QML singleton named AppTheme in ./ui with a C++ backend, and provide the registration code and CMake changes needed.

name: qt-qml-component-generator description: Generate QML components with proper property bindings, signal/slot connections, and Qt Quick Controls integration allowed-tools: Read, Write, Edit, Bash, Glob, Grep tags: [qt, qml, quick, ui, components]

qt-qml-component-generator

Generate QML components with proper property bindings, signal/slot connections, and Qt Quick Controls integration. This skill creates well-structured QML components following Qt best practices.

Capabilities

  • Generate QML components with property bindings
  • Create custom QML types with proper registration
  • Set up signal/slot connections between QML and C++
  • Configure Qt Quick Controls styling
  • Generate model/view components (ListView, GridView)
  • Create reusable component libraries
  • Set up QML module structure
  • Generate TypeScript-like type annotations

Input Schema

{
  "type": "object",
  "properties": {
    "projectPath": {
      "type": "string",
      "description": "Path to the Qt project"
    },
    "componentName": {
      "type": "string",
      "description": "Name of the QML component"
    },
    "componentType": {
      "enum": ["item", "control", "popup", "view", "delegate", "singleton"],
      "default": "item"
    },
    "properties": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": { "type": "string" },
          "type": { "type": "string" },
          "defaultValue": { "type": "string" },
          "readonly": { "type": "boolean" }
        }
      }
    },
    "signals": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": { "type": "string" },
          "parameters": { "type": "array" }
        }
      }
    },
    "cppBackend": {
      "type": "boolean",
      "description": "Generate C++ backend class",
      "default": false
    },
    "useControls": {
      "enum": ["none", "basic", "material", "universal", "fusion"],
      "default": "basic"
    }
  },
  "required": ["projectPath", "componentName"]
}

Output Schema

{
  "type": "object",
  "properties": {
    "success": { "type": "boolean" },
    "files": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": { "type": "string" },
          "type": { "enum": ["qml", "cpp", "cmake"] }
        }
      }
    },
    "registrationCode": {
      "type": "string",
      "description": "C++ code to register the component"
    }
  },
  "required": ["success"]
}

Generated QML Component Example

// CustomButton.qml
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15

Control {
    id: root

    // Properties
    property string text: ""
    property color backgroundColor: "#2196F3"
    property color textColor: "white"
    property bool loading: false
    readonly property bool pressed: mouseArea.pressed

    // Signals
    signal clicked()
    signal pressAndHold()

    // Size hints
    implicitWidth: Math.max(implicitBackgroundWidth + leftPadding + rightPadding,
                            implicitContentWidth + leftPadding + rightPadding)
    implicitHeight: Math.max(implicitBackgroundHeight + topPadding + bottomPadding,
                             implicitContentHeight + topPadding + bottomPadding)

    padding: 12

    // Background
    background: Rectangle {
        radius: 4
        color: root.pressed ? Qt.darker(root.backgroundColor, 1.2) : root.backgroundColor

        Behavior on color {
            ColorAnimation { duration: 100 }
        }
    }

    // Content
    contentItem: RowLayout {
        spacing: 8

        BusyIndicator {
            visible: root.loading
            running: root.loading
            Layout.preferredWidth: 20
            Layout.preferredHeight: 20
        }

        Text {
            text: root.text
            color: root.textColor
            font.pixelSize: 14
            font.weight: Font.Medium
            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
            Layout.fillWidth: true
        }
    }

    // Interaction
    MouseArea {
        id: mouseArea
        anchors.fill: parent
        enabled: !root.loading
        onClicked: root.clicked()
        onPressAndHold: root.pressAndHold()
    }
}

C++ Backend Integration

// custombutton.h
#ifndef CUSTOMBUTTON_H
#define CUSTOMBUTTON_H

#include <QObject>
#include <QQmlEngine>

class CustomButtonBackend : public QObject
{
    Q_OBJECT
    QML_ELEMENT

    Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
    Q_PROPERTY(bool loading READ loading WRITE setLoading NOTIFY loadingChanged)

public:
    explicit CustomButtonBackend(QObject *parent = nullptr);

    QString text() const;
    void setText(const QString &text);

    bool loading() const;
    void setLoading(bool loading);

signals:
    void textChanged();
    void loadingChanged();
    void clicked();

public slots:
    void handleClick();

private:
    QString m_text;
    bool m_loading = false;
};

#endif // CUSTOMBUTTON_H

QML Module Structure

qml/
├── MyComponents/
│   ├── qmldir
│   ├── CustomButton.qml
│   ├── CustomTextField.qml
│   └── CustomDialog.qml
└── main.qml
# qmldir
module MyComponents
CustomButton 1.0 CustomButton.qml
CustomTextField 1.0 CustomTextField.qml
CustomDialog 1.0 CustomDialog.qml

CMake QML Module

qt_add_qml_module(myapp
    URI MyComponents
    VERSION 1.0
    QML_FILES
        qml/MyComponents/CustomButton.qml
        qml/MyComponents/CustomTextField.qml
    SOURCES
        src/custombutton.cpp
        src/custombutton.h
)

Model/View Component

// UserListView.qml
import QtQuick 2.15
import QtQuick.Controls 2.15

ListView {
    id: root

    property alias model: root.model
    signal itemSelected(int index, var data)

    clip: true
    spacing: 4

    delegate: ItemDelegate {
        width: ListView.view.width
        height: 60

        contentItem: Row {
            spacing: 12

            Image {
                source: model.avatar
                width: 48
                height: 48
                fillMode: Image.PreserveAspectCrop
            }

            Column {
                anchors.verticalCenter: parent.verticalCenter

                Text {
                    text: model.name
                    font.bold: true
                }

                Text {
                    text: model.email
                    color: "gray"
                    font.pixelSize: 12
                }
            }
        }

        onClicked: root.itemSelected(index, model)
    }

    ScrollBar.vertical: ScrollBar {}
}

Best Practices

  1. Use property bindings: Avoid imperative updates
  2. Define proper interfaces: Clear properties and signals
  3. Use implicit size: Let components size themselves
  4. Separate logic from UI: Use C++ for complex logic
  5. Follow naming conventions: PascalCase for components
  6. Use Qt Quick Controls: Consistent platform look

Related Skills

  • qt-cmake-project-generator - Project setup
  • qt-translation-workflow - Internationalization
  • qt-widget-accessibility-audit - Accessibility

Related Agents

  • qt-cpp-specialist - Qt/C++ expertise
  • desktop-ux-analyst - UX review

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/qt-qml-component-generator-mm8o528o/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/qt-qml-component-generator-mm8o528o' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/qt-qml-component-generator-mm8o528o/download' --output '.skill-downloads/qt-qml-component-generator-mm8o528o/SKILL.md.part' && mv '.skill-downloads/qt-qml-component-generator-mm8o528o/SKILL.md.part' '.skill-downloads/qt-qml-component-generator-mm8o528o/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Read, Write, Edit, Bash, Glob, Grep

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/qt-qml-component-generator-mm8o528o/SKILL.md' && test -s '.skill-downloads/qt-qml-component-generator-mm8o528o/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/qt-qml-component-generator' && cp -R '.skill-downloads/qt-qml-component-generator-mm8o528o' '.claude/skills/qt-qml-component-generator'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/qt-qml-component-generator-mm8o528o'

openskills read 'qt-qml-component-generator-mm8o528o'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/qt-qml-component-generator-mm8o528o/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills