I want my QListView
to not show a horizontal scollbar. All my items are of the same height so I set setUniformItemSizes(true);
Now the list seems to check the width of the first item and resizes the following items to the maximum of the latter and the width of the QListView
. How can I tell the QListView
to give the items just its own width?
Actually I use my own QStyleItemDelegate and got a too large QRect from the option.rect
. But the standard delegate shows the same behaviour, so I took out my delegate to reduce the amount of problem sources.
The answer is pretty simple: Dont allow the space bar.
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
This elides the text with the default delegate and reports proper option.rect in your custom delegate.