Hi.

I'm subclassing a QStyledItemDelegate in order to attach it to a QTableWidget.
It is working fine but I want to emit a signal from the delegate when I do some stuff inside the call of reimplemented QStyledItemDelegate::setEditorData, for instance:

Qt Code:
  1. class MyDelegate : public QStyledItemDelegate
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. MyDelegate(QObject* parent);
  7. QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
  8. virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
  9. virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
  10. virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
  11.  
  12. signals:
  13. void mySignal(int value);
  14.  
  15. };
  16.  
  17. void MyDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
  18. {
  19. int i = 1;
  20. ...do some stuff...
  21.  
  22. emit mySignal(i);
  23. }
To copy to clipboard, switch view to plain text mode 

However I have a problem that I can't understand... The compiler is telling me:
"error: passing 'const MyDelegate' as 'this' argument of 'void MyDelegate::mySignal(int)' discards qualifiers"

I can't understand this error if I'm passing an int as an argument, not a "MyDelegate"...
If someone can explain or knows something about this or maybe, if anyone thinks that this is a bug...
Well, any help is appreciated...