Code Snippets QML

Short texts QML 🧑‍💻 Code snippets QML ✍️ Reading lists QML 👀

Examples of QtMultimedia in Qt6

import QtQuick import QtQuick.Controls import QtMultimedia ApplicationWindow { id: root width: 640 height: 480 visible: true VideoOutput { id: videoOutput anchors.fill: parent Component.onCompleted: function() { frame_provider.video_sink = videoOutput.videoSink; frame_provider.start(); } } }

DigitalClcok.qml

/* * /usr/share/plasma/plasmoids/org.kde.plasma.digitalclock/contents/ui/DigitalClcok.qml * * Copyright 2013 Heena Mahour * Copyright 2013 Sebastian Kügler * Copyright 2013 Martin Klapetek * Copyright 2014 David Edmundson * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software […]

main.qml

import QtQuick 2.9 import QtQuick.Controls 2.4 import QtQuick.Window 2.2 import QtQuick.Layouts 1.11 Window { id: root visible: true maximumWidth: 720 minimumWidth: 720 maximumHeight: 1920 minimumHeight: 1920 Rectangle { width: parent.width height: parent.height border.width: 0 color: “lightblue” ListModel { id: busModel } Component { id: busDelegate Item { id: delegateColumn width: root.width height: 190 RowLayout { […]

Line.qml

import QtQuick 2.0 Rectangle{ width: parent.width height: 1 border.width: 1 border.color: “gray” color: “gray” anchors.horizontalCenter: parent.horizontalCenter }

Draws a Rectangle with different border radiusses

/* * Public Domain. Do what you want with this. */ import QtQuick 2.15 Item { property color color: “white” property color borderColor: “black” property real borderWidth: 0 property real radius: 0 property bool topLeftCorner: true property bool topRightCorner: true property bool bottomRightCorner: true property bool bottomLeftCorner: true id: _root onColorChanged: updateCanvas() onRadiusChanged: updateCanvas() onTopLeftCornerChanged: […]