diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-12-17 19:37:35 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:48:01 -0300 |
commit | 7771798cf27896c43054699c5f53468cd8bf14cf (patch) | |
tree | 1115cf02ac1b8c88ee14d24fca96c17d2831f44c /tests/pysidetest/testview.cpp | |
parent | 05d011ccfa3ad442adb3639f9db87d49dd346299 (diff) |
Fixes bug #502.
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>
Diffstat (limited to 'tests/pysidetest/testview.cpp')
-rw-r--r-- | tests/pysidetest/testview.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/tests/pysidetest/testview.cpp b/tests/pysidetest/testview.cpp index 22ef9ddb1..75620e0db 100644 --- a/tests/pysidetest/testview.cpp +++ b/tests/pysidetest/testview.cpp @@ -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); } |