QML的SwipeView控件去除滑动效果

SwipeView默认是带滑动效果的,在做app主页的导航界面,不想让它有滑动效果。

 

Customizing Qt Labs Controls (使用的是Qt5.6)里提到:

SwipeView can have a visual background item. The navigation is implemented by the content item.

SwipeView由背景和content item组成,导航是content item,是一个ListView 。

 

Background

SwipeView has no background item by default.

Content item

contentItem: ListView {

model: control.contentModel

currentIndex: control.currentIndex

spacing: control.spacing

orientation: Qt.Horizontal

snapMode: ListView.SnapOneItem

boundsBehavior: Flickable.StopAtBounds

highlightRangeMode: ListView.StrictlyEnforceRange

preferredHighlightBegin: 0

preferredHighlightEnd: 0

highlightMoveDuration: 250

  }

 

其中highlightMoveDuration属性控制切换速度,可以修改此项为0,使移动动画时间为0。

更多的说明可以直接看ListView属性即可。

 

比如简单地在SwipeView里设置以下代码即可:

        Component.onCompleted:

            contentItem.highlightMoveDuration = 0

 

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值