标题:CheckComboBox 有谁知道怎么实现吗?
作者:qiank128
日期:2006-08-24 17:35
内容:
就是 QComboBox 里面有 CheckList 可以多选, 请问如何实现啊
#1 [room502 08-24 17:49]
请看源码呀
#2 [qiank128 08-24 18:39]
哪里有源码?
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
#3 [qiank128 08-25 13:59]
附件为 CheckComboBox 的实现代码, 希望对大家有用。
#4 [ediwon 08-25 14:32]
thanks C++学的比我好多了