PDA

View Full Version : How to add scrollbar...?



jojanpm
22nd October 2010, 12:30
How can v add a scrollbar to a listWidget-checkBox combination? ('combination' means thr ll be one checkbox corresponding to (or on right of) each listWidget item)

i tried this:
created a listWidget and a set of, say 10, checkBox ctrls.
then created a widget, and dragged all into the widget.
then created a scrollArea, and dragged the widget into the scrollArea. (this step may not be necessary)
then added this code on pageload, as per the tutorial says:
ui->scrollArea->setWidget(ui->widget);

but i get runtime error. (no helpful info shown about the error)
WHY!?

wysota
22nd October 2010, 12:46
Don't create checkboxes for the items. Use Qt::CheckStateRole for items in your list widget.

jojanpm
25th October 2010, 07:18
wysota, i cudnt undrstd ur reply. whr shud i add Qt::CheckStateRole?
wud u plz shw some piece of code?

genjix
25th October 2010, 18:32
I can't understand anything you say. If you made a mockup picture and explained fully it would be easier. If you want someone to understand a difficult topic then make it easier for them to understand- other they have to waste brainpower trying to decrypt what you're saying.

wysota
25th October 2010, 18:51
wysota, i cudnt undrstd ur reply. whr shud i add Qt::CheckStateRole?
wud u plz shw some piece of code?

In d plc wr it nds b add. :cool: