hey,
I want to create a combobox havin 2 columns.Both the columns have different strings to show.
how to do it??
Plzz rep
Printable View
hey,
I want to create a combobox havin 2 columns.Both the columns have different strings to show.
how to do it??
Plzz rep
Use QComboBox::setView() to set a different view (a tree probably) for the combobox.
Thnxx for reply,
can you plzz explain this a little more with the help of an example/code...
waiting for ur rep..
Code:
cb->setModel(model); tv->setModel(model); // I don't know if this is required tv->header()->hide(); cb->setView(tv);
hi,
i hv written dis code but it is not showing the popup containing items.what is wrong in dis code??
Code:
countryCombo->setGeometry(42,25,205,25); countryCombo->setEditable(true); for (int i = 0; i < model.rowCount(); ++i) { model.setItem(i, 0, col0); model.setItem(i, 1, col1); model.setItem(i, 2, col2); } countryCombo->setModel(&model); countryCombo->setView(treeView); treeView->setColumnHidden(0, true); treeView->setAllColumnsShowFocus(true); treeView->setRootIsDecorated(false); treeView->header()->hide();
Your model goes out of scope before it has a chance to do anything.
hi,
thanx for reply
But I didnt got your point .pls explain with necessary change in the code .
Allocate the model on heap and not on the stack.