PDA

View Full Version : Combo box is not showing any text by default



chandan
1st February 2011, 11:43
Hi Everyone,
I have designed a TreeView which has 5 columns in it. Out of five, one of them is combo box from where user can select the type of permission. I have used a delegate to display the combo box in the TreeView. TreeView is displaying the combo box with no text in it. I have attached an image which shows the current tree view screen grab.

5842

In the above image Accounts column is the combo box column.

But when you click on one of your combo box then it shows the option that I set up as a default text. Code I have used for this is give below;


QStyleOptionComboBox comboBoxOption;
comboBoxOption.rect = Option.rect;
comboBoxOption.currentText = StringToDisplay;
//comboBoxOption.state = QStyle::State_HasFocus;
QApplication::style()->drawComplexControl(QStyle::CC_ComboBox, &comboBoxOption, pPainter);


Here the StringToDisplay is the string to be displayed by default into the combo box which was retrieved from the Database.

Any suggestion or thought, how to solve this problem?

Thanks.