Hey Everyone,
I have a QTreeView that uses a QAbstractItemModel.
I want Column 8.to use ComboBoxes, so I implemented a new delegate, but when compiling this error comes out: undefined reference to `ComboDelegate::ComboDelegate(QObject*)'

Here is my code:

Qt Code:
  1. /*TreeView*/
  2. ....
  3. #include <QtGui>
  4. #include "ComboDelegate.h"
  5. .....
  6. /*Error*/ ComboDelegate* delegate = new ComboDelegate();
  7. TreeView->setItemDelegateForColumn(8, delegate);
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. /*delegate.h*/
  2. ...
  3. class ComboDelegate : public QItemDelegate
  4. {
  5. Q_OBJECT
  6. public:
  7.  
  8. ComboDelegate(QObject *parent = 0);
  9. QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
  10. void setEditorData(QWidget *editor, const QModelIndex &index) const;
  11. void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
  12. void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
  13. };
  14.  
  15. #endif
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. /*delegate.cpp*/
  2. #include "ComboDelegate.h"
  3.  
  4. ComboDelegate::ComboDelegate(QObject *parent): QItemDelegate(parent)
  5. {
  6. }
  7.  
  8. QWidget *ComboDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &/* option */, const QModelIndex &/* index */) const
  9. {
  10. QComboBox *editor = new QComboBox(parent);
  11. QStringList list ;
  12. list << "a" << "b" << "c" << "d";
  13. editor->addItems(list);
  14. return editor;
  15. }
  16.  
  17. void ComboDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
  18. {
  19. QString value = index.model()->data(index, Qt::DisplayRole).toString();
  20. QComboBox *comboBox = static_cast<QComboBox*>(editor);
  21. comboBox->addItem(value);
  22. }
  23.  
  24. void ComboDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
  25. {
  26. QComboBox *comboBox = static_cast<QComboBox*>(editor);
  27. QString value = comboBox->currentText();
  28. model->setData(index, value);
  29. }
  30.  
  31. void ComboDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
  32. {
  33. editor->setGeometry(option.rect);
  34. }
To copy to clipboard, switch view to plain text mode 

Any suggestions ??