PDA

View Full Version : [Qt4]: Adding centered items in QListWidget



Jojo
11th March 2006, 21:24
Hello,

I want to add some items centered into a QListWidget. The Widget stretches along the left side of a dialog, it's about 100px wide, and 600px high.
The items I add have an icon, and some text under it. At the moment the items are aligned on the left side of the QListWidget, so the icons are not at one line.
How can I show the items centered, not by text, but by the icon?

Thanks for help,
Johannes :)

jpn
12th March 2006, 12:25
I want to add some items centered into a QListWidget.

Centered horizontally, vertically, uh oh what?



The items I add have an icon, and some text under it.

So the view mode is icon mode?



At the moment the items are aligned on the left side of the QListWidget, so the icons are not at one line.
How can I show the items centered, not by text, but by the icon?

Sorry, but would you mind supplying an example image of what you're trying to achive?
It doesn't seem very clear or at least I can't understand you.. ;)

Jojo
16th March 2006, 18:46
Hello,

sorry, I couldn't reply earlier.
I know have a screenshot which makes the problem obvious I think. The items shall be centered vertically in the list. Also atm the list widget is sized to exactly match the width of the currently selected item, this behaviour makes longer entries appear clipped. This is also appearent in the screenshot:
Here is a link: http://img20.imageshack.us/my.php?image=shot6ia.png

Thanks for helping me with this issue, I've found no way yet to archieve what I want.

Bye,
Jojo

jpn
16th March 2006, 19:34
Try turning property uniform item sizes (http://doc.trolltech.com/4.1/qlistview.html#uniformItemSizes-prop) on.

Jojo
16th March 2006, 20:04
Thanks, this works :)