69.qt quick-qml控件类-灯控件(支持动画闪烁)

最近要用一个灯控件,并且支持动画闪烁,所以自己花点时间写了个,方便节省大家开发时间, demo如下所示:

 效果如下所示:

代码很简单,其中main.qml如下所示:

import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12
Window {
    visible: true
    width: 640
    height: 480
    title: "QML 灯控件"

    color: "#F1F1F1"
    ColumnLayout {
        anchors.fill: parent
        anchors.margins: 50
        spacing: 20
        RowLayout {
            Layout.fillWidth: true
            Layout.fillHeight: true
            spacing: 20
            LightControl {
                id: lightblink1
                Layout.fillWidth: true
                Layout.fillHeight: true
                color: "#0D5DE6

猜你喜欢

转载自blog.csdn.net/qq_37997682/article/details/126839791
今日推荐