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
{
if (index.column() == m_VisibilityColumnIndex)
{
//option.decorationAlignment = Qt::AlignCenter;
//option.decorationAlignment = Qt::AlignCenter;
connect(visibilityCheckBox, SIGNAL(editingFinished()),
this, SLOT(commitAndCloseEditor()));
return visibilityCheckBox;
}
else
{
}
}
QWidget* QmitkDataStorageDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option
, const QModelIndex &index) const
{
if (index.column() == m_VisibilityColumnIndex)
{
//option.decorationAlignment = Qt::AlignCenter;
//option.decorationAlignment = Qt::AlignCenter;
QCheckBox* visibilityCheckBox = new QCheckBox(parent);
connect(visibilityCheckBox, SIGNAL(editingFinished()),
this, SLOT(commitAndCloseEditor()));
return visibilityCheckBox;
}
else
{
return QItemDelegate::createEditor(parent, option, index);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks