qt-qml

QML vs Widgets: When to Choose QML

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "qt-qml" with this command: npx skills add l3digital-net/claude-code-plugins/l3digital-net-claude-code-plugins-qt-qml

QML and Qt Quick

QML vs Widgets: When to Choose QML

Use QML when... Use Widgets when...

Building modern, animated, fluid UIs Building traditional desktop tools

Targeting mobile or embedded Heavy data tables and forms

Designers are involved in the UI Rich text editing required

GPU-accelerated rendering needed Complex platform widget integration

Writing a new app from scratch Extending an existing widget app

For new Python/PySide6 desktop applications, QML offers better visual results with less code. For data-heavy enterprise tools, widgets remain the pragmatic choice.

Bootstrap and architecture — see references/qml-architecture.md

Official Best Practices (Qt Quick)

  1. Type-safe property declarations — Always use explicit types, not var :

// WRONG — prevents static analysis, unclear errors property var name

// CORRECT property string name property int count property MyModel optionsModel

  1. Prefer declarative bindings over imperative assignments:

// WRONG — imperative assignment overwrites bindings, breaks Qt Design Studio Rectangle { Component.onCompleted: color = "red" }

// CORRECT — declarative binding, evaluates once at load Rectangle { color: "red" }

  1. Interaction signals over value-change signals:

// WRONG — valueChanged fires on clamping/rounding, causes event cascades Slider { onValueChanged: model.update(value) }

// CORRECT — moved only fires on user interaction Slider { onMoved: model.update(value) }

  1. Don't anchor the immediate children of Layouts:

// WRONG — anchors on direct Layout children cause binding loops RowLayout { Rectangle { anchors.fill: parent } }

// CORRECT — use Layout attached properties RowLayout { Rectangle { Layout.fillWidth: true Layout.preferredHeight: 40 } }

  1. Don't customize native styles — Windows and macOS native styles ignore QSS. Base all custom styling on cross-platform styles: Basic , Fusion , Material , or Universal :

// In main() — must be set before QGuiApplication QQuickStyle.setStyle("Material")

  1. Make all user-visible strings translatable from the start:

Label { text: qsTr("Save File") } Button { text: qsTr("Cancel") }

Exposing Python Objects to QML

Three methods: Required Properties (preferred), Context Property, Registered QML Type.

Key rule: @Slot is mandatory for any Python method callable from QML. Missing it causes TypeError at runtime.

Full patterns — see references/qml-pyside6.md

QML Signals and Connections

Full patterns — see references/qml-signals-properties.md

Common QtQuick.Controls Components

Full component reference — see references/qml-components.md

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

qt-architecture

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

qt-packaging

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

qt-debugging

No summary provided by upstream source.

Repository SourceNeeds Review