当前位置:网站首页>QML add gradient animation during state transition
QML add gradient animation during state transition
2022-07-04 00:59:00 【mrbone11】
import QtQuick 2.9
import QtQuick.Window 2.2
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Rectangle {
anchors.centerIn: parent
width: 75; height: 75
id: button
state: "NORMAL"
Text{
text: "button"
anchors.centerIn: parent
}
MouseArea {
anchors.fill: parent
onEntered: button.state = "ENTERED"
onExited: button.state = "NORMAL"
onPressed: button.state = "PRESSED"
onReleased: button.state = "ENTERED"
hoverEnabled: true
}
states: [
State {
name: "ENTERED"
PropertyChanges {
target: button; color: "lightblue"
}
},
State {
name: "NORMAL"
PropertyChanges {
target: button; color: "lightgray"
}
},
State {
name: "PRESSED"
PropertyChanges {
target: button; color: "pink"
}
}
]
transitions: [
Transition {
from: "ENTERED"
to: "NORMAL"
ColorAnimation {
target: button; duration: 500
}
},
Transition {
from: "NORMAL"
to: "ENTERED"
ColorAnimation {
target: button; duration: 500
}
},
Transition {
from: "ENTERED"
to: "PRESSED"
ColorAnimation {
target: button; duration: 200
}
},
Transition {
from: "PRESSED"
to: "ENTERED"
ColorAnimation {
target: button; duration: 200
}
},
Transition {
from: "PRESSED"
to: "NORMAL"
ColorAnimation {
target: button; duration: 500
}
}
]
}
}
The effect is as follows :
边栏推荐
- 1-Redis架构设计到使用场景-四种部署运行模式(上)
- MySQL winter vacation self-study 2022 12 (1)
- 在寻求人类智能AI的过程中,Meta将赌注押向了自监督学习
- Self study software testing. To what extent can you go out and find a job?
- What insurance products should be bought for the elderly?
- Sorry, Tencent I also refused
- UTS | causal reasoning random intervention based on Reinforcement Learning
- Pratique technique | analyse et solution des défaillances en ligne (Partie 1)
- Cloud dial test helps Weidong cloud education to comprehensively improve the global user experience
- 长文综述:大脑中的熵、自由能、对称性和动力学
猜你喜欢
CLP information - how does the digital transformation of credit business change from star to finger?
From functional testing to automated testing, how did I successfully transform my salary to 15K +?
Struct in linked list
Thinkphp6 integrated JWT method and detailed explanation of generation, removal and destruction
[common error] UART cannot receive data error
Is it really possible that the monthly salary is 3K and the monthly salary is 15K?
Technical practice online fault analysis and solutions (Part 1)
技術實踐|線上故障分析及解决方法(上)
基于.NetCore开发博客项目 StarBlog - (14) 实现主题切换功能
Mobile asynchronous sending SMS verification code solution -efficiency+redis
随机推荐
[common error] custom IP instantiation error
功能:将主函数中输入的字符串反序存放。例如:输入字符串“abcdefg”,则应输出“gfedcba”。
Oracle database knowledge points that cannot be learned (III)
MySQL winter vacation self-study 2022 12 (1)
MPLS experiment
Analysis and solution of lazyinitializationexception
Interview script of Software Test Engineer
Release and visualization of related data
Data mining vs Machine Learning: what is the difference between them? Which is more suitable for you to learn
长文综述:大脑中的熵、自由能、对称性和动力学
Decompile and modify the non source exe or DLL with dnspy
挖财帮个人开的证券账户安全吗?是不是有套路
From functools import reduce -- see the use of reduce function from typical examples
Function: find the sum of the elements on the main and sub diagonal of the matrix with 5 rows and 5 columns. Note that the elements where the two diagonals intersect are added only once. For example,
From functional testing to automated testing, how did I successfully transform my salary to 15K +?
Oracle database knowledge points (IV)
国元证券开户是真的安全可靠吗
How to be a professional software testing engineer? Listen to the byte five year old test
be based on. NETCORE development blog project starblog - (14) realize theme switching function
The frost peel off the purple dragon scale, and the xiariba people will talk about database SQL optimization and the principle of indexing (primary / secondary / clustered / non clustered)