QML Snippets for Visual Studio Code
This extension for Visual Studio Code adds snippets for the QML language (Qt Meta-object Language).
The extension is based on the Sublime QML extension by Sergey Kozlov:
https://github.com/skozlovf/Sublime-QML
The qml file extension needs to be registered as a known file type with VSCode.
The easiest way is to use the QML language syntax extension from Baptist BENOIST:
https://github.com/bbenoist/vscode-qml
Type part of a snippet, press enter
, and the snippet unfolds.
Trigger | Content |
---|---|
alias | property alias name :val |
anchors | anchors. :parent. |
anchors (all sides) | anchors.left: parent.left anchors.top: parent.top anchors.right: parent.right anchors.bottom: parent.bottom |
anchors.centerIn | anchors.centerIn: parent |
anchors.fill | anchors.fill: parent |
anchors.horizontalCenter | anchors.horizontalCenter: parent.horizontalCenter |
anchors.margins | anchors.margins: 0 |
anchors.verticalCenter | anchors.verticalCenter: parent.verticalCenter |
color | color: "#" |
component.onCompleted: | Component.onCompleted: |
connections | Connections {\n target: \n on \n |
console.log | console.log(" :") |
console.log + var | console.log(" :" + var) |
function | function name(argument) { // body... } |
layout | Layout.fillWidth: true\nLayout.fillHeight: :true |
layout.fillHeight | Layout.fillHeight: true |
layout.fillWidth | Layout.fillWidth: true |
mouse | MouseArea { anchors.fill: parent cursorShape: Qt.PointingHandCursor hoverEnabled: false onEntered: { onExited: { onWheel: { onClicked: } |
property | property var name |
default property | default property var name |
readonly property | readonly property var name: |
QtObject | QtObject { id: } |
Rectangle | Rectangle { width: 10 height: 10 color: transparent } |
signal | signal name() |
stack.onStatusChanged | Stack.onStatusChanged: { if (Stack.status == Stack.Active) ; else if (Stack.status == Stack.Inactive) ; } |