QML的默认属性default property
qml中,普通的属性,需要添加属性名称,属性内容,如
color: “red”
默认属性则可以直接书写,去掉方括号,在写重用的QML组件式比较有用,例如将一个QmL外部资源封装好,内部具体的item,有子对象去填充。见代码
MyColumn.qml文件:
import QtQuick 2.0
Item
{
default property alias col: myCol.children
Column {
id:myCol
anchors.fill: parent
}
}
main文件:
import QtQuick 2.2
Rectangle {
id:root
width: 860
height: 860
MyColumn
{
anchors.fill: parent
Rectangle
{
color:"red"
width: 100; height:100
}
Rectangle
{
color:"green"
width: 100; height:200
}
Rectangle
{
color:"blue"
width: 100; height:100
}
}
}
参考:http://developer.blackberry.com/native/documentation/cascades/ui/custom_components/
QML的默认属性default property的更多相关文章
- How to: Initialize Business Objects with Default Property Values in XPO 如何:在 XPO 中用默认属性值初始化业务对象
When designing business classes, a common task is to ensure that a newly created business object is ...
- How to: Initialize Business Objects with Default Property Values in Entity Framework 如何:在EF中用默认属性值初始化业务对象
When designing business classes, a common task is to ensure that a newly created business object is ...
- iOS @property的默认属性
我是一个比较懒的人,很多情况下@property都不喜欢加属性…所以必须了解默认情况下哪些是已经有的,哪些在需要时是必须要加的. 原文链接:http://blog.sina.com.cn/s/blog ...
- Android属性(property)机制
1. 属性简介 Android里有很多属性(property),每个属性都有一个名称和值,他们都是字符串格式.这些属性定义了Android系统的一些公共系统属性.比如: [dalvik.vm.dexo ...
- VB默认属性、动态数组、Range对象的默认属性的一点不成熟的想法
1.默认属性 VB6.0有默认属性的特性.当没有给对象指定具体的属性时,"默认属性"是VB6.0将使用的属性.在某些情形下,省略常用属性名,使代码更为精简. 因为CommandBu ...
- 查看特定View的默认属性值
当我在分析focus.touch事件处理代码时发现,有些属性对代码的逻辑有非常重要的影响,比如clickable.focusable 这些属性.这时我们自然而然的想到,那么这些属性的默认值是什么呢?在 ...
- Android动画主要包含补间动画(Tween)View Animation、帧动画(Frame)Drawable Animation、以及属性动画Property Animation
程序运行效果图: Android动画主要包含补间动画(Tween)View Animation.帧动画(Frame)Drawable Animation.以及属性动画Property Animatio ...
- Objective-C:属性(@property)
@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/c ...
- TypeScript 3.0下react默认属性DefaultProps解决方案
ts和react的默认属性的四种解决方案 Non-null assertion operator(非空断言语句) Component type casting(组件类型重置) High order f ...
随机推荐
- CodeForces - 963B Destruction of a Tree (dfs+思维题)
B. Destruction of a Tree time limit per test 1 second memory limit per test 256 megabytes input stan ...
- Java-API-POI:POI 笔记
ylbtech-Java-API-POI:POI 笔记 1. 笔记一返回顶部 1. 1,POI对JDK版本支持及XLSX (2017-04-01 13:51:39)对JDK6的支持,最后版本是POI- ...
- [Java.Web][Servlet]读取配置
private ServletConfig config; public void doGet(HttpServletRequest request, HttpServletResponse resp ...
- Warning: require(D:\wamp\www\glink-smart\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in D:\wamp\www\glink-smart\bootstrap\autoload.php on line 1
Laravel访问出错错误信息:`Warning: require(/vendor/autoload.php): failed to open stream: No such file or dire ...
- VNC跨平台远程桌面的安装与使用
1.安装:yum install tigervnc-server -y 2.设置自启动: chkconfig vncserver on 3.配置文件:vim /etc/sysconfig/vncser ...
- FreeRADIUS 、DaloRADIUS 搭建记录
一. 安装环境 系统环境:centos6.5 IP:192.168.30.242 hostname:vpn.org 软件:PPTP.LAMP均已安装.(请确保这些正常安装,并能使用). 二. 软件 ...
- Word域介绍文章
https://www.cnblogs.com/ahuo/archive/2007/05/04/735520.html pageref 书签名 :返回书签所在页码 styleref 标题 1 在当前位 ...
- svn删除
[本地删除.然后提交到服务器]与[服务器删除然后本地更新] svn delete svn://路径(目录或文件的全路径) -m “删除备注信息文本” 推荐如下操作: svn delete 文件名 sv ...
- day-9心得
操作系统发展史 手工操作(无操作系统) 1946年第一台计算机诞生--20世纪50年代中期,还未出现操作系统,计算机工作采用手工操作方式. 手工操作程序员将对应于程序和数据的已穿孔的纸带(或卡片)装入 ...
- Php函数set_include_path()函数详解
set_include_path--设置include_path配置选项. 说明 string set_include_path(string $new_include_path); 为当前脚本设置i ...