加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
HomeButton.qml 2.50 KB
一键复制 编辑 原始数据 按行查看 历史
世玉轩 提交于 2020-06-19 09:31 . init push myir hmi v2.0 gui
import QtQuick 2.0
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
Image {
id: hBtn
source:"images/wvga/home/home.png"
signal clicked()
property bool clickable : true
property int duration: 250
property int glowRadius: 50
property alias label: label
property alias text: label.text
MouseArea{
anchors.fill: parent
onClicked: {
if(hBtn.clickable){
hBtn.clicked()
}
}
onPressed: {
if(hBtn.clickable){
glow.visible = true
animation1.start()
animation2.start()
}
}
}
Rectangle{
id:glow
anchors.centerIn: parent
visible: false
width: hBtn.glowRadius*2
height: hBtn.glowRadius*2
color:"#00000000"
radius: hBtn.glowRadius
scale:1.05
border.color: "white"
}
Label{
id:label
// x:292
// y:252
text:qsTr("Label")
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.bottom
color:"#443224"
font.pixelSize: 28
}
PropertyAnimation{
target:glow
id:animation1
duration: hBtn.duration
loops:1
from:1.05
to:1.2
property:"scale"
}
ParallelAnimation{
id:animation2
SequentialAnimation{
PropertyAnimation{
target: glow
duration: hBtn.duration
loops:1
from:0.2
to:1.0
property:"opacity"
}
PropertyAnimation{
target: glow
duration:hBtn.duration
loops:1
from:1.0
to:0
property:"opacity"
}
PropertyAction {
target: glow; property: "visible"; value:false }
}
SequentialAnimation {
PropertyAction {
target: glow
property: "border.width"
value: 6
}
PauseAnimation {
duration: 200
}
PropertyAnimation {
target: glow
duration: hBtn.duration
loops: 1
from: 6
to: 3
property: "border.width"
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化