in QCLDelegate::createEditor you should write additional condition
{
if (index.column() == 2 || index.column() == 3 || index.column() == 4) {
//creating and customization of comboboxes
return comboBox;
}
}
QWidget *QCLDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem & /* option */,
const QModelIndex &index) const
{
if (index.column() == 2 || index.column() == 3 || index.column() == 4) {
//creating and customization of comboboxes
return comboBox;
}
return new QLineEdit(parent);
}
To copy to clipboard, switch view to plain text mode
you also should be careful in other Delegate's method where an editor is used as method's parameter, you should cast each editor to concert type, because now you have two different editor's type -- QComboBox and QLineEdit.
Bookmarks