当前位置: 首页 > news >正文

qml 实现一个带动画的switch 按钮

一.效果图

      ====》

二.qml 代码

import QtQuick 2.12
import QtQuick.Controls 2.12Switch {id: controlimplicitWidth: 42implicitHeight: 20indicator: Rectangle {id: bkRectangleanchors.fill: parentx: control.leftPaddingy: parent.height / 2 - height / 2radius: height / 2color: control.checked ? "#3986FF" : "#D9D9D9"Rectangle {id : smallRectwidth: 14height: 14radius: height / 2color: "white"anchors.verticalCenter: parent.verticalCenterNumberAnimation on x{to: bkRectangle.width - smallRect.width - 3running: control.checked ? true : falseduration: 80}NumberAnimation on x{to: 3running: control.checked ? false : trueduration: 80}}}
}

http://www.lryc.cn/news/397641.html

相关文章:

  • C语言基本概念
  • 同轴多芯旋转电连接器1
  • android 消除内部保存的数据
  • vue3 ts 报错:无法找到模块“../views/index/Home.vue”的声明文件
  • finalshell发布前端项目到阿里云
  • 纹波电流与ESR:解析电容器重要参数与应用挑战
  • 算法——二分法
  • 「PaddleOCR」 模型应用优化流程
  • VUE2 子组件传多个参数,父组件函数接收所有入参并加自定义参数
  • less和sass有啥区别哪个更加好
  • Qt Design Studio 4.5现已发布
  • GCN-LSTM实现时空预测
  • 《算法笔记》总结No.6——贪心
  • 久期分析与久期模型
  • MybatisPlus 使用教程
  • bash: redi-cli: 未找到命令...
  • linux 内核 红黑树接口说明
  • 【ELK】filebeat 和logstash区别
  • CNN -1 神经网络-概述
  • 插片式远程IO模块:Profinet总线耦合器在STEP7配置
  • python3读取shp数据
  • pytorch实现水果2分类(蓝莓,苹果)
  • Redis实践经验
  • 分类题解清单
  • QUdpSocket 的bind函数详解
  • [spring] Spring MVC - security(下)
  • 数据库数据恢复—SQL Server数据库由于存放空间不足报错的数据恢复案例
  • spring security的demo
  • 无需构建工具,快速上手Vue2 + ElementUI
  • 通信协议_Modbus协议简介