As the title says... i have a qitemdelgate which creates a QCheckBox as editor for some items. how can i center this editor in the cell of the qtableview where the editor shows up.

here`s the method i wrote so far

Qt Code:
  1. QWidget* QmitkDataStorageDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option
  2. , const QModelIndex &index) const
  3. {
  4. if (index.column() == m_VisibilityColumnIndex)
  5. {
  6. //option.decorationAlignment = Qt::AlignCenter;
  7. //option.decorationAlignment = Qt::AlignCenter;
  8.  
  9. QCheckBox* visibilityCheckBox = new QCheckBox(parent);
  10. connect(visibilityCheckBox, SIGNAL(editingFinished()),
  11. this, SLOT(commitAndCloseEditor()));
  12. return visibilityCheckBox;
  13. }
  14. else
  15. {
  16. return QItemDelegate::createEditor(parent, option, index);
  17. }
  18. }
To copy to clipboard, switch view to plain text mode