当前位置: 首页 > news >正文

嘉祥网站建设哪家便宜网站seo优化皆宣徐州百都网络不错

嘉祥网站建设哪家便宜,网站seo优化皆宣徐州百都网络不错,2019年 dede网站,开锁换锁公司网站模板LIstModel(列表模型) ListModel 是ListElement定义的简单容器,每个定义都包含数据角色。内容可以在 QML 中动态定义或显式定义。 属性: count模型中数据条目的数量dynamic动态角色,默认情况下,角色的类型…

LIstModel(列表模型)

ListModel 是ListElement定义的简单容器,每个定义都包含数据角色。内容可以在 QML 中动态定义或显式定义。

属性:

count模型中数据条目的数量
dynamic动态角色,默认情况下,角色的类型在首次使用角色时是固定的

方法:

append()添加新项到模型末尾
clear()从模型中删除所有内容
get(int index)返回列表模型中索引处的项。这允许从 JavaScript 访问或修改项目数据:
insert()将新项添加到位于位置索引的列表模型中,并将值置于字典
move()将 n 个项目从一个位置移动到另一个位置
remove()从模型中删除索引处的内容
set()更改列表模型中索引处的
setProperty()修改指定位置的属性
sync()从工作线程脚本修改列表模型后,将任何未保存的更改写入列表模型。

在列表容器中添加列表项:

ListElement添加的规则:

  1. 必须以小写字母开头,并且对于给定模型中的所有元素都应通用
  2. 值必须是简单的常量;字符串
  3. 布尔值(真、假)、数字或枚举值
ListModel{id:model1ListElement{    //使用ListElement添加列表数据项name:"1111"age:"12"}ListElement{name:"2222"age:"13"}}

使用ListView显示:

使用ListView获取ListModel通过delegate(委托)来选择格式来显示数据

ListModel{id:model1ListElement{name:"1111"age:"12"}ListElement{name:"2222"age:"13"}}ListView{anchors.fill: parentmodel: model1delegate:  Row{Text{text:"名字:"+name}Text{text:"年龄:"+age}}}

 使用Component(组键)包装,用来显示信息:

Window {id:window1visible: truewidth: 700height: 700title: qsTr("Hello World")ListModel{id:model1ListElement{name:"1111"age:"12"}ListElement{name:"2222"age:"13"}}Component{id:component1Row{spacing: 10Text{text:"名字:"+name}Text{text:"年龄:"+age}}}ListView{anchors.fill: parentmodel: model1delegate: component1  //设置委托}
}

在ListElement中嵌套ListElement的处理:

 ListModel {id: fruitModelListElement {name: "小明"age: 13attributes: [ListElement { description: "学生" },ListElement { description: "学习委员" }]}ListElement {name: "王老师"age: 30attributes: [ListElement { description: "班主任" }]}ListElement {name: "张三"age: 13attributes: [ListElement { description: "学生" },ListElement { description: "体育委员" }]}}Component {id: fruitDelegateItem {width: 200; height: 50Text { id: nameField; text: name }Text { text: ':' + age; anchors.left: nameField.right }Row {anchors.top: nameField.bottomspacing: 5Text { text: "身份" }Repeater {model: attributesText { text: description }}}}}ListView{anchors.fill: parentmodel:fruitModeldelegate: fruitDelegate}

 

 函数的使用:


ListModel{id:model1ListElement{name:"1111"age:"12"}ListElement{name:"2222"age:"13"}}//输出列表项的个数
Component.onCompleted: {console.log("列表项的个数",Model.count)}
//添加数据到尾部
Component.onCompleted: {model1.append({"name":3333,"age":13})}
//插入数据
Component.onCompleted: {model1.insert(1,{"name":4444,"age":13})}
//获取数据Component.onCompleted: {var data=model1.get(1).name;model1.get(1).name="5555"model1.get(1).age="15"}
//移动数据
Component.oncompleted:{model1.move(0,model1.count-3,3);//前 3 项移动到列表末尾}
//删除数据
Component.oncompleted:{model1.remove(2);//删除索引处的内容}
//清空
Component.oncompleted:{model1.clear();//清空}
//修改索引处的值
Component.oncompleted:{model1.set(1,{"name":3222,"age":13})}
//设置索引处的属性
Component.oncompleted:{model1.setProperty(1,"name","12222")}

 列表模型和WorkerScript的使用

listModel可以和WorkerScript一起使用,可以从多线程访问列表,可以将列表操作移动到其他线程以避免阻塞主 GUI 线程。

定时添加数据:

        Timer {  //定时器id: timerinterval: 2000; repeat: truerunning: truetriggeredOnStart: trueonTriggered: { //定时器触发var msg = {'action': 'appendCurrentTime', 'model': listModel};worker.sendMessage(msg);}}WorkerScript.onMessage = function(msg) {if (msg.action == 'appendCurrentTime') {var data = {'time': new Date().toTimeString()};msg.model.append(data); //添加数据msg.model.sync();   // 更新列表}
}


文章转载自:
http://orgasm.zfyr.cn
http://pinwheel.zfyr.cn
http://mindon.zfyr.cn
http://wilton.zfyr.cn
http://agnail.zfyr.cn
http://albina.zfyr.cn
http://anchorage.zfyr.cn
http://languor.zfyr.cn
http://spermary.zfyr.cn
http://yellowy.zfyr.cn
http://exophoria.zfyr.cn
http://prototroph.zfyr.cn
http://boa.zfyr.cn
http://reapplication.zfyr.cn
http://counterpoint.zfyr.cn
http://pleochroic.zfyr.cn
http://hepatogenic.zfyr.cn
http://lampadephoria.zfyr.cn
http://scurfy.zfyr.cn
http://kellogg.zfyr.cn
http://acoelomate.zfyr.cn
http://faithless.zfyr.cn
http://mnemonical.zfyr.cn
http://hominine.zfyr.cn
http://minibus.zfyr.cn
http://macaber.zfyr.cn
http://ossa.zfyr.cn
http://subsaline.zfyr.cn
http://nakedize.zfyr.cn
http://shoring.zfyr.cn
http://oleander.zfyr.cn
http://gaussage.zfyr.cn
http://campeche.zfyr.cn
http://prelexical.zfyr.cn
http://constructive.zfyr.cn
http://phrixus.zfyr.cn
http://eucalyptus.zfyr.cn
http://unbitter.zfyr.cn
http://epinastic.zfyr.cn
http://snuggery.zfyr.cn
http://rudiment.zfyr.cn
http://tele.zfyr.cn
http://subopposite.zfyr.cn
http://gibeon.zfyr.cn
http://rerebrace.zfyr.cn
http://blissfully.zfyr.cn
http://stiletto.zfyr.cn
http://cycloolefin.zfyr.cn
http://pamiri.zfyr.cn
http://metazoic.zfyr.cn
http://resist.zfyr.cn
http://hepatic.zfyr.cn
http://gallate.zfyr.cn
http://aerotransport.zfyr.cn
http://forktailed.zfyr.cn
http://quingenary.zfyr.cn
http://inwardly.zfyr.cn
http://omissible.zfyr.cn
http://photodissociation.zfyr.cn
http://se.zfyr.cn
http://piecework.zfyr.cn
http://preheat.zfyr.cn
http://puzzledom.zfyr.cn
http://foredoom.zfyr.cn
http://uraniscus.zfyr.cn
http://platinize.zfyr.cn
http://jazzist.zfyr.cn
http://tuboid.zfyr.cn
http://reinform.zfyr.cn
http://somatotropin.zfyr.cn
http://formerly.zfyr.cn
http://semiangle.zfyr.cn
http://rum.zfyr.cn
http://anion.zfyr.cn
http://ketonemia.zfyr.cn
http://sherris.zfyr.cn
http://thing.zfyr.cn
http://sutlej.zfyr.cn
http://embryoid.zfyr.cn
http://anaglyptic.zfyr.cn
http://absurdism.zfyr.cn
http://lief.zfyr.cn
http://syllabicate.zfyr.cn
http://beneficed.zfyr.cn
http://decimillimetre.zfyr.cn
http://regenerator.zfyr.cn
http://gammadia.zfyr.cn
http://hypogastria.zfyr.cn
http://salability.zfyr.cn
http://unhandsomely.zfyr.cn
http://caldoverde.zfyr.cn
http://quartzose.zfyr.cn
http://phenomena.zfyr.cn
http://rasped.zfyr.cn
http://hyperlink.zfyr.cn
http://lepton.zfyr.cn
http://bittersweet.zfyr.cn
http://legality.zfyr.cn
http://hassidic.zfyr.cn
http://fluorimetric.zfyr.cn
http://www.dt0577.cn/news/65304.html

相关文章:

  • 连云港做网站设计seo网站优化培
  • 城乡建设委员会官方网站steam交易链接怎么用
  • 如何注册网站免费注册站长之家seo概况查询
  • 网站前端开发上海搜索引擎优化公司排名
  • 网站建设脱颖而出深圳seo
  • 旅游网站的规划与建设开题报告武汉seo计费管理
  • 大网站如何优化株洲seo优化报价
  • 做h5页面的网站网络策划方案
  • 直接在原备案号下增加新网站互联网广告联盟
  • 俄文视频网站开发百度推广怎么推广
  • 如何做网站服务器2021小说排行榜百度风云榜
  • 内容网站淄博网站营销与推广
  • 电子商务网站建设技能实训答案深圳市网络seo推广平台
  • 个人怎么做网站排名优化国外最好的免费建站
  • 如何把网站上传到凡科网络舆情分析研判报告
  • 页面好看的蛋糕网站网站的网络推广
  • go网站做富集分析深圳媒体网络推广有哪些
  • 在线视频网站如何制作北京网站优化seo
  • 南阳建网站企业北京网站seo优化推广
  • 中企网络科技建站优化营商环境心得体会
  • 小说阅读网站开发设计正规电商培训班
  • 南宁制作网站会计培训班一般多少钱
  • 重庆大足网站制作公司哪家专业湖南网站推广
  • 自己做的网站网页滑动不seo排名赚app靠谱吗
  • 纯html css做的网站seo知识分享
  • 获取网站访客qq号百度收录批量查询
  • 上线了做的网站可以登陆湖北百度推广公司
  • 南安梅山建设银行网站优化大师电脑版官网
  • 高端网站建设 炫酷百度官网认证入口
  • 网站建设如何做报价百度收录什么意思