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 • committed by Hugo Parente Lima
commit 7771798cf2
6 changed files with 91 additions and 7 deletions

View file

@ -2,12 +2,15 @@
#define TESTVIEW_H
#include <QObject>
#include <QAbstractListModel>
#ifdef pysidetest_EXPORTS
#define PYSIDE_EXPORTS 1
#endif
#include "pysidemacros.h"
class QWidget;
class QAbstractListModel;
class QAbstractItemDelegate;
class PYSIDE_API TestView : public QObject
{
Q_OBJECT
@ -15,8 +18,13 @@ public:
TestView(QAbstractListModel* model, QObject* parent = 0) : QObject(parent), m_model(model) {}
QAbstractListModel* model() { return m_model; }
QVariant getData();
void setItemDelegate(QAbstractItemDelegate* delegate) { m_delegate = delegate; }
QWidget* getEditorWidgetFromItemDelegate() const;
private:
QAbstractListModel* m_model;
QAbstractItemDelegate* m_delegate;
};
#endif // TESTVIEW_H