PDA

View Full Version : QCombobox style - list permanently open



braindead
16th March 2012, 11:59
Hello,

I need a combox which will display its list permanently. Generally I want the same look as a combobox can have under Motif (first image (http://www.ist.co.uk/motif/books/vol6A/ch-14.fm.html)) and Windows (top most combobox (http://winapi.foosyerdoos.org.uk/code/usercntrls/images/CreateCombos.png) with style CBS_SIMPLE). In short, both consists of a Textfield on top and the list of items below. Both are visible permanently (no arrow to open a view).
I couldn't find anything on the web or the Qt-docs. Just wanna know did I miss somthing or is this simply not supported?
If the last, then I would like some advice on how to best proceed. Is there maybe a possiblity to create/influence a QStyle for that (tried to experiment with the style but didn't get the desired result so far) or is it best - as I assume - to write my own widget (consisting of QLineEdit and QListView)?

Thx,
bd

ChiliPalmer
17th March 2012, 22:05
Hi,

That's not possible with a QComboBox. Even if you would change it to have it always show its itemlist, the list would lie on top of the widgets below the QComboBox.
Why don't you just use a QListWidget and a QLineEdit and use the QListWidget's currenItemChanged Signal to show the current item's text in the QLineEdit? That would be done in about 15min

Spitfire
20th March 2012, 16:05
List in QComboBox is a popup. It lives by different rules which can't be affected.
IMHO creating custom widget is the way to go.