PDA

View Full Version : Problem with QComboBox



jogeshwarakundi
8th December 2007, 11:50
Hi
I just installed Qtopia 4.3.0 and was verifying the UI properties of various widgets.
On QComboBox, if I do a setEditable(true) and configure its LAF using stylesheets, the lineedit seems to be taking up the entire space....i press and F4, i see the drop down, but the dropdown button itself is not being visible and hence not accessible.
The following is what i did:

QComboBox* iCombo = new QComboBox(this);
iCombo->setGeometry(20, 70, 130, 20);
QString str("1,2,3,4,5,6,7,8,9,0");
QStringList list = str.split(",");
iCombo->addItems(list);
iCombo->setEditable(true);
iCombo->setMaxVisibleItems(5);
iCombo->setInsertPolicy(QComboBox::NoInsert);
iCombo->lineEdit()->setText("number:");
iCombo->setStyleSheet(" * {color:#ff0000; background-color: #000000; border: 1px outset #0000ff;} :focus {color: #00ff00; background-color: #ffffff; border: 1px outset #ff0000;}");

I am kinda newbie to all this stylesheet stuff and also QT stuff and dont even get a hint as to what could be going wrong :(

wysota
8th December 2007, 14:21
If you use stylesheets on a combobox, you have to style everything - including the drop-down button (::drop-down subcontrol). At least set its position. See the docs for examples.