qml package 的使用
什么时候使用这个。就是多个view使用同一个deleagte的时候。
The Package class is used in conjunction with VisualDataModel to enable delegates with a shared context to be provided to multiple views.
Any item within a Package may be assigned a name via the Package.name attached property.
The example below creates a Package containing two named items; list and grid. The third item in the package (the Rectangle) is parented to whichever delegate it should appear in. This allows an item to move between views.
Package {
Text { id: listDelegate; width: parent.width; height: 25; text: 'Empty'; Package.name: 'list' }
Text { id: gridDelegate; width: parent.width / 2; height: 50; text: 'Empty'; Package.name: 'grid' }
Rectangle {
id: wrapper
width: parent.width; height: 25
color: 'lightsteelblue'
Text { text: display; anchors.centerIn: parent }
state: root.upTo > index ? 'inGrid' : 'inList'
states: [
State {
name: 'inList'
ParentChange { target: wrapper; parent: listDelegate }
},
State {
name: 'inGrid'
ParentChange {
target: wrapper; parent: gridDelegate
x: 0; y: 0; width: gridDelegate.width; height: gridDelegate.height
}
}
]
transitions: [
Transition {
ParentAnimation {
NumberAnimation { properties: 'x,y,width,height'; duration: 300 }
}
}
]
}
}
These named items are used as the delegates by the two views who reference the special VisualDataModel::parts property to select a model which provides the chosen delegate.
DelegateModel {
id: visualModel
delegate: Delegate {}
model: myModel
}
ListView {
id: lv
height: parent.height/2
width: parent.width
model: visualModel.parts.list
}
GridView {
y: parent.height/2
height: parent.height/2
width: parent.width
cellWidth: width / 2
cellHeight: 50
model: visualModel.parts.grid
}
qml package 的使用的更多相关文章
- 怎样得到QML package的具体API接口
虽然我们的developer站点有丰富的API介绍,可是,有些API的介绍可能并不全,有些API也在不断地演进中. 为了得到更具体的API,我们能够通过例如以下的命令来得到更加具体的信息.比方我们对& ...
- qml支持多平台的编译--尤其对于需要支持xp的情况
http://www.oschina.net/p/deepin-boot-maker 系统支持: Windows平台: Windows 7/ Windows 8 需要安装显卡驱动 Windows XP ...
- A package manager for Qt
官网 http://www.qpm.io/ A package manager for Qt 注释:这个网站类似JavaScript的包管理器的网站https://www.npmjs.com/ 都是给 ...
- ubuntu下使用golang、qml与ubuntu sdk开发桌面应用
ubuntu下使用golang.qml与ubuntu sdk开发桌面应用 (简单示例) 找了很长时间go的gui库,试了gtk,准备试qt的时候发现了这个qml库,试了下很好用. 准备工作 1.Go ...
- ruby TkPackage can't find package BWidget 之解决办法
一个特别短的ruby/tk代码: require 'tkextlib\iwidgets' require 'tkextlib\bwidget' x = 0 101.times {|i| x+=i} T ...
- ubuntu下使用golang、qml与ubuntu sdk开发桌面应用 (简单示例)
找了很长时间go的gui库,试了gtk,准备试qt的时候发现了这个qml库,试了下很好用. ##准备工作 **1.Go 1.2RC1** go的版本应该不能低于这个,我是在1.2RC发布当天升级后发现 ...
- 查看QML数据类型
assist输入: QML Types A Abstract3DSeries AbstractActionInput AbstractAnimation AbstractAxis AbstractAx ...
- NPM (node package manager) 入门 - 基础使用
什么是npm ? npm 是 nodejs 的包管理和分发工具.它可以让 javascript 开发者能够更加轻松的共享代码和共用代码片段,并且通过 npm 管理你分享的代码也很方便快捷和简单. 截至 ...
- npm package.json属性详解
概述 本文档是自己看官方文档的理解+翻译,内容是package.json配置里边的属性含义.package.json必须是一个严格的json文件,而不仅仅是js里边的一个对象.其中很多属性可以通过np ...
随机推荐
- S3C2440的GPIO编程
一.初步认识S3C2440A [S3C2440A简介] S3C2440A是三星公司推出的基于ARM920t内核的32/16位RISC微处理器.主要用于手持设备和中高端电子产品中.它内部集成16k数据c ...
- Redis学习记录之————微博项目
Key设计 全局相关的key: 表名 global 列名 操作 备注 Global:userid incr 产生全局的userid Global:postid Incr 产生全局的postid 用户相 ...
- 应用部署到JBOSS上遇到的问题
原来应用在WAS7.0下,移植到JBOSS eap5.1.2下后,遇到了一些问题,特此记录: 1.数据源配置 在was中,datasource中获取数据源名称时,直接写was中配置的数据源名称即可.而 ...
- (二)miller指导查看主控板寄存器操作
Welcome to Command Shell!Username:admin Password:***** ROS>en ROS# ROS# ROS# ROS# ROS#^ada ROS(ad ...
- 2 CSS
2 CSS CSS基础 html 在一个网页中负责的事情是一个页面的结构css(层叠样式表) 在一个网页中主要负责了页面的数据样式. 编写css代码的方式: 第一种: 在style标签中编写c ...
- Android LayoutInflater 动态地添加删除View
我想实现点击一个按钮(或其他的事件)添加或删除View,网上找到了LayoutInflater这个类. 下面是我自己一些经验: android官网上LayoutInflater的API:http:// ...
- Android面试题整理【转载】
面试宝典(5) http://www.apkbus.com/android-115989-1-1.html 面试的几个回答技巧 http://blog.sina.com.cn/s/blog_ad ...
- git123
一:安装git和配置 1.下载 Git for windows,双击开始安装,一路采取默认选项,一路next,即可安装完毕.为了在你的电脑和github之间建立安全连接,需要SSH keys,所以你需 ...
- 慢慢聊Linux AIO
一.What:异步IO是什么? 1. 一句话总结 允许进程发起很多I/O操作,而不用阻塞或等待任何操作完成 2. 详细说说 一般来说,服务器端的I/O主要有两种情况:一是来自网络的I/O:二是对文件 ...
- hiho_1069_最近公共祖先3
题目 给出一棵家族树,树上的节点可以由名字唯一标识.给出若干个查询,查询的内容为两个名字,结果为两个名字的最近公共祖先. 题目链接: 最近公共祖先 分析 在线的RMQ + LCA 算法,先用dfs将树 ...