Fix bug#347 - "Setting properties in constructors gives incorrect results"

Added new function to libpyside: "fillQtProperties".

Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
          Renato Araújo <renato.filho@openbossa.org>
This commit is contained in:
Hugo Parente Lima 2010-09-15 10:44:27 -03:00
commit 87ea5d920c
4 changed files with 67 additions and 0 deletions

View file

@ -26,6 +26,8 @@
#include <Python.h>
#include <pysidemacros.h>
#include <QMetaType>
#include <QHash>
#include <QList>
namespace PySide
{
@ -41,6 +43,17 @@ inline uint hash(const T& value)
return qHash(value.toString());
}
/**
* Fill QObject properties and do signal connections using the values found in \p kwds dictonary.
* \param qObj PyObject fot the QObject.
* \param metaObj QMetaObject of \p qObj.
* \param blackList keys to be ignored in kwds dictionary, this string list MUST be sorted.
* \param blackListSize numbe rof elements in blackList.
* \param kwds key->value dictonary.
* \return True if everything goes well, false with a Python error setted otherwise.
*/
PYSIDE_API bool fillQtProperties(PyObject* qObj, const QMetaObject* metaObj, PyObject* kwds, const char** blackList, unsigned int blackListSize);
/**
* If the type \p T was registered on Qt meta type system with Q_DECLARE_METATYPE macro, this class will initialize
* the meta type.