PDA

View Full Version : QTreeWidget & QListWidget different selection



munna
18th July 2006, 18:16
Hi,

When an Item is selected in QTreeWidget, the selection background extends till the width of the widget (single column QTreeWidget), whereas when an item is selected in QListWidget, the width of the selection background is relative to the width of the current Item.

Can I make QListWidget selection behave like QTreeWidget ?

Thanks a lot.

wysota
18th July 2006, 19:53
Make sure "movement" property is set to Static.

munna
20th July 2006, 06:09
Setting the property did not make any difference. Please look at the images below for the difference in the selection. I want the selection in QListWidget look like selection in the QTreeWidget.

Please Help
Thakns a lot.

http://img90.imageshack.us/img90/4580/qtreewidgetselectionxt0.th.png (http://img90.imageshack.us/my.php?image=qtreewidgetselectionxt0.png)
http://img212.imageshack.us/img212/6122/qlistwidgetselectionpd1.th.png (http://img212.imageshack.us/my.php?image=qlistwidgetselectionpd1.png)

jacek
20th July 2006, 06:16
Please, post images as attachments.

munna
20th July 2006, 06:37
I tried attachments but for some reason the images did not show and therefore I used the other way.

jacek
20th July 2006, 07:07
I tried attachments but for some reason the images did not show and therefore I used the other way.
It worked for me:

jpn
20th July 2006, 10:16
What if you force the gridSize to be as wide as the width of the widget?
http://qtnode.net/pastebin/799

wysota
20th July 2006, 10:20
If I take a default, not changed in any way QListWidget, the selection is as you want it. You must have changed some property and my guess was it was the movement property because it does give an effect you described.

Chicken Blood Machine
20th July 2006, 17:06
This seems to be a problem with the Windows and Motif styles of the version of Qt I am using (Qt 4.2 tp1). The MacOs and plastique styles display OK. Can you verify which platform you are running on?

Also, try running your app with 'app -style plastique' and see if the problem goes away.

If so, it may be worth reporting to Trolltech.

munna
21st July 2006, 06:50
I am on win xp + Qt 4.1.3. I see that it works fine with Qt3 and all other styles.

I have not tired but will the method explain by jpn work?