PDA

View Full Version : Forcing a minimum list widget width



MrGarbage
9th July 2007, 22:45
Hi,

I have a very simple main application, done in entirely in QT Designer.

On the left I have a List widget. On the right a stacked widget.
As items in the list are selected the stacked widget changes pages appropriately.

I want the list widget to be only about as wide as the max text it contains, ie "Page 1".

No matter what I seem to do with the layout and size policy, the list widget always expands horizontally to occupy about 1/3 of the application window. I cannot seem to get it force it to be a narrower width.

Everything resizes correctly, but I don't want or need the list widget taking up so much real estate.

How do I do this with QT designer?

Thanks!

Mark

marcel
14th July 2007, 18:16
Not that easy.
My solution is to use QListView instead. Create a custom item delegate and reimplement sizeHint and minimumSize for it. Next you must set it to the list view.
This way you will get your minimum size.

But this also means you will have to actually write some code :).
Designer is just a tool of Qt, it is not meant to "create" fully functional applications with it.

Regards