1、pagestack进行页面调整的时候,需要对页面状态做一些跟踪:

Stack.onStatusChanged: {

if (Stack.status == Stack.Active) { //可以判断是否跳转完成

isPageReady = true

} else if (Stack.status == Stack.Inactive) {

isPageReady = false

}

}

2、qml中信号的使用

A.qml 中有一个函数实现

//选择案件后的回调事件

function setCaseInfo(name,legalid){

var info = {};

info.name = name;

info.legalid = legalid;

    caseText.text = name;
downloadRec.caseId = legalid;
var result = Storage.insert("caseinfo",JSON.stringify(info));
}

动态创建一个页面B并获取返回值:

MouseArea{

id : caseArea

anchors.fill: parent

onClicked: {

var content = Case.createElement("../caseStudy/AddCaseWin.qml",null);

content.caseselected.connect(setCaseInfo);

}

}

B页面有一个信号

signal caseselected(string name,int caseid)

B页面调用C组件:

ListView{

anchors.fill: parent

spacing: 25*screen.scale

clip: true

delegate: AddCaseItem{}

model:caseListModel

orientation:ListView.Horizontal

}

C组件则实现具体的参数透传:

MouseArea{

anchors.fill: parent

onClicked: {

caseselected(desction,legalid);

closeWin();

}

}

3.设置内部元素

default property alias contents: contents.data

    Item {
id: contents width: flickable.width
height: autoFlick ? childrenRect.height : flickable.height
}

根据官方的意思:

data是默认属性,相当于子控件。childrenRect是用来访问子元素的宽高等信息

4.遍历指定类型的元素:

function getFlickableChild(item) {

if (item && item.hasOwnProperty("children")) {

for (var i=0; i < item.children.length; i++) {

var child = item.children[i];

if (internal.isVerticalFlickable(child)) {

if (child.anchors.top === page.top || child.anchors.fill === page) {

return item.children[i];

}

}

}

}

return null;

}

如何构建qml的模版:

They use default property alias ... to alias the child items to any property of any item. If you don't want to alias the children but give the alias property a name, just remove default. (Literal children are per QML definition the value of the default property.)

Item {

id: button

default property alias contents: placeholder.children

anchors.fill: parent

Rectangle {
anchors.fill: parent
radius: 10
color: "gray" Item {
id: placeholder <-- where the placeholder should be inserted
}
}

}

一个更具体的例子:

Dialog {

id: actionableDialog

title: "Change Text"

hasActions: true

    TextField {
id: optionText
text: currentText
width: parent.width
placeholderText: "New Option to Confirm"
} onAccepted: {
currentText = optionText.text
}
}

Dialog.qml

PopupBase {

id: dialog

overlayLayer: "dialogOverlayLayer"
overlayColor: Qt.rgba(0, 0, 0, 0.3) opacity: showing ? 1 : 0
visible: opacity > 0 width: Math.max(minimumWidth,
content.contentWidth + 2 * contentMargins) height: Math.min(units.dp(350),
headerView.height + units.dp(32) +
content.contentHeight +
content.topMargin +
content.bottomMargin +
buttonContainer.height) property int contentMargins: units.dp(16) property int minimumWidth: units.dp(270) property alias title: titleLabel.text
property alias text: textLabel.text /*!
\qmlproperty Button negativeButton The negative button, displayed as the leftmost button on the right of the dialog buttons.
This is usually used to dismiss the dialog.
*/
property alias negativeButton: negativeButton /*!
\qmlproperty Button primaryButton The primary button, displayed as the rightmost button in the dialog buttons row. This is
usually used to accept the dialog's action.
*/
property alias positiveButton: positiveButton property string negativeButtonText: "Cancel"
property string positiveButtonText: "Ok"
property alias positiveButtonEnabled: positiveButton.enabled property bool hasActions: true default property alias dialogContent: column.data

Flickable {

id: content

        contentWidth: column.implicitWidth
contentHeight: column.height
clip: true anchors {
left: parent.left
right: parent.right
top: headerView.bottom
topMargin: units.dp(8)
bottomMargin: units.dp(-8)
bottom: buttonContainer.top
} interactive: contentHeight + units.dp(8) > height
bottomMargin: hasActions ? 0 : units.dp(8) Rectangle {
Column {
id: column
anchors {
left: parent.left
margins: contentMargins
} width: content.width - 2 * contentMargins
spacing: units.dp(16)
}
}
}

}

qml 一些知识点的更多相关文章

  1. QML学习(一)——<简要概念知识点>

    转载:https://www.cnblogs.com/dengyg0710/p/10644936.html 1.一个 QML 文档有且只有一个根元素. 2.QML 元素名后所有内容使用 {} 包围起来 ...

  2. qml: QtChart横纵轴label设置;

    在qml中,使用ChartView作为图表展示区域, 但是并没有给定接口用来设置xlabel,ylabel. 没得办法,只能采用笨方案: (我的方法如下) import QtQuick 2.0 imp ...

  3. ASP.NET Core 中的那些认证中间件及一些重要知识点

    前言 在读这篇文章之间,建议先看一下我的 ASP.NET Core 之 Identity 入门系列(一,二,三)奠定一下基础. 有关于 Authentication 的知识太广,所以本篇介绍几个在 A ...

  4. ASP.NET MVC开发:Web项目开发必备知识点

    最近加班加点完成一个Web项目,使用Asp.net MVC开发.很久以前接触的Asp.net开发还是Aspx形式,什么Razor引擎,什么MVC还是这次开发才明白,可以算是新手. 对新手而言,那进行A ...

  5. UWP开发必备以及常用知识点总结

    一直在学UWP,一直在写Code,自己到达了什么水平?还有多少东西需要学习才能独挡一面?我想对刚接触UWP的开发者都有这种困惑,偶尔停下来总结分析一下还是很有收获的! 以下内容是自己开发中经常遇到的一 ...

  6. C#高级知识点&(ABP框架理论学习高级篇)——白金版

    前言摘要 很早以前就有要写ABP高级系列教程的计划了,但是迟迟到现在这个高级理论系列才和大家见面.其实这篇博客很早就着手写了,只是楼主一直写写停停.看看下图,就知道这篇博客的生产日期了,谁知它的出厂日 ...

  7. lucene 基础知识点

    部分知识点的梳理,参考<lucene实战>及网络资料 1.基本概念 lucence 可以认为分为两大组件: 1)索引组件 a.内容获取:即将原始的内容材料,可以是数据库.网站(爬虫).文本 ...

  8. DoraCMS 源码知识点备注

    项目需要研究了下DoraCMS这款开源CMS,真心做的不错:).用的框架是常用的express 4 + mongoose,代码也很规范,值得学习. 源码中一些涉及到的小知识点备注下: https:// ...

  9. atitit 商业项目常用模块技术知识点 v3 qc29

    atitit 商业项目常用模块技术知识点 v3 qc29 条码二维码barcodebarcode 条码二维码qrcodeqrcode 条码二维码dm码生成与识别 条码二维码pdf147码 条码二维码z ...

随机推荐

  1. HDU 1754

    成段更新 easy #include <stdio.h> #include <string.h> #include <math.h> #include <io ...

  2. mysql概要(六)连接

    内连接 [join on / from 表1,表二 ]效果一样 区别是:可以理解为首先取得笛卡儿积后,再 内连接:取俩表的匹配数据: 左连接:取的俩表匹配数据,并且保留未匹配数据中左表的数据,右表数据 ...

  3. [转载] 一共81个,开源大数据处理工具汇总(下),包括日志收集系统/集群管理/RPC等

    原文: http://www.36dsj.com/archives/25042 接上一部分:一共81个,开源大数据处理工具汇总(上),第二部分主要收集整理的内容主要有日志收集系统.消息系统.分布式服务 ...

  4. asp.net开发中经常用到的方法

    ---天气插件--- <iframe width="560" scrolling="no" height="23" framebord ...

  5. 转:The Knuth-Morris-Pratt Algorithm in my own words

    The Knuth-Morris-Pratt Algorithm in my own words For the past few days, I’ve been reading various ex ...

  6. HTTP请求过程详解

    以请求新浪的首页为例,总结HTTP请求的流程: 步骤1:浏览器首先向服务器发送HTTP请求,请求包括: 方法:GET还是POST,GET仅请求资源,POST会附带用户数据: 路径:/full/url/ ...

  7. Css_Backgroud-position(背景图片)定位问题详解

    background-position的说明:    设置或检索对象的背景图像位置.必须先指定 background-image 属性.该属性定位不受对象的补丁属性( padding )设置影响.   ...

  8. entity refenrece 在views中的运用

    在一个content type中有一个field是entity reference, 那么这个字段的设置过程中会指定一个entity type和content type和一个具体内容的选择器, 然后到 ...

  9. virtualbox虚拟机上安装centOS的网络配置(安装centos时选择桥接网络)

    最近接触hadoop,需要在在Linux上面开发,所以我装了一个virtualbox虚拟机,在该虚拟机上面安装了一个centOS系统.linux系统是装好了,但是网络配置却另人头疼.我主要是想让宿主机 ...

  10. css选择符有哪些?哪些属性可以继承?优先级算法如何计算?内联和important哪个优先

    通配选择符* { sRules }  类型选择符E { sRules }  td { font-size:14px; width:120px; }   属性选择符 E [ attr ] { sRule ...