QT WIN11 FluentUI APP开发

代码
import QtQuick
import QtQuick.Controls
import FluentUIItem {property bool autoPlay: trueproperty int loopTime: 2000property var modelproperty Component delegateproperty bool showIndicator: trueproperty int indicatorGravity : Qt.AlignBottom | Qt.AlignHCenterproperty int indicatorMarginLeft: 0property int indicatorMarginRight: 0property int indicatorMarginTop: 0property int indicatorMarginBottom: 20property int indicatorSpacing: 10property alias indicatorAnchors: layout_indicator.anchorsproperty Component indicatorDelegate : com_indicatorid:controlwidth: 400height: 300ListModel{id:content_model}QtObject{id:dproperty bool flagXChanged: trueproperty bool isAnimEnable: control.autoPlay && list_view.count>3function setData(data){if(!data){return}content_model.clear()content_model.append(data[data.length-1])content_model.append(data)content_model.append(data[0])list_view.highlightMoveDuration = 0list_view.currentIndex = 1list_view.highlightMoveDuration = 250if(d.isAnimEnable){timer_run.restart()}}}ListView{id:list_viewanchors.fill: parentsnapMode: ListView.SnapOneItemclip: trueboundsBehavior: ListView.StopAtBoundsmodel:content_modelmaximumFlickVelocity: 4 * (list_view.orientation === Qt.Horizontal ? width : height)preferredHighlightBegin: 0preferredHighlightEnd: 0highlightMoveDuration: 0Component.onCompleted: {d.setData(control.model)}interactive: list_view.count>3Connections{target: controlfunction onModelChanged(){d.setData(control.model)}}orientation : ListView.Horizontaldelegate: Item{id:item_controlwidth: ListView.view.widthheight: ListView.view.heightproperty int displayIndex: {if(index === 0)return content_model.count-3if(index === content_model.count-1)return 0return index-1}FluLoader{property int displayIndex : item_control.displayIndexproperty var model: list_view.model.get(index)anchors.fill: parentsourceComponent: {if(model){return control.delegate}return undefined}}}onMovementEnded:{currentIndex = list_view.contentX/list_view.widthif(currentIndex === 0){currentIndex = list_view.count-2}else if(currentIndex === list_view.count-1){currentIndex = 1}d.flagXChanged = falsetimer_run.restart()}onMovementStarted: {d.flagXChanged = truetimer_run.stop()}onContentXChanged: {if(d.flagXChanged){var maxX = Math.min(list_view.width*(currentIndex+1),list_view.count*list_view.width)var minY = Math.max(0,(list_view.width*(currentIndex-1)))if(contentX>=maxX){contentX = maxX}if(contentX<=minY){contentX = minY}}}}Component{id:com_indicatorRectangle{width:  8height: 8radius: 4FluShadow{radius: 4}scale: checked ? 1.2 : 1color: checked ?  FluTheme.primaryColor : Qt.rgba(1,1,1,0.7)border.width: mouse_item.containsMouse ? 1 : 0border.color: FluTheme.primaryColorMouseArea{id:mouse_itemhoverEnabled: trueanchors.fill: parentonClicked: {changedIndex(realIndex)}}}}Row{id:layout_indicatorspacing: control.indicatorSpacinganchors{horizontalCenter:(indicatorGravity & Qt.AlignHCenter) ? parent.horizontalCenter : undefinedverticalCenter: (indicatorGravity & Qt.AlignVCenter) ? parent.verticalCenter : undefinedbottom: (indicatorGravity & Qt.AlignBottom) ? parent.bottom : undefinedtop: (indicatorGravity & Qt.AlignTop) ? parent.top : undefinedleft: (indicatorGravity & Qt.AlignLeft) ? parent.left : undefinedright: (indicatorGravity & Qt.AlignRight) ? parent.right : undefinedbottomMargin: control.indicatorMarginBottomleftMargin: control.indicatorMarginBottomrightMargin: control.indicatorMarginBottomtopMargin: control.indicatorMarginBottom}visible: showIndicatorRepeater{id:repeater_indicatormodel: list_view.countFluLoader{property int displayIndex: {if(index === 0)return list_view.count-3if(index === list_view.count-1)return 0return index-1}property int realIndex: indexproperty bool checked: list_view.currentIndex === indexsourceComponent: {if(index===0 || index===list_view.count-1)return undefinedreturn control.indicatorDelegate}}}}Timer{id:timer_animinterval: 250onTriggered: {list_view.highlightMoveDuration = 0if(list_view.currentIndex === list_view.count-1){list_view.currentIndex = 1}}}Timer{id:timer_runinterval: control.loopTimerepeat: d.isAnimEnableonTriggered: {list_view.highlightMoveDuration = 250list_view.currentIndex = list_view.currentIndex+1timer_anim.start()}}function changedIndex(index){d.flagXChanged = truetimer_run.stop()list_view.currentIndex = indexd.flagXChanged = falseif(d.isAnimEnable){timer_run.restart()}}
}
效果 

 

参考

https://github.com/zhuzichu520/FluentUI

GitHub - zhuzichu520/FluentPlayer

GitHub - zhuzichu520/QtHub

https://blog.51cto.com/u_6343747/5465068

Felgo简介--Qt开发者的福音-CSDN博客


创作不易,小小的支持一下吧!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/bicheng/52591.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Gazebo Harmonic gz-harmonic 和 ROS2 Jazzy 注意事项

激光显示 点呈现 射线呈现 rviz2 新旧版本并存的混乱 本教程旨在为在Ubuntu Jammy&#xff08;最新支持Gazebo Classic包的Ubuntu版本&#xff09;上运行Gazebo Classic&#xff08;如Gazebo 11&#xff09;的用户提供指导&#xff0c;这些用户计划将其代码迁移到新的Gazebo版…

两个实用的Python编程技巧

一、变量类型声明技巧 虽然在Python中可以不用声明变量的类型&#xff0c;但是为了加快程序的运算速度&#xff0c;减少不必要的bug&#xff0c;我们可以在定义变量之初就把它的类型确定&#xff0c;这样可以更好地传输变量值。如下面的例子。 我们定义了两个变量&#xff0c…

基于STM32开发的智能家居语音控制系统

目录 引言环境准备工作 硬件准备软件安装与配置系统设计 系统架构硬件连接代码实现 系统初始化语音识别处理设备控制与状态显示Wi-Fi通信与远程控制应用场景 家庭环境的语音控制办公室的智能化管理常见问题及解决方案 常见问题解决方案结论 1. 引言 随着人工智能技术的发展&…

Centos 添加双网卡 (生产环境配置记录)

1、在虚拟机中添加网卡2 [rootntpserver network-scripts]# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo …

医疗器械法规笔记

目录 前言医疗器械法规体系医疗器械监管注册与备案前言 之前的文章中介绍了与软件开发过程中相关的法规(网络安全),同时介绍了如何查找相关行业标准,这些都是平时工作中遇到的细节问题,没有系统性的呈现出医疗器械法规相关的框架,一直想对法规与标准有一个全面的认识和总…

44-java自动拆箱和自动装箱

java自动拆箱和自动装箱 自动装箱是Java中的一个概念&#xff0c;它允许将一个基本类型直接赋值给对应的包装类。例如&#xff0c;将一个int值赋给Integer对象。 自动拆箱是将包装类对象直接赋值给基本类型变量。例如&#xff0c;将一个Integer对象赋给一个int值。 以下是Ja…

系统分析师---UML图的七种图形

UML&#xff08;统一建模语言&#xff09;是一种用于软件设计和文档编写的标准图形化语言&#xff0c;它提供了多种图形来帮助开发人员和架构师在不同阶段理解和传达系统的结构和行为。以下是UML的七种主要图形及其含义&#xff0c;以及在需求分析、概念设计和详细设计中的使用…

Redis中的 大/热 key问题 ,如何解决(面试版)

big key 什么是 big key? big key&#xff1a;就是指一个内存空间占用比较大的键(Key) 造成的问题&#xff1a; 内存分布不均。在集群模式下&#xff0c;不同 slot分配到不同实例中&#xff0c;如果大 key 都映射到一个实例&#xff0c;则分布不均&#xff0c;查询效率也…

常见错误导引 不锈钢螺钉的正确选购和使用分析

紧固件或螺钉是用于固定物体的机械工具。它们用于各种场景&#xff0c;从建造房屋、用具、玩具等。紧固件由多种材料制成&#xff0c;所有这些材料都有特定用途紧固件和用途。一些用于制造螺丝的材料包括不锈钢、铁、铜、铝和塑料。它通常会进行某种表面处理以提高其防锈性和/或…

(亲测解决)Couldn‘t open file /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9

1、报错 Extra Packages for Enterprise Linux 9 - x86_64 0.0 B/s | 0 B 00:00 Curl error (37): Couldnt read a file:// file for file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9 [Couldnt open…

K8S持久化存储数据volumeMountsvolumes

环境&#xff1a; Ubuntu-1:192.168.114.110作为主 Ubuntu-2:192.168.114.120作为从1&#xff0c;node节点1 Ubuntu-3:192.168.114.130作为从2&#xff0c;node节点2 持久化volumeMounts pod里面&#xff1a;emptyDir和hostPath。存储在node&#xff0c;NFS...&#xff0c;Clo…

OD C卷 - 寻找最优的路测线路

寻找最优的路测线路&#xff08;200&#xff09; 给定一个m行、n列的数组&#xff08;路线网络&#xff09;&#xff0c;每个值代表当前位置的信号质量&#xff0c;越大信号越好&#xff1b;从 [0, 0] 到 [m-1, n-1]位置的路线中&#xff0c;最小值代表当前路线的评分&#xf…

高斯混合模型原理及Python实践

高斯混合模型&#xff08;Gaussian Mixture Model&#xff0c;简称GMM&#xff09;是一种统计学中的概率模型&#xff0c;用于表示由多个高斯分布&#xff08;正态分布&#xff09;混合组成的数据集合。其核心原理基于假设数据集中的每个数据点都是由多个潜在的高斯分布之一生成…

springboot项目使用本地依赖项,打包后出现NoClassDefFoundError的一种解决方法

可以把本地依赖项上传到本地仓库后再引用 建立 Maven 本地仓库并将依赖上传到本地仓库 要建立 Maven 本地仓库并将依赖上传到本地仓库&#xff0c;可以按照以下步骤进行操作&#xff1a; 1. 配置 Maven 本地仓库路径 Maven 默认会在用户的主目录下的 .m2/repository 目录创…

基于Modbus的MFC智能控制

1. 系统概述 利用LabVIEW通过Modbus 485协议实现对七星&#xff08;Sevenstar&#xff09;品牌质量流量控制器&#xff08;MFC&#xff09;的智能化控制。该系统将自动控制多个MFC的流速&#xff0c;实时监控其状态&#xff0c;并根据需要进行调整。 2. 硬件配置 MFCs: 七星品…

JavaScript学习文档(7):Web API、获取DOM对象、操作元素内容、元素属性、定时器-间歇函数

目录 一、Web API 1、作用和分类 2、DOM是什么 3、DOM树 4、DOM对象 &#xff08;1&#xff09;DOM对象如何创建的? &#xff08;2&#xff09;DOM对象怎么创建的? 二、获取DOM对象 1、根据CSS选择器来获取DOM元素 &#xff08;1&#xff09;选择匹配的第一个元素 …

Spring(2)

目录 一、使用注解开发 1.1 主要注解 1.2 衍生注解 1.3 xml与注解 二、使用Java的方式配置Spring 三、代理模式 3.1 静态代理 3.1.1 角色分析 3.1.2 代码步骤 3.1.3 优点 3.1.4 缺点 3.2 动态代理 3.2.1 代码步骤 四、AOP 4.1 使用Spring的API接口 4.2 使用自定义…

8月15日

上午开会 rag继续 异构大模型 狂野飙车9之前的账号终于找回来了 下午 关于minicpm的代码 minicpm-v 大模型预训练论文&方法总结 - 知乎 (zhihu.com) 这里有讲解的代码 发现还是先推荐把llava的掌握好了之后再看minicpm 多模态大模型LLaVA模型讲解——transformers源…

YoloV8改进策略:卷积篇|ACConv2d模块在YoloV9中的创新应用与显著性能提升|简单易用_即插即用

摘要 在本文中&#xff0c;我们创新性地将ACConv2d模块引入到YoloV9目标检测模型中&#xff0c;通过对YoloV9中原有的Conv卷积层进行替换&#xff0c;实现了模型性能的大幅提升。ACConv2d模块基于不对称卷积块&#xff08;ACB&#xff09;的设计思想&#xff0c;利用1D非对称卷…

sql server导入mysql,使用工具SQLyog

概述 需要将sql server的数据导入到mysql中&#xff0c;由于2种数据库存在各种差异&#xff0c;比如表字段类型就有很多不同&#xff0c;因此需要工具来实现。 这里使用SQLyog来实现。 SQLyog安装 安装过程参考文档&#xff1a;https://blog.csdn.net/Sunshine_liang1/article/…