I am checking the Qt example Spin Box Delegate example. In the example
QWidget *SpinBoxDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem &/* option */,
const QModelIndex &/* index */) const
{
QSpinBox *editor = new QSpinBox(parent);
...
return editor;
}
How is the pointer editor deleted in the later stage? Is the deletion done by QItemDelegate destructor? But the destructor of QItemDelegate is not virtual. Anyone could help me to explain how it works?
I can not put any break-point in QtCreator. The way I understand is every time the virtual function createEditor() is invoked, a new trunk of memory will be allocated and the client code will lose pointer at the end of the function. The Qt document about createEditor() does not explain. But I guess each cell in the tableView will have an editor, is that right?
I am really wondering how Qt delete those QWidget pointers.
Thanks