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

伯爵手表网站公司宣传片制作公司

伯爵手表网站,公司宣传片制作公司,网上商城简介怎么写,百度一下 你就知道首页官网1.简介 ComboBox是一个组合按钮和弹出列表。它提供了一种以占用最小屏幕空间的方式向用户显示选项列表的方法。 ComboBox用数据模型填充。数据模型通常是JavaScript数组、ListModel或整数,但也支持其他类型的数据模型。 常用属性: count : int&#x…

1.简介

ComboBox是一个组合按钮和弹出列表。它提供了一种以占用最小屏幕空间的方式向用户显示选项列表的方法。
ComboBox用数据模型填充。数据模型通常是JavaScript数组、ListModel或整数,但也支持其他类型的数据模型。

常用属性:

  • count : int:组合框中的项目数。
  • displayText : string:当前显示的文本
  • currentIndex : int:组合框中当前项目的索引。当 count 为 0 时默认值为 -1,否则默认值为 0。
  • currentText : string:当前项的文本
  • currentValue : string:当前项的值
  • delegate : Component:代理
  • editable : bool:组合框是否可编辑。默认值为false。
  • indicator : Item:指示器项
  • model : model:数据model
  • popup : Popup:弹窗
  • textRole : string:保存用于存储与模型中每个项关联的值的模型角色
  • validator : Validator:可编辑组合框的输入文本验证器。
  • valueRole : string :此属性保存用于存储与模型中每个项关联的值的模型角色

2.示例

示例1:显示基础属性,valueRole和textRole区别,设置model等。

Window {visible: truewidth: 500height: 500title: qsTr("Hello World")ComboBox {textRole: "text"valueRole: "value"width: 100displayText: currentText + 123model: [{ value: 100, text: qsTr("aaa") },{ value: 200, text: qsTr("bbb") },{ value: 300, text: qsTr("ccc") }]onCurrentTextChanged: {console.log("text: ",currentText)}onCurrentValueChanged: {console.log("value: ",currentValue)}}}

打印结果:可以明显看到valueRole和textRole区别。

 示例2:自定义combobox

ComboBox {id: controlmodel: ["First", "Second", "Third"]//针对model项中每一项的绘制delegate: ItemDelegate {width: control.widthcontentItem: Text {text: modelDatacolor: index % 2 ?"red":"blue"  //设置交替色font: control.fontelide: Text.ElideRightverticalAlignment: Text.AlignVCenter}highlighted: control.highlightedIndex === index}//指示器的绘制(上下箭头)indicator: Canvas {id: canvasx: control.width - width - control.rightPaddingy: control.topPadding + (control.availableHeight - height) / 2width: 12height: 8contextType: "2d"Connections {target: controlfunction onPressedChanged() { canvas.requestPaint(); }}onPaint: {context.reset();context.moveTo(0, 0);context.lineTo(width, 0);context.lineTo(width / 2, height);context.closePath();context.fillStyle = control.pressed ? "#17a81a" : "#21be2b";context.fill();}}//控制控件内的内容的显示contentItem: Text {leftPadding: 0rightPadding: control.indicator.width + control.spacingtext: control.displayTextfont: control.fontcolor: control.pressed ? "red" : "blue"verticalAlignment: Text.AlignVCenter    //居中elide: Text.ElideRight}//控制控件背景的绘制background: Rectangle {implicitWidth: 120implicitHeight: 40color:"yellow"border.color: control.pressed ? "#17a81a" : "#21be2b"border.width: control.visualFocus ? 2 : 1radius: 2}//弹出下拉框,绘制整个下拉控件popup: Popup {y: control.height - 1width: control.widthimplicitHeight: contentItem.implicitHeightpadding: 1contentItem: ListView {clip: trueimplicitHeight: contentHeightmodel: control.popup.visible ? control.delegateModel : nullcurrentIndex: control.highlightedIndexScrollIndicator.vertical: ScrollIndicator { }}background: Rectangle {border.color: "gray"radius: 2layer.enabled: truelayer.effect: DropShadow{//设置弹出框阴影verticalOffset: 3radius: 8samples: 17color: "#80000000"}}}
}

http://www.yayakq.cn/news/85213/

相关文章:

  • 企业网站备案代理商沈阳建设工程信息网官网新网站
  • 黄陂建设网站如何知道一个网站用什么建设的
  • 旅游门户网站系统本地装修网
  • 开网站需要多少钱wordpress文章加载特效
  • 旅游商业网站策划书做美容有哪些网站
  • 帮人做推广的网站绵阳网站建设开发
  • 张店网站建设定制wordpress添加插件
  • 做翻译 英文网站科大讯飞哪些做教学资源的网站
  • 网站建设平台推荐自助建站上建的网站免费吗
  • 电商网站建设服务备案网站有哪些
  • 百度官网网站登录html 网站建设中
  • 怎样做投资与理财网站汕头网站建设模块
  • 网站怎么做导航条福建做网站公司
  • 做网站怎么去工信部缴费scorilo wordpress
  • 此网站不支持下载视频怎么办网站开发掌握哪种语言
  • qq空间域名抢注网站wordpress调用文章排序
  • 微信链接网页网站制作网页视频下载器app
  • 晋城建设网站牛网站建设
  • 网站运营服务中心建设方案wordpress中文论坛插件
  • 简阳网站建设深圳网站建设工作室
  • 做房产的一般用哪个网站网站建设的目标与思路
  • 广东建设继续教育网站首页如何建立自己的手机网站
  • 网站icp备案怎么查询wordpress知更鸟主题教程
  • 建立网站一般那些阶段app模板免费
  • 网站界面一般用什么软件做给百度做网站的公司
  • 怎么做网站排名优化wordpress前台管理员6
  • 灰色项目网站代做中小型门户网站
  • wordpress中文站cn建设宠物食品网站的功能定位
  • 网站图片多 如何优化是可以随时修改网站内容的.
  • wordpress 分页 美化上海建站seo