we have made a new .h and a new .cpp

like
Qt Code:
  1. #ifndef TABLEIHALESARTNAMEDELEGATE_H
  2. #define TABLEIHALESARTNAMEDELEGATE_H
  3.  
  4. #include <QItemDelegate>
  5. #include <QModelIndex>
  6. #include <QObject>
  7. #include <QSize>
  8. #include <QDoubleSpinBox>
  9. #include <QtGui>
  10.  
  11.  
  12. class ComboBoxDelegate : public QItemDelegate
  13. {
  14. Q_OBJECT
  15.  
  16. public:
  17. ComboBoxDelegate(QObject *parent = 0);
  18.  
  19. QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
  20. const QModelIndex &index) const;
  21. };
  22.  
  23. #endif
To copy to clipboard, switch view to plain text mode 

and made our .cpp

Qt Code:
  1. #include <QtGui>
  2. #include "tableIhaleSartnameDelegate.h"
  3.  
  4. QWidget *ComboBoxDelegate::createEditor(QWidget *parent,
  5. const QStyleOptionViewItem &option,
  6. const QModelIndex &index) const
  7. {
  8. if (index.column() == 0)
  9. {
  10. // 2nd column is being edited, return a QComboBox as an editor
  11. QComboBox *editor = new QComboBox(parent);
  12.  
  13. return editor;
  14. }
  15. return QItemDelegate::createEditor(parent, option, index);
  16. }
To copy to clipboard, switch view to plain text mode 

after that what we should do?