I have been working on the same thing. Like wysota said, the combobox has to show whatever data is in the model for the current cell. to initialise the combobox to 'a', set the value in the model to 'a'. Then in the setEditorData() function you can retrieve the value in the model using something like this.
QString value
= index.
model()->data
(index, Qt
::DisplayRole).
toString();
QString value = index.model()->data(index, Qt::DisplayRole).toString();
To copy to clipboard, switch view to plain text mode
Then you can set the current index like you have previously.
QComboBox *comboBox
= static_cast<QComboBox
*>
(editor
);
comboBox->setCurrentIndex(comboBox->findText(value));
QComboBox *comboBox = static_cast<QComboBox*>(editor);
comboBox->setCurrentIndex(comboBox->findText(value));
To copy to clipboard, switch view to plain text mode
Bookmarks