Loading...
Loading...
QML and Qt Quick — declarative UI language for modern Qt applications. Use when building a QML-based UI, embedding QML in a Python/C++ app, exposing Python/C++ objects to QML, creating QML components, or choosing between QML and widgets. Trigger phrases: "QML", "Qt Quick", "declarative UI", "QQmlApplicationEngine", "expose to QML", "QML component", "QML signal", "pyqtProperty", "QML vs widgets", "QtQuick.Controls", "Item", "Rectangle"
npx skill4agent add l3digital-net/claude-code-plugins qt-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 |
var// WRONG — prevents static analysis, unclear errors
property var name
// CORRECT
property string name
property int count
property MyModel optionsModel// WRONG — imperative assignment overwrites bindings, breaks Qt Design Studio
Rectangle {
Component.onCompleted: color = "red"
}
// CORRECT — declarative binding, evaluates once at load
Rectangle {
color: "red"
}// 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) }// 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
}
}BasicFusionMaterialUniversal// In main() — must be set before QGuiApplication
QQuickStyle.setStyle("Material")Label { text: qsTr("Save File") }
Button { text: qsTr("Cancel") }@SlotTypeError