当前位置:网站首页>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 :
边栏推荐
- A Kuan food rushed to the Shenzhen Stock Exchange: with annual sales of 1.1 billion, Hillhouse and Maotai CCB are shareholders
- Future源码一观-JUC系列
- 技術實踐|線上故障分析及解决方法(上)
- 7.1 learning content
- Query efficiency increased by 10 times! Three optimization schemes to help you solve the deep paging problem of MySQL
- 机器学习基础:用 Lasso 做特征选择
- 查询效率提升10倍!3种优化方案,帮你解决MySQL深分页问题
- Oracle database knowledge points (IV)
- What insurance products should be bought for the elderly?
- Struct in linked list
猜你喜欢
A-Frame虚拟现实开发入门
功能:编写函数fun求s=1^k+2^k +3^k + ......+N^k的值, (1的K次方到N的K次方的累加和)。
[error record] configure NDK header file path in Visual Studio (three header file paths of NDK | ASM header file path selection related to CPU architecture)
Long article review: entropy, free energy, symmetry and dynamics in the brain
机器学习基础:用 Lasso 做特征选择
2-redis architecture design to use scenarios - four deployment and operation modes (Part 2)
[dynamic programming] leetcode 53: maximum subarray sum
The FISCO bcos console calls the contract and reports an error does not exist
[common error] custom IP instantiation error
On the day when 28K joined Huawei testing post, I cried: everything I have done in these five months is worth it
随机推荐
Makefile judge custom variables
CLP information - how does the digital transformation of credit business change from star to finger?
基于.NetCore开发博客项目 StarBlog - (14) 实现主题切换功能
The culprit of unrestrained consumption -- Summary
AI helps make new breakthroughs in art design plagiarism retrieval! Professor Liu Fang's team paper was employed by ACM mm, a multimedia top-level conference
Leetcode 121 best time to buy and sell stock (simple)
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)
On covariance of array and wildcard of generic type
[common error] UART cannot receive data error
Oracle database knowledge points (I)
Beijing invites reporters and media
be based on. NETCORE development blog project starblog - (14) realize theme switching function
AI 助力艺术设计抄袭检索新突破!刘芳教授团队论文被多媒体顶级会议ACM MM录用
8. Go implementation of string conversion integer (ATOI) and leetcode
中电资讯-信贷业务数字化转型如何从星空到指尖?
CesiumJS 2022^ 源码解读[8] - 资源封装与多线程
How to set the response description information when the response parameter in swagger is Boolean or integer
@EnableAsync @Async
Arc 135 supplementary report
Weekly open source project recommendation plan