PDA

View Full Version : Looking for a Widget Similar to QListWidget



stealth86
7th August 2007, 21:14
Hi,

Is there a widget that's similar to a QListWidget, except that each item in the list has a checkbox as well? There doesn't seem to be one in the main set of widget's provided, but is there something like this online I could copy? (Or is there a really quick way to create one from scratch?)

I've included a picture to better describe what I'm looking for. The list on the left is what I would like to create in my program.

marcel
7th August 2007, 21:22
No there isn't yet, but you could take a look at QxtCheckComboBox from the QxtGui package.

It does exactly what you want, except it is a combo box.
Maybe you can port it in a list widget?

Regards

stealth86
7th August 2007, 21:39
No there isn't yet, but you could take a look at QxtCheckComboBox from the QxtGui package.

It does exactly what you want, except it is a combo box.
Maybe you can port it in a list widget?

Regards

Hmm, that is very close to what I'm looking for. It seems like from reading other threads that you can insert QListWidgetItems that are checkable into QListWidgets. I'll have to investigate this further.

marcel
7th August 2007, 21:42
Oh, yes, damn it! :)
Add this to the item flags: Qt::ItemIsUserCheckable.
This will make the items checkable.
Then you have QListWidgetItem::setCheckState and checkState.

Regards

Junior
7th August 2007, 22:15
stealth86,

Here is an example using model -> treeview.
Hope this helps.

Junior