The ownership of the editor returned by the Python override of
QAbstractItemDelegate.createEditor(...) is now transferred to C++.

A test was added to simulate the situation that triggers the bug,
instead of relying on an example with a view, model and editable cells.

See: http://bugs.openbossa.org/show_bug.cgi?id=502

Reviewed by Lauro Moura <lauro.neto@openbossa.org>
Reviewed by Renato Araújo <renato.filho@openbossa.org>
This commit is contained in:
Marcelo Lira 2010-12-17 19:37:35 -03:00
commit 14a5405837
6 changed files with 91 additions and 7 deletions

View file

@ -1,12 +1,24 @@
#include "testview.h"
#include <QDebug>
#include <stdio.h>
#include <QWidget>
#include <QAbstractListModel>
#include <QAbstractItemDelegate>
QVariant
TestView::getData()
{
QModelIndex index;
QVariant data = m_model->data(index);
return data;
return m_model->data(index);
}
QWidget*
TestView::getEditorWidgetFromItemDelegate() const
{
if (!m_delegate)
return 0;
QModelIndex index;
QStyleOptionViewItem options;
return m_delegate->createEditor(0, options, index);
}