View Full Version : List withembedded check boxes
bruccutler
7th March 2007, 17:37
Hello,
This is a simple question, I hope:
I want to create a scrollable list with a string and a checkbox by each item.
What is the best way to do this? Which control:
Here's the example:
[] Option 1
[] Option 2
[] Option 3
...
Recommendations of which control to use?
- BRC
fullmetalcoder
7th March 2007, 18:13
What is the best way to do this?
Recommendations of which control to use?
It depends on what approach you want to use : custom model or convinience view.
Basically you can do that through item delegates (for a custom model) or using the setItemWidget() (http://doc.trolltech.com/4.1/qlistwidget.html#setItemWidget) method of QListWidget...
Both methods will achieve what you need but one is significantly easier but far less flexible than the other...
Hope this helps. :)
bruccutler
7th March 2007, 18:17
It depends on what approach you want to use : custom model or convinience view.
Basically you can do that through item delegates (for a custom model) or using the setItemWidget() (http://doc.trolltech.com/4.1/qlistwidget.html#setItemWidget) method of QListWidget...
Both methods will achieve what you need but one is significantly easier but far less flexible than the other...
Hope this helps. :)
Initially, because of time schedule, I'm all for convenience and less flexible. So, which is which? I assume the setItemWidget is the simpler of the two, correct?
- BRC
Sounds like a QListView (or a QListWidget) with checkable items.
QListWidgetItem::setFlags(), Qt::ItemIsUserCheckable (http://doc.trolltech.com/4.2/qt.html#ItemFlag-enum)
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.