PDA

View Full Version : Styling each item in a QComboBox



rishid
23rd February 2008, 03:47
Hi,

I am using a touch screen and have some combo boxes to select settings. Problem I am having is the drop down items are too small / close together to be able to accurately select the item the user wants on the first touch.

I tried styling the QComboBox but have not had any luck accessing each item in the QListView sub-control in the combo box.

I tried setting a style sheet of something like:

QComboBox QListView::item * { text-size: 16px; padding:4px; }

This did not do anything.

Any suggestions?

Thanks

rishid
23rd February 2008, 04:08
Small update:

Something like this works:

QComboBox { text-size: 16px; }

I really wish I could put some padding in between items though. Think I may have found a bug with the style sheets, or this could be appropriate behaviour.
If I do something like:

SettingsClass s; (SettingsClass is a QWidget)
s.setStyleSheet("QWidget { background: white; }");

It removes all the formatting I had done using QtDesigner and sets the background of all items in the widget white. Is there something I am missing with this?

wysota
23rd February 2008, 09:10
If you use a touch screen and have trouble hitting widgets, maybe it would be best to change QApplication::globalStrut?