QML简单记录

Tuesday, Jul 23, 2024 | 1 minute read | Updated at Tuesday, Jul 23, 2024

@
QML简单记录

QML 简单记录

显示风车旋转

import QtQuick 2.12
import QtQuick.Window 2.12

Window {
    Image{
        id:background
        source: "qrc:/background.png"
    }

    Image {
        id:wheel
        anchors.centerIn: parent //居中
        source: "qrc:/pinwheel.png"

        Behavior on rotation { // behavior on <prooerty>
            NumberAnimation {  // numberanimation 延迟动画
                duration: 250
            }
        }
    }

    MouseArea {
        anchors.fill: parent
        onPressed: { //事件
            wheel.rotation += 90
        }
    }

    visible: true
    width: background.width
    height: background.height
    title: qsTr("Hello World")
}
  • ubuntu使用quick时,Unknown module(s) in QT: qml quick
    安装开发包qtdeclarative5-dev

  • 问题 module “QtQuick.Controls” version 2.12 is not installed
    安装qml-module-qtquick-controls2

© 2016 - 2025 Caisong's Blog

🌱 Powered by Hugo with theme Dream.

About Me

大龄程序员,喜欢折腾各种环境部署、软件应用。

博客记录日常。