Hi,

I have:
Qt Code:
  1. model->setTable( "table" );
  2. model->select();
  3. model->setHeaderData( 0, Qt::Horizontal, QObject::tr("Annual Pay") );
  4. model->setHeaderData( 1, Qt::Horizontal, QObject::tr("First Name") );
  5. model->setHeaderData( 2, Qt::Horizontal, QObject::tr("Last Name") );
  6. model->removeColumn( 0 );
  7. TableResult->setModel( model );
  8. BarDelegate delegate;
  9. TableResult->setItemDelegateForColumn(1, &delegate);
  10. TableResult->show();
To copy to clipboard, switch view to plain text mode 

and in Delegate class i've:

Qt Code:
  1. class BarDelegate : public QAbstractItemDelegate
  2. {
  3. public:
  4. BarDelegate( QObject *parent = 0 );
  5.  
  6. void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const;
  7. QSize sizeHint( const QStyleOptionViewItem &option, const QModelIndex &index ) const;
  8.  
  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. };
To copy to clipboard, switch view to plain text mode 

In createEditor:
Qt Code:
  1. QWidget *BarDelegate::createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const
  2. {
  3. QMessageBox::information( 0, "window1", "test" );
  4. QLineEdit *lineEdit = new QLineEdit( parent );
  5. lineEdit->setAutoFillBackground( true );
  6. lineEdit->installEventFilter( const_cast<BarDelegate*>(this) );
  7. return lineEdit;
  8. }
To copy to clipboard, switch view to plain text mode 

When I press on a cell TableResult, there is no QMessageBox :/

Similar with:
Qt Code:
  1. void BarDelegate::setEditorData( QWidget *editor, const QModelIndex &index ) const
  2. {
  3. QMessageBox::information( 0, "window1", "test2" );
  4. QString value = index.model()->data( index, Qt::DisplayRole ).toString();
  5. static_cast<QLineEdit*>( editor )->setText( value );
  6. }
To copy to clipboard, switch view to plain text mode 
and :/
Qt Code:
  1. void BarDelegate::setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const
  2. {
  3. QMessageBox::information( 0, "window1", "test3" );
  4. model->setData( index, static_cast<QLineEdit*>( editor )->text() );
  5. }
To copy to clipboard, switch view to plain text mode