PDA

View Full Version : QComboBox drop-down hiding



bpetty
16th August 2007, 23:00
Hey guys,

I am using a QTableWidget that contains QComboBoxes. I want those boxes to look like a regular cell unless they are "selected". Does anyone have any recommendations on how to do this? I attempted to do it with style sheets.

I am using Qt 4.2.2 (but have access to 4.3.1).
When I would call setStyleSheet() and pass it something like:


pWidget1->setStyleSheet("QComboBox::drop-down:hover { height: 10px }");


... the drop down would not appear. I played around with many different attributes for ::drop-down... they all hid the button even when I was not hovering. I take it this is a 4.2.x issue. Has anyone had success on 4.3.x? I am not sure this is the best way to get what I want, so if there is a better way I am all ears.

Thanks.

wysota
17th August 2007, 02:26
Lose the comboboxes (I imagine you use setItemWidget() or something like that) and implement a proper item delegate (subclass of QItemDelegate) that will return a combobox as an editor for a cell.