类似老虎机的数字滚动选择器

qml实现数字滚动选择器

效果图
在这里插入图片描述
list view 实现
model是需要显示的数据,可通过设置最小值最大值以及步长控制
核心代码
(代理可以变成图标)

 delegate: Rectangle{
            width: root.width
            height: root.height
            color: "pink"
            Text {
                id:numText
                text: num
                anchors.centerIn: parent
                font.bold: true
                font.pointSize: listView.currentIndex == index ? 50 : 35
                color: listView.currentIndex == index ? "#00BFFF": "black"
                //font.pointSize:25
            }
            MouseArea{
                anchors.fill: parent
                onClicked: {
                    listView.currentIndex = index
                    sig_NumSelected(num)
                    // parent.forceActiveFocus()  //强制获得焦点,用于在失去焦点时候切换状态
                }
            }
        }

使用方式


    MyNumSelecter{
        anchors.centerIn: parent
        numWid:100      //代理 宽度
        numHeight:100  //代理高度
        min:30    //最小值
        max: 100  //最大值
        step: 10   //步长
    }

资源
https://download.csdn.net/download/qq_36234113/12611354

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值