当前位置:网站首页>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 :
边栏推荐
- 功能:求5行5列矩阵的主、副对角线上元素之和。注意, 两条对角线相交的元素只加一次。例如:主函数中给出的矩阵的两条对角线的和为45。
- AI 助力艺术设计抄袭检索新突破!刘芳教授团队论文被多媒体顶级会议ACM MM录用
- On the day when 28K joined Huawei testing post, I cried: everything I have done in these five months is worth it
- Introduction to thread pool
- 1-Redis架构设计到使用场景-四种部署运行模式(上)
- 删除所有值为y的元素。数组元素中的值和y的值由主函数通过键盘输入。
- Interview script of Software Test Engineer
- Makefile judge custom variables
- The culprit of unrestrained consumption -- Summary
- Future源码一观-JUC系列
猜你喜欢
It's OK to have hands-on 8 - project construction details 3-jenkins' parametric construction
Att & CK actual combat series - red team actual combat - V
技術實踐|線上故障分析及解决方法(上)
Function: store the strings entered in the main function in reverse order. For example, if you input the string "ABCDEFG", you should output "gfedcba".
Introduction to unity shader essentials reading notes Chapter III unity shader Foundation
On covariance of array and wildcard of generic type
Release and visualization of related data
MySQL winter vacation self-study 2022 12 (1)
How to use AHAS to ensure the stability of Web services?
机器学习基础:用 Lasso 做特征选择
随机推荐
What is the potential of pocket network, which is favored by well-known investors?
[cloud native topic -48]:kubesphere cloud Governance - operation - overview of multi tenant concept
All in one 1407: stupid monkey
PMP 考试常见工具与技术点总结
It's OK to have hands-on 8 - project construction details 3-jenkins' parametric construction
Pytest unit test framework: simple and easy to use parameterization and multiple operation modes
Future source code view -juc series
The difference between objects and objects
[common error] UART cannot receive data error
Makefile judge custom variables
数据库表外键的设计
Oracle database knowledge points (I)
基于.NetCore开发博客项目 StarBlog - (14) 实现主题切换功能
How to use AHAS to ensure the stability of Web services?
It's OK to have hands-on 8 - project construction details 3-jenkins' parametric construction
7.1 learning content
[complimentary ppt] kubemeet Chengdu review: make the delivery and management of cloud native applications easier!
2022 Software Test Engineer skill list, please check
8. Go implementation of string conversion integer (ATOI) and leetcode
A dichotomy of Valentine's Day