Hey there,
i have written a ComboBoxDelegate an want to emit a signal in a const function. VusualC++ returns the Error
"error C2662: 'ComboBoxDelegate::currentIndexChanged': this-pointer cann't be changed from 'const ComboBoxDelegate' in 'ComboBoxDelegate &'"
Anny ideas?
void ComboBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
if(index.isValid()&&index.column()==ViewSpalte)
{
QComboBox* combo = qobject_cast<QComboBox*>(editor);
int idx=combo->currentIndex();
int nidx=index.model()->data(index,Qt:isplayRole).toInt();
combo->setCurrentIndex(nidx);
if(idx!=nidx)
emit currentIndexChanged(nidx); // the Error occurs here
}
else
QItemDelegate::setEditorData(editor, index);
}
Bookmarks