首页| 论坛| 消息

标题:qml中 combobox 中怎么嵌入checkbox
作者:z_墨脱
日期:2014-12-23 10:16
内容:

RT


#1 [彩阳 12-27 17:06]
看看可以自己制作一个ComboBox类,来实现添加CheckBox。
#2 [小缡绕谁前 12-04 10:04]
import QtQuick 2.0
import QtQuick.Controls 1.1
Rectangle {
id:comboBox
property variant items: ["100", "45", "63", "123","23","100", "45", "63", "123","23","100", "45", "63", "123","23"]
property alias selectedItem: chosenItemText.text;
property alias selectedIndex: listView.currentIndex;
property var selectedname: []

signal comboClicked;
width: 110;
height: 30;
smooth:true;
function addnum(num){

var numindex = selectedname.indexOf(num)
if(numindex!=-1){
//添加时如果已经有值则不处理
}
else{
//添加时如果没有值则添加
selectedname.push(num)
}
}
function deletenum(num){

var numindex = selectedname.indexOf(num)
if(numindex!=-1){

//删除时如果有值则删除
selectedname.splice(numindex,1)//删除指定位置的一个数值
}
else{
&nbsp ..

回复 发表
主题 版块