• 5648阅读
  • 4回复

CheckComboBox 有谁知道怎么实现吗? [复制链接]

上一主题 下一主题
离线qiank128
 

只看楼主 倒序阅读 楼主  发表于: 2006-08-24
CheckComboBox 有谁知道怎么实现吗?
就是 QComboBox 里面有 CheckList 可以多选, 请问如何实现啊
[ 此贴被XChinux在2006-08-24 22:15重新编辑 ]
离线room502

只看该作者 1楼 发表于: 2006-08-24
请看源码呀
离线qiank128

只看该作者 2楼 发表于: 2006-08-24
哪里有源码?

checkComboBox 在哪里能下载到QT源码呢?

有人能把下面这个实现出来吗?

这是我在 http://www.qtcentre.org/forum/f-qt-programming-2/t-checkcombobox-how-to-do-3411.html 提问的答案。

If you mean something like this, it really shouldn't bee too hard since QComboBox allows you to use your own model (and view, which you probably don't event need..). You need to make the combobox non-editable and make the model to return Qt::ItemIsUserCheckable for all indexes QAbstractItemModel::flags(). I think all you need to do by hand is the filling of the line edit of the combobox.

Edit: Oh, and about the model. In my opinion, QStandardItemModel could be a good choice to start with, as QStringListModel doesn't support storing of check states..

checkComboBox界面如 : http://www.codeproject.com/combobox/checkcombo.asp
[ 此贴被qiank128在2006-08-24 20:06重新编辑 ]
离线qiank128

只看该作者 3楼 发表于: 2006-08-25
附件为 CheckComboBox 的实现代码, 希望对大家有用。
附件: CheckComboBoxSrc.zip (3 K) 下载次数:82
离线ediwon
只看该作者 4楼 发表于: 2006-08-25
thanks C++学的比我好多了
BLOG:
http://www.ediwon.com
-------------------------------
快速回复
限100 字节
 
上一个 下一个