Expose attribute to Python to access icon of view provider

This commit is contained in:
wmayer
2015-06-02 16:21:56 +02:00
parent 4e94c02dda
commit 1808fd83ed
4 changed files with 41 additions and 0 deletions

View File

@@ -44,6 +44,7 @@
# undef _POSIX_C_SOURCE
# undef _XOPEN_SOURCE
# include <basewrapper.h>
# include <conversions.h>
# include <sbkmodule.h>
# include <typeresolver.h>
# include <shiboken.h>
@@ -179,6 +180,16 @@ QObject* PythonWrapper::toQObject(const Py::Object& pyobject)
return 0;
}
Py::Object PythonWrapper::fromQIcon(const QIcon* icon)
{
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
PyObject* pyobj = Shiboken::createWrapper<QIcon>(icon, true);
if (pyobj)
return Py::asObject(pyobj);
#endif
throw Py::RuntimeError("Failed to wrap icon");
}
Py::Object PythonWrapper::fromQWidget(QWidget* widget, const char* className)
{
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)