依附于Flickable组件的滚动轴
    自动放置在恰当位置
    拖动时显示,不动时消失
Lisence: MIT 请保留此声明
Author: surfsky.cnblogs.com 2014-12

【先看效果】

【下载】

http://download.csdn.net/detail/surfsky/8426563

【核心代码】

 ScrollBar {
id: root
opacity: 0
orientation: Qt.Vertical // 绑定到Flickable组件
property Flickable target : Flickable{} // 位置
width: orientation==Qt.Vertical ? 10 : target.width-10
height: orientation==Qt.Vertical ? target.height-10 : 10
anchors.right: orientation==Qt.Vertical ? target.right : undefined
anchors.bottom: orientation==Qt.Vertical ? undefined : target.bottom // 滚动
position: orientation==Qt.Vertical ? target.visibleArea.yPosition : target.visibleArea.xPosition
pageSize: orientation==Qt.Vertical ? target.visibleArea.heightRatio : target.visibleArea.widthRatio // 移动时显隐滚动轴
Connections{
target: root.target
onMovingVerticallyChanged: {
if (target.movingVertically)
fadeIn.start();
else
fadeOut.start();
}
onMovingHorizontallyChanged: {
if (target.movingHorizontally)
fadeIn.start();
else
fadeOut.start();
}
}
NumberAnimation { id:fadeIn; target: root; properties: "opacity"; duration: 400; from:0; to:1 }
NumberAnimation { id:fadeOut; target: root; properties: "opacity"; duration: 400; from:1; to:0 }
}

【调用示例】

     FlickableScrollBar {
target: view
orientation: Qt.Vertical
}

qt qml scrollbar 移动APP风格的滚动轴的更多相关文章

  1. Qt qml listview 列表视图控件(下拉刷新、上拉分页、滚动轴)

    Qt qml listview下拉刷新和上拉分页主要根据contentY来判断.但要加上顶部下拉指示器.滚动条,并封装成可简单调用的组件,着实花了我不少精力:) [先看效果]    [功能] 下拉刷新 ...

  2. Qt QML referenceexamples attached Demo hacking

    /********************************************************************************************* * Qt ...

  3. Qt qml的软件架构设计

    google: qt qml application architecture 有很多资源. 1 https://www.ics.com/blog/multilayered-architecture- ...

  4. Qt列表等控件实现平滑滚动&deepin启动器存在的问题

    Qt列表等控件实现平滑滚动 Qt自带的的列表控件是不能平滑滚动的,但如果滚动速度快的话很容易引起视线丢失,体验效果很差.本篇主要讲述如何在Qt中对列表控件加入平滑滚动.文中以QScrollArea控件 ...

  5. Qt qml 单例模式

    Qt qml 单例模式,没什么好说的,看代码吧.单例模式很适合做全局的配置文件. [示例下载] http://download.csdn.net/detail/surfsky/8539313 [以下是 ...

  6. qt qml qchart 图表组件

    qt qml qchart 图表组件 * Author: Julien Wintz * Created: Thu Feb 13 23:41:59 2014 (+0100) 这玩意是从chart.js迁 ...

  7. Android学习第八弹之改变状态栏的颜色使其与APP风格一体化

    公众号:smart_android 作者:耿广龙|loonggg 点击"阅读原文",可查看更多内容和干货 导语:沉浸式状态栏,改变状态栏的颜色使之与APP风格一体化是不是感觉很漂亮 ...

  8. qt qml中PropertyAnimation的几种使用方法

    qml文章 qt qml中PropertyAnimation的几种使用方法 动画应用场景有以下几种: 首先如果一个Rectangle.动画是要改变它的x和y值 1,Rectangle一旦被创建,就要移 ...

  9. 根据对象属性查找对象或者数组(根据对象属性查找某数组内符合该条件的对象,数组内对象属性check为true的对象,存放到数组内) 滚动轴样式

      1.根据对象属性查找某数组内符合该条件的对象. optionComwords:[ {optionName:"名称1", optionCode: '1'}, {optionNam ...

随机推荐

  1. uedit修改文件上传路劲,支持api文件接口

    首先修改一个东西ueditor/ueditor.config.js serverUrl: URL + "php/controller.php" 原来 serverUrl: &quo ...

  2. vpn

    https://itunes.apple.com/us/app/sonicwall-mobile-connect/id822514576?mt=12

  3. A Taxonomy of Parallel Processor Architectures

    COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION

  4. c语言编程

    1.常量和变量:变量是一块内存空间,该内存空间有类型约束,该内存中存放的数据可变. 变量三要素:类型,名称,值.常量:常量的数据永远不变,a:自变量,b:符合常量,c:预定义常量. 2.运算符和返回类 ...

  5. json转js对象

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  6. 【爬虫】BeautifulSoup之爬取百度贴吧的帖子

    在网上看到爬百度贴吧的例子,仿照写了一个用BeautifulSoup实现的,直接上代码吧 #coding:gbk import urllib2 from bs4 import BeautifulSou ...

  7. Hyper-V 2012 R2 故障转移群集之建立域控(AD DS)与加入域

    Windows  2012 R2建立域控(AD DS)与加入域 Active Directory概述:          使用 Active Directory(R) 域服务 (AD DS) 服务器角 ...

  8. LuaSrcDiet工具介绍(lua源码处理软件)

    Diet Food Diet (nutrition), the sum of the food consumed by an organism or group Dieting, the delibe ...

  9. Python模块和包

    模块和包是python组织代码的基本方式. 模块: python的每一个脚本文件都可称之为模块,模块的名称就是脚本的文件名.例如当我们写了一个test.py的脚本文件,则可以在同目录下的另外一个脚本m ...

  10. Spark on Yarn:java.sql.SQLException: No suitable driver found for jdbc:microsoft:sqlserver://localhost\\db_instance_name:1433;databaseName=db_name

    本文只是针对当前特定环境下,出现的问题找不到sqljdbc驱动的案例.具体出现原因,可能是spark版本问题,也可能是集群配置问题. yarn-client方式下: 通过--jars参数指定驱动文件位 ...