代码import QtQuick import QtQuick.Controls import FluentUI Item { property bool autoPlay: true property int loopTime: 2000 property var model property Component delegate property bool showIndicator: true property int indicatorGravity : Qt.AlignBottom | Qt.AlignHCenter property int indicatorMarginLeft: 0 property int indicatorMarginRight: 0 property int indicatorMarginTop: 0 property int indicatorMarginBottom: 20 property int indicatorSpacing: 10 property alias indicatorAnchors: layout_indicator.anchors property Component indicatorDelegate : com_indicator id:control width: 400 height: 300 ListModel{ id:content_model } QtObject{ id:d property bool flagXChanged: true property bool isAnimEnable: control.autoPlay list_view.count3 function 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 0 list_view.currentIndex 1 list_view.highlightMoveDuration 250 if(d.isAnimEnable){ timer_run.restart() } } } ListView{ id:list_view anchors.fill: parent snapMode: ListView.SnapOneItem clip: true boundsBehavior: ListView.StopAtBounds model:content_model maximumFlickVelocity: 4 * (list_view.orientation Qt.Horizontal ? width : height) preferredHighlightBegin: 0 preferredHighlightEnd: 0 highlightMoveDuration: 0 Component.onCompleted: { d.setData(control.model) } interactive: list_view.count3 Connections{ target: control function onModelChanged(){ d.setData(control.model) } } orientation : ListView.Horizontal delegate: Item{ id:item_control width: ListView.view.width height: ListView.view.height property int displayIndex: { if(index 0) return content_model.count-3 if(index content_model.count-1) return 0 return index-1 } FluLoader{ property int displayIndex : item_control.displayIndex property var model: list_view.model.get(index) anchors.fill: parent sourceComponent: { if(model){ return control.delegate } return undefined } } } onMovementEnded:{ currentIndex list_view.contentX/list_view.width if(currentIndex 0){ currentIndex list_view.count-2 }else if(currentIndex list_view.count-1){ currentIndex 1 } d.flagXChanged false timer_run.restart() } onMovementStarted: { d.flagXChanged true timer_run.stop() } onContentXChanged: { if(d.flagXChanged){ var maxX Math.min(list_view.width*(currentIndex1),list_view.count*list_view.width) var minY Math.max(0,(list_view.width*(currentIndex-1))) if(contentXmaxX){ contentX maxX } if(contentXminY){ contentX minY } } } } Component{ id:com_indicator Rectangle{ width: 8 height: 8 radius: 4 FluShadow{ radius: 4 } scale: checked ? 1.2 : 1 color: checked ? FluTheme.primaryColor : Qt.rgba(1,1,1,0.7) border.width: mouse_item.containsMouse ? 1 : 0 border.color: FluTheme.primaryColor MouseArea{ id:mouse_item hoverEnabled: true anchors.fill: parent onClicked: { changedIndex(realIndex) } } } } Row{ id:layout_indicator spacing: control.indicatorSpacing anchors{ horizontalCenter:(indicatorGravity Qt.AlignHCenter) ? parent.horizontalCenter : undefined verticalCenter: (indicatorGravity Qt.AlignVCenter) ? parent.verticalCenter : undefined bottom: (indicatorGravity Qt.AlignBottom) ? parent.bottom : undefined top: (indicatorGravity Qt.AlignTop) ? parent.top : undefined left: (indicatorGravity Qt.AlignLeft) ? parent.left : undefined right: (indicatorGravity Qt.AlignRight) ? parent.right : undefined bottomMargin: control.indicatorMarginBottom leftMargin: control.indicatorMarginBottom rightMargin: control.indicatorMarginBottom topMargin: control.indicatorMarginBottom } visible: showIndicator Repeater{ id:repeater_indicator model: list_view.count FluLoader{ property int displayIndex: { if(index 0) return list_view.count-3 if(index list_view.count-1) return 0 return index-1 } property int realIndex: index property bool checked: list_view.currentIndex index sourceComponent: { if(index0 || indexlist_view.count-1) return undefined return control.indicatorDelegate } } } } Timer{ id:timer_anim interval: 250 onTriggered: { list_view.highlightMoveDuration 0 if(list_view.currentIndex list_view.count-1){ list_view.currentIndex 1 } } } Timer{ id:timer_run interval: control.loopTime repeat: d.isAnimEnable onTriggered: { list_view.highlightMoveDuration 250 list_view.currentIndex list_view.currentIndex1 timer_anim.start() } } function changedIndex(index){ d.flagXChanged true timer_run.stop() list_view.currentIndex index d.flagXChanged false if(d.isAnimEnable){ timer_run.restart() } } }效果参考https://github.com/zhuzichu520/FluentUIGitHub - zhuzichu520/FluentPlayerGitHub - zhuzichu520/QtHubhttps://blog.51cto.com/u_6343747/5465068Felgo简介--Qt开发者的福音-CSDN博客创作不易小小的支持一下吧
企业数字化 ERP 产品动态
相关推荐
C++实现web token加密生成验证 /* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views … · 2026/11/2 14:56:12
HarmonyOS介绍真题 /* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views … · 2026/11/2 14:56:12
面试谈薪实战指南:一个被拒过、也被抢过的人,写给你的真心话 /* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views … · 2026/11/2 14:55:10
AI内容格式转换全攻略:Typora、飞书与AI导出鸭对比 1. 问题背景与痛点分析在日常使用DeepSeek等AI平台时,我们经常需要将生成的内容复制到Word文档中。但这个过程往往会遇到令人抓狂的格式问题:数学公式变成乱码、表格边框神秘消失、文字间距错乱不堪。这些问题不仅影响文档美观,更会严重降低工… · 2026/11/2 20:59:02
VoiceStudio实战指南:从录音、AI配音到声音克隆 1. VoiceStudio 到底解决什么问题第一次听到 VoiceStudio 这个名字,我以为是某个录音棚的配套软件。实际上它是一个把“录声音、修声音、造声音、合成声音”全部装进同一个工作流的语音创作项目。简单说,你既可以拿它录一段真实的语音,也能用… · 2026/11/2 20:59:02
智能经济新形态:技术架构与产业实践解析 1. 政策与产业动态解读:智能经济新形态的底层逻辑2023年政府工作报告首次提出"打造智能经济新形态"的战略方向,这标志着我国数字经济发展进入深水区。从技术架构层面看,智能经济新形态包含三个核心要素:数据要素市场化配… · 2026/11/2 20:59:02
智能喂鸟器边缘计算实践:算法合规与本地化部署 1. 项目背景与核心挑战去年帮朋友改造花园时,我注意到他书架上积灰的智能喂鸟器——这个曾众筹百万美元的产品,最终因数据合规问题被迫退出欧洲市场。这让我意识到:硬件出海只是第一步,算法合规才是真正的生死线。智能喂鸟器的核心… · 2026/11/2 20:59:02
后见之明偏差:如何把“事后诸葛”变成决策校准工具 你有没有过这样的经历:项目上线之后出了事故,你一拍大腿——“我早就觉得这个方案有问题!”结果翻出当时的聊天记录,你原话明明是“这个方案可以试试”。这种“事后什么都清楚”的感觉,英语里有个专门的说法叫hindsigh… · 2026/11/2 20:59:02
网页天气可视化工具开发:API调用与Canvas渲染实践 1. 项目概述:网页天气可视化工具开发实录去年夏天连续两周的暴雨预警让我意识到,市面上大多数天气应用都只提供枯燥的数字预报。作为前端开发者和数据可视化爱好者,我决定动手打造一个能直观展现天气变化的网页应用。这个项目融合了第三方天气… · 2026/11/2 20:58:01
双极步进电机控制实战:DRV8818PWPR与PIC18F86K22驱动调试 /* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views … · 2026/11/2 13:10:28
STM32F207ZG + DRV8818PWPR 步进电机驱动实战解析 /* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views … · 2026/11/2 4:42:45
DRV8818PWPR+dsPIC30F4013工业级双极步进电机控制方案 /* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views … · 2026/11/2 5:17:18
雷达信号调制技术解析:从LFM到伪线性调频原理与应用 /* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views … · 2026/11/2 1:01:15
基于MAX14431与TM4C123的工业SPI隔离电路设计全攻略 /* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views … · 2026/11/2 1:01:15
PLFM_RADAR:相位线性调频雷达信号处理框架 /* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views … · 2026/11/2 1:01:15
双极步进电机控制实战:DRV8818PWPR与PIC18F86K22驱动调试 /* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views … · 2026/11/2 13:10:28
STM32F207ZG + DRV8818PWPR 步进电机驱动实战解析 /* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views … · 2026/11/2 4:42:45
DRV8818PWPR+dsPIC30F4013工业级双极步进电机控制方案 /* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views … · 2026/11/2 5:17:18