Hello,
I've a QStyledItemDelegate derived class for a custom delegate editor:
: QStyledItemDelegate(parent), texts(texts)
{ }
{
CheckBoxDelegateWidget *editor = new CheckBoxDelegateWidget(texts, parent);
...
return editor;
}
CheckBoxDelegate::CheckBoxDelegate(const QStringList &texts, QObject *parent)
: QStyledItemDelegate(parent), texts(texts)
{ }
QWidget *CheckBoxDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem &/* option */,
const QModelIndex &index) const
{
CheckBoxDelegateWidget *editor = new CheckBoxDelegateWidget(texts, parent);
...
return editor;
}
To copy to clipboard, switch view to plain text mode
Now I want sizeHint() to return the CheckBoxDelegateWidget sizes, like this:
{
return editor->sizeHint(); // what editor?
}
QSize CheckBoxDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index ) const
{
return editor->sizeHint(); // what editor?
}
To copy to clipboard, switch view to plain text mode
Where I can obtain the editor pointer? Why createEditor() doesn't let me do a local copy of the pointer?
Thank you.
Bookmarks