QT Qml 實現Loading...

使用動畫旋轉一張圖片

準備圖片一張

在這裏插入圖片描述

QML 代碼

import QtQuick 2.9
import QtGraphicalEffects 1.0

// 加載中 轉圈

Rectangle
{
    id:rect
    width: parent.width
    height: parent.height
    radius: width / 8
    color:"#998a8a8a"

    Image
    {
        anchors.centerIn: parent
        width: parent.width/3
        height:parent.height/3
        source: "qrc:/loading.png"
        RotationAnimation on rotation {
            from: 0
            to: 360
            duration: 1500
            loops: Animation.Infinite
        }
    }
}

測試

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章