PDA

View Full Version : Need help on check uncheck checkbox on QlistwidgetItem



tho97
5th March 2008, 22:43
I have problem clicking on the checkbox of QlistwidgetItem in Qlistwidget. It is really hard to click on the box even when I try to click at the middle of box. How I can make it is easier to check or make the box bigger, change the font size in Qlistwidget didn't help much.

momesana
6th March 2008, 06:05
do you mean making the whole QListWidgetItem larger or just the checkbox? setting the sizeHint may help you in the first case. You can also resort to drawing the items yourself in order to have full control by using a custom delegate but that involves a little more labour.

http://doc.trolltech.com/4.3/qitemdelegate.html
http://doc.trolltech.com/4.3/qlistwidgetitem.html#setSizeHint

jpn
6th March 2008, 07:27
Which exact version of Qt are you using? There has been a relevant bug in some recent versions of Qt...

tho97
6th March 2008, 18:07
do you mean making the whole QListWidgetItem larger or just the checkbox? setting the sizeHint may help you in the first case. You can also resort to drawing the items yourself in order to have full control by using a custom delegate but that involves a little more labour.

http://doc.trolltech.com/4.3/qitemdelegate.html
http://doc.trolltech.com/4.3/qlistwidgetitem.html#setSizeHint
I just need to make the checkbox larger, the sizeHint didn't work, the checkbox is still the same size with bigger sizeHint, it just add more space in between each items.


Which exact version of Qt are you using? There has been a relevant bug in some recent versions of Qt...
I use QT 4.3.2

jpn
6th March 2008, 18:13
I use QT 4.3.2
A couple of bug fix release have come out since that version. I'd try Qt 4.3.4.

From 4.3.3 changes (http://trolltech.com/developer/notes/changes/changes-4.3.3):


- QItemDelegate
* [181221] Fixed problem with the rectangle that was used to check the mouse coordinates when clicking on the check box.

tho97
6th March 2008, 20:04
thank jpn, version 4.3.4 fixed the problem, now I can check and uncheck the checkbox.