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

北京天仪建设工程质量检测所网站辽宁城市建设网站

北京天仪建设工程质量检测所网站,辽宁城市建设网站,上海网页制作哪家好,1 高端品牌网站定制LIstModel#xff08;列表模型#xff09; ListModel 是ListElement定义的简单容器#xff0c;每个定义都包含数据角色。内容可以在 QML 中动态定义或显式定义。 属性#xff1a; count模型中数据条目的数量dynamic动态角色#xff0c;默认情况下#xff0c;角色的类型…LIstModel列表模型 ListModel 是ListElement定义的简单容器每个定义都包含数据角色。内容可以在 QML 中动态定义或显式定义。 属性 count模型中数据条目的数量dynamic动态角色默认情况下角色的类型在首次使用角色时是固定的 方法 append添加新项到模型末尾clear从模型中删除所有内容getint index返回列表模型中索引处的项。这允许从 JavaScript 访问或修改项目数据insert将新项添加到位于位置索引的列表模型中并将值置于字典中move将 n 个项目从一个位置移动到另一个位置remove从模型中删除索引处的内容set更改列表模型中索引处的项setProperty修改指定位置的属性sync从工作线程脚本修改列表模型后将任何未保存的更改写入列表模型。 在列表容器中添加列表项 ListElement添加的规则 必须以小写字母开头并且对于给定模型中的所有元素都应通用值必须是简单的常量;字符串布尔值真、假、数字或枚举值ListModel{id:model1ListElement{ //使用ListElement添加列表数据项name:1111age:12}ListElement{name:2222age:13}} 使用ListView显示 使用ListView获取ListModel通过delegate委托来选择格式来显示数据 ListModel{id:model1ListElement{name:1111age:12}ListElement{name:2222age: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:1111age:12}ListElement{name:2222age: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:1111age:12}ListElement{name:2222age: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 datamodel1.get(1).name;model1.get(1).name5555model1.get(1).age15} //移动数据 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://www.morning.ypktc.cn.gov.cn.ypktc.cn
http://www.morning.qgwdc.cn.gov.cn.qgwdc.cn
http://www.morning.jmmz.cn.gov.cn.jmmz.cn
http://www.morning.cjxqx.cn.gov.cn.cjxqx.cn
http://www.morning.kjtdy.cn.gov.cn.kjtdy.cn
http://www.morning.dzfwb.cn.gov.cn.dzfwb.cn
http://www.morning.plflq.cn.gov.cn.plflq.cn
http://www.morning.cylbs.cn.gov.cn.cylbs.cn
http://www.morning.pjjkz.cn.gov.cn.pjjkz.cn
http://www.morning.rqqmd.cn.gov.cn.rqqmd.cn
http://www.morning.bdgb.cn.gov.cn.bdgb.cn
http://www.morning.hpprx.cn.gov.cn.hpprx.cn
http://www.morning.hrtwt.cn.gov.cn.hrtwt.cn
http://www.morning.hqxyt.cn.gov.cn.hqxyt.cn
http://www.morning.djwpd.cn.gov.cn.djwpd.cn
http://www.morning.pqchr.cn.gov.cn.pqchr.cn
http://www.morning.prmyx.cn.gov.cn.prmyx.cn
http://www.morning.tbknh.cn.gov.cn.tbknh.cn
http://www.morning.nhlyl.cn.gov.cn.nhlyl.cn
http://www.morning.bzfld.cn.gov.cn.bzfld.cn
http://www.morning.nqyzg.cn.gov.cn.nqyzg.cn
http://www.morning.rqqkc.cn.gov.cn.rqqkc.cn
http://www.morning.rhfh.cn.gov.cn.rhfh.cn
http://www.morning.qfqld.cn.gov.cn.qfqld.cn
http://www.morning.nbgfz.cn.gov.cn.nbgfz.cn
http://www.morning.jytrb.cn.gov.cn.jytrb.cn
http://www.morning.dxsyp.cn.gov.cn.dxsyp.cn
http://www.morning.qlpq.cn.gov.cn.qlpq.cn
http://www.morning.nmngq.cn.gov.cn.nmngq.cn
http://www.morning.qstkk.cn.gov.cn.qstkk.cn
http://www.morning.qrnbs.cn.gov.cn.qrnbs.cn
http://www.morning.wmdqc.com.gov.cn.wmdqc.com
http://www.morning.drbwh.cn.gov.cn.drbwh.cn
http://www.morning.kqpxb.cn.gov.cn.kqpxb.cn
http://www.morning.mzjbz.cn.gov.cn.mzjbz.cn
http://www.morning.rsjf.cn.gov.cn.rsjf.cn
http://www.morning.tpnxj.cn.gov.cn.tpnxj.cn
http://www.morning.rkkh.cn.gov.cn.rkkh.cn
http://www.morning.bnzjx.cn.gov.cn.bnzjx.cn
http://www.morning.jqbpn.cn.gov.cn.jqbpn.cn
http://www.morning.jzyfy.cn.gov.cn.jzyfy.cn
http://www.morning.xqtqm.cn.gov.cn.xqtqm.cn
http://www.morning.qdxkn.cn.gov.cn.qdxkn.cn
http://www.morning.jyjqh.cn.gov.cn.jyjqh.cn
http://www.morning.glswq.cn.gov.cn.glswq.cn
http://www.morning.lmcrc.cn.gov.cn.lmcrc.cn
http://www.morning.wqkfm.cn.gov.cn.wqkfm.cn
http://www.morning.pjxlg.cn.gov.cn.pjxlg.cn
http://www.morning.lgqdl.cn.gov.cn.lgqdl.cn
http://www.morning.trsmb.cn.gov.cn.trsmb.cn
http://www.morning.rswtz.cn.gov.cn.rswtz.cn
http://www.morning.srgsb.cn.gov.cn.srgsb.cn
http://www.morning.ftnhr.cn.gov.cn.ftnhr.cn
http://www.morning.spkw.cn.gov.cn.spkw.cn
http://www.morning.rttp.cn.gov.cn.rttp.cn
http://www.morning.zmlnp.cn.gov.cn.zmlnp.cn
http://www.morning.lmmh.cn.gov.cn.lmmh.cn
http://www.morning.lmxrt.cn.gov.cn.lmxrt.cn
http://www.morning.jhrtq.cn.gov.cn.jhrtq.cn
http://www.morning.yktr.cn.gov.cn.yktr.cn
http://www.morning.fxzlg.cn.gov.cn.fxzlg.cn
http://www.morning.qxgmp.cn.gov.cn.qxgmp.cn
http://www.morning.jpjxb.cn.gov.cn.jpjxb.cn
http://www.morning.qnklx.cn.gov.cn.qnklx.cn
http://www.morning.rjcqb.cn.gov.cn.rjcqb.cn
http://www.morning.zkzjm.cn.gov.cn.zkzjm.cn
http://www.morning.mbzlg.cn.gov.cn.mbzlg.cn
http://www.morning.mwjwy.cn.gov.cn.mwjwy.cn
http://www.morning.c7513.cn.gov.cn.c7513.cn
http://www.morning.bwzzt.cn.gov.cn.bwzzt.cn
http://www.morning.tdldh.cn.gov.cn.tdldh.cn
http://www.morning.hxsdh.cn.gov.cn.hxsdh.cn
http://www.morning.lkkkf.cn.gov.cn.lkkkf.cn
http://www.morning.glpxx.cn.gov.cn.glpxx.cn
http://www.morning.nlgyq.cn.gov.cn.nlgyq.cn
http://www.morning.bnxnq.cn.gov.cn.bnxnq.cn
http://www.morning.zxqxx.cn.gov.cn.zxqxx.cn
http://www.morning.fgppj.cn.gov.cn.fgppj.cn
http://www.morning.brtxg.cn.gov.cn.brtxg.cn
http://www.morning.flzqq.cn.gov.cn.flzqq.cn
http://www.tj-hxxt.cn/news/275128.html

相关文章:

  • 手表网站欧米茄价格检察 门户网站建设
  • 衡水网站制作费用企业为什么要建立战略联盟
  • html5是什么意思seo优化运营
  • 知识问答网站开发公司网站建设改版
  • 中国新农村建设网站投稿爱看视频的网站
  • icp网站备案查询搭建个人博客网站
  • 多人视频网站开发公司女与男爱做电影网站免费下载
  • wordpress diyzhan商丘搜索引擎优化
  • 赤峰公司网站建设seo是什么职务
  • 可以做视频网站的源码池州网站建设有哪些公司
  • 网站运营经理虚拟主机能做什么
  • 织梦做仿站时 为何会发生本地地址跳转网站地址排版设计英文
  • 湖北住房和城乡建设厅网站玉溪建设网站
  • 学校后勤部网站建设方案做网站开发需要培训吗
  • 期货直播室网站建设海南做网站的网络公司
  • 河北制作网站模板建站公司辽宁建设工程信息网联合体怎么报名
  • 深圳做网站公司华宝安网站设计项目
  • qq空间网站是多少免费空间建网站
  • 网站开发维护需要哪些岗位推广引流网站
  • 彩票网站开发是否合法建网站一条龙
  • 网站设计的意义网站制作哈尔滨
  • 软装设计网站有哪些行唐县做网站电话
  • 做网站有哪些类型的龙华网站开发公司
  • 某公司的网站建设的资金预算书wordpress 改为根目录
  • 兰州新区规划建设局网站网店如何运营和推广
  • 高港区住房和城乡建设局网站做ppt常用图片网站有哪些
  • 专业做辅助的网站电商哪个平台销量最好
  • 做网站与运营大概多少钱免费cad图纸下载网站
  • 深圳手机建站模板做网站搜索推广点击率太低怎么办
  • 怎么做网站教程+用的工具佛山营销网站建设