Compare commits
73 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f011ce2cb9 | ||
|
|
fe8dc36f90 | ||
|
|
db6f1e3306 | ||
|
|
d30a8672c3 | ||
|
|
afc9a7e10b | ||
|
|
a8a07b77f8 | ||
|
|
98be0df6a5 | ||
|
|
b2b14fe9b7 | ||
|
|
481ba5aa3e | ||
|
|
8ddbd3167b | ||
|
|
65d8f9fcef | ||
|
|
7b8d2925dd | ||
|
|
c78b4686a1 | ||
|
|
e76b2b76f5 | ||
|
|
2a634aea05 | ||
|
|
7bfbbf3cb7 | ||
|
|
aec20b21a5 | ||
|
|
ebeae9d084 | ||
|
|
31804c2adc | ||
|
|
c31c14cdfb | ||
|
|
879e4bb14d | ||
|
|
6575ac8d39 | ||
|
|
1af53541bf | ||
|
|
2a87b74bfe | ||
|
|
792504f978 | ||
|
|
7b04273736 | ||
|
|
30118e265d | ||
|
|
770c8bda73 | ||
|
|
16f4378fed | ||
|
|
80c02f16e5 | ||
|
|
b643a3f8ab | ||
|
|
8145f2a7e2 | ||
|
|
25638d3f80 | ||
|
|
3318a40ab1 | ||
|
|
ba062e1b89 | ||
|
|
3ee5bec244 | ||
|
|
ae0f62ed80 | ||
|
|
64bec138e1 | ||
|
|
1105a5be3a | ||
|
|
815fae961f | ||
|
|
8c1fbc3751 | ||
|
|
ad8992e9e0 | ||
|
|
41f1c30372 | ||
|
|
720a6f4cad | ||
|
|
48669462d0 | ||
|
|
66f4ccbe5d | ||
|
|
508e59c091 | ||
|
|
93bb5d777e | ||
|
|
e3814f27dd | ||
|
|
2f70b10471 | ||
|
|
e2524f6abb | ||
|
|
4985f114a3 | ||
|
|
791f70629c | ||
|
|
8160e529e2 | ||
|
|
45ad11e5be | ||
|
|
e031567fac | ||
|
|
e29d2e460b | ||
|
|
fbf3a8b07a | ||
|
|
dde75099f2 | ||
|
|
64ffc4f61b | ||
|
|
50bf9a570b | ||
|
|
b30e998e65 | ||
|
|
c230fad427 | ||
|
|
6fe19dbb88 | ||
|
|
8060e3ee87 | ||
|
|
b50186e9f3 | ||
|
|
4ba7cd90d6 | ||
|
|
f57d4d4dbc | ||
|
|
5c076e1c53 | ||
|
|
67d6455fa5 | ||
|
|
15ceed791f | ||
|
|
f55d088d44 | ||
|
|
07d0879700 |
129 changed files with 2365 additions and 1588 deletions
|
|
@ -5,8 +5,7 @@ project(pysidebindings)
|
|||
cmake_minimum_required(VERSION 2.6)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Macros/
|
||||
${CMAKE_MODULE_PATH})
|
||||
find_package(GeneratorRunner 0.6.14 REQUIRED)
|
||||
find_package(Shiboken 1.0.8 REQUIRED)
|
||||
find_package(Shiboken 1.1.1 REQUIRED)
|
||||
find_package(Qt4 4.5.0 REQUIRED)
|
||||
find_file(GL_H "gl.h" PATH_SUFFIXES "GL")
|
||||
include(FindQt4Extra)
|
||||
|
|
@ -32,7 +31,7 @@ endif()
|
|||
if(MSVC)
|
||||
set(CMAKE_CXX_FLAGS "/Zc:wchar_t- /GR /EHsc /DNOCOLOR /DWIN32 /D_WINDOWS /D_SCL_SECURE_NO_WARNINGS")
|
||||
else()
|
||||
if(CMAKE_HOST_UNIX)
|
||||
if(CMAKE_HOST_UNIX AND NOT CYGWIN)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fvisibility=hidden -Wno-strict-aliasing")
|
||||
endif()
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g")
|
||||
|
|
@ -62,8 +61,8 @@ endif()
|
|||
|
||||
set(BINDING_NAME PySide)
|
||||
set(BINDING_API_MAJOR_VERSION "1")
|
||||
set(BINDING_API_MINOR_VERSION "0")
|
||||
set(BINDING_API_MICRO_VERSION "8")
|
||||
set(BINDING_API_MINOR_VERSION "1")
|
||||
set(BINDING_API_MICRO_VERSION "1")
|
||||
set(BINDING_API_RELEASE_LEVEL "final") # alpha, beta, rc, or final
|
||||
set(BINDING_API_SERIAL 1) # leave as 0 when release level is final
|
||||
set(BINDING_API_VERSION "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}.${BINDING_API_MICRO_VERSION}" CACHE STRING "PySide version" FORCE)
|
||||
|
|
|
|||
|
|
@ -9,9 +9,6 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/global.h.in"
|
|||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/__init__.py" @ONLY)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/private.py"
|
||||
"${CMAKE_BINARY_DIR}/PySide/private.py")
|
||||
|
||||
HAS_QT_MODULE(QT_QTCORE_FOUND QtCore)
|
||||
HAS_QT_MODULE(QT_QTGUI_FOUND QtGui)
|
||||
HAS_QT_MODULE(QT_QTNETWORK_FOUND QtNetwork)
|
||||
|
|
@ -34,7 +31,7 @@ HAS_QT_MODULE(QT_PHONON_FOUND phonon)
|
|||
HAS_QT_MODULE(QT_QTDECLARATIVE_FOUND QtDeclarative)
|
||||
|
||||
# install
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/__init__.py" "${CMAKE_CURRENT_BINARY_DIR}/private.py"
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/__init__.py"
|
||||
DESTINATION "${SITE_PACKAGE}/${BINDING_NAME}${pyside_SUFFIX}")
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_templates.xml
|
||||
DESTINATION share/PySide${pyside_SUFFIX}/typesystems)
|
||||
|
|
|
|||
|
|
@ -37,14 +37,12 @@ else()
|
|||
endif()
|
||||
|
||||
if(ENABLE_WIN)
|
||||
set(QtCore_typesystem "typesystem_core_win.xml")
|
||||
set(QtCore_extra_SRC
|
||||
set(SPECIFIC_OS_FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/msg_wrapper.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/point_wrapper.cpp
|
||||
)
|
||||
else()
|
||||
set(QtCore_typesystem "typesystem_core.xml")
|
||||
set(QtCore_extra_SRC "")
|
||||
set(SPECIFIC_OS_FILES "")
|
||||
endif()
|
||||
|
||||
set(QtCore_SRC
|
||||
|
|
@ -146,10 +144,14 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/qxmlstreamreader_wrapper.cpp
|
|||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/qxmlstreamwriter_wrapper.cpp
|
||||
${QtCore_46_SRC}
|
||||
${QtCore_47_SRC}
|
||||
${QtCore_extra_SRC}
|
||||
${SPECIFIC_OS_FILES}
|
||||
)
|
||||
|
||||
set(QtCore_typesystem_path "")
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/typesystem_core.xml.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/typesystem_core.xml" @ONLY)
|
||||
|
||||
set(QtCore_typesystem_path "${QtCore_SOURCE_DIR}")
|
||||
|
||||
set(QtCore_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${BINDING_NAME}/QtCore/
|
||||
${QT_INCLUDE_DIR}
|
||||
|
|
@ -168,4 +170,4 @@ create_pyside_module(QtCore
|
|||
QtCore_typesystem_path
|
||||
QtCore_SRC
|
||||
QtCore_gluecode
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${QtCore_typesystem})
|
||||
${CMAKE_CURRENT_BINARY_DIR}/typesystem_core.xml)
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
namespace Shiboken {
|
||||
template <>
|
||||
struct Converter<HWND>
|
||||
{
|
||||
static bool checkType(PyObject* pyObj)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool isConvertible(PyObject* pyobj)
|
||||
{
|
||||
return PyCObject_Check(pyobj);
|
||||
}
|
||||
|
||||
static inline PyObject* toPython(void* cppobj)
|
||||
{
|
||||
// not supported
|
||||
Q_ASSERT(true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject* toPython(HWND cppobj)
|
||||
{
|
||||
return PyCObject_FromVoidPtr(cppobj, 0);
|
||||
}
|
||||
|
||||
static HWND toCpp(PyObject* pyobj)
|
||||
{
|
||||
return (HWND)PyCObject_AsVoidPtr(pyobj);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@ static Py_ssize_t SbkQByteArray_readbufferproc(PyObject* self, Py_ssize_t segmen
|
|||
if (segment || !Shiboken::Object::isValid(self))
|
||||
return -1;
|
||||
|
||||
QByteArray* cppSelf = Shiboken::Converter<QByteArray*>::toCpp(self);
|
||||
QByteArray* cppSelf = %CONVERTTOCPP[QByteArray*](self);
|
||||
*ptrptr = reinterpret_cast<void*>(cppSelf->data());
|
||||
return cppSelf->size();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ qreal PySideEasingCurveFunctor::operator()(qreal progress)
|
|||
PyObject* result = PyObject_CallObject(m_func, args);
|
||||
qreal cppResult = 0.0;
|
||||
if (result) {
|
||||
cppResult = Shiboken::Converter<qreal>::toCpp(result);
|
||||
Shiboken::Conversions::pythonToCppCopy(Shiboken::Conversions::PrimitiveTypeConverter<qreal>(), result, &cppResult);
|
||||
Py_DECREF(result);
|
||||
}
|
||||
Py_DECREF(args);
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@ static bool getReceiver(QObject *source, const char* signal, PyObject* callback,
|
|||
bool forceGlobalReceiver = false;
|
||||
if (PyMethod_Check(callback)) {
|
||||
*self = PyMethod_GET_SELF(callback);
|
||||
if (Shiboken::Converter<QObject*>::checkType(*self))
|
||||
*receiver = Shiboken::Converter<QObject*>::toCpp(*self);
|
||||
if (%CHECKTYPE[QObject*](*self))
|
||||
*receiver = %CONVERTTOCPP[QObject*](*self);
|
||||
forceGlobalReceiver = isDecorator(callback, *self);
|
||||
} else if (PyCFunction_Check(callback)) {
|
||||
*self = PyCFunction_GET_SELF(callback);
|
||||
if (*self && Shiboken::Converter<QObject*>::checkType(*self))
|
||||
*receiver = Shiboken::Converter<QObject*>::toCpp(*self);
|
||||
if (*self && %CHECKTYPE[QObject*](*self))
|
||||
*receiver = %CONVERTTOCPP[QObject*](*self);
|
||||
} else if (PyCallable_Check(callback)) {
|
||||
// Ok, just a callable object
|
||||
*receiver = 0;
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
QList<QByteArray> version = QByteArray(qVersion()).split('.');
|
||||
PyObject *pyQtVersion = Shiboken::makeTuple(version[0].toInt(), version[1].toInt(), version[2].toInt());
|
||||
|
||||
PyModule_AddStringConstant(module, "__version__", qVersion());
|
||||
PyModule_AddObject(module, "__version_info__", pyQtVersion);
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
namespace Shiboken {
|
||||
template <>
|
||||
struct Converter<QBool> : public ValueTypeConverter<QBool>
|
||||
{
|
||||
using ValueTypeConverter<QBool>::toPython;
|
||||
|
||||
static PyObject* toPython(const QBool& cppobj)
|
||||
{
|
||||
return PyBool_FromLong((bool) cppobj);
|
||||
}
|
||||
static QBool toCpp(PyObject* pyobj)
|
||||
{
|
||||
return QBool(pyobj == Py_True);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
namespace Shiboken {
|
||||
|
||||
inline bool Converter<QByteArray>::checkType(PyObject* pyObj)
|
||||
{
|
||||
return ValueTypeConverter<QByteArray>::checkType(pyObj);
|
||||
}
|
||||
|
||||
inline bool Converter<QByteArray>::isConvertible(PyObject* pyObj)
|
||||
{
|
||||
if (ValueTypeConverter<QByteArray>::isConvertible(pyObj))
|
||||
return true;
|
||||
SbkObjectType* shiboType = reinterpret_cast<SbkObjectType*>(SbkType< ::QByteArray >());
|
||||
return Shiboken::Converter<const char *>::checkType(pyObj)
|
||||
|| PyBytes_Check(pyObj)
|
||||
|| (ObjectType::isExternalConvertible(shiboType, pyObj));
|
||||
}
|
||||
|
||||
inline QByteArray Converter<QByteArray>::toCpp(PyObject* pyObj)
|
||||
{
|
||||
if (pyObj == Py_None) {
|
||||
return 0;
|
||||
} else if (PyObject_TypeCheck(pyObj, SbkType<QByteArray>())) {
|
||||
return *Converter<QByteArray*>::toCpp(pyObj);
|
||||
} else if (PyBytes_Check(pyObj)) {
|
||||
return QByteArray(PyBytes_AS_STRING(pyObj), PyBytes_GET_SIZE(pyObj));
|
||||
} else if (PyUnicode_Check(pyObj)) {
|
||||
Shiboken::AutoDecRef data(PyUnicode_AsASCIIString(pyObj));
|
||||
if (!data.isNull())
|
||||
return QByteArray(PyBytes_AsString(data.object()), PyBytes_GET_SIZE(data.object()));
|
||||
else
|
||||
return QByteArray();
|
||||
} else if (Shiboken::String::check(pyObj)) {
|
||||
return QByteArray(Shiboken::String::toCString(pyObj));
|
||||
} else {
|
||||
return ValueTypeConverter<QByteArray>::toCpp(pyObj);
|
||||
}
|
||||
}
|
||||
|
||||
inline PyObject* Converter<QByteArray>::toPython(const ::QByteArray& cppObj)
|
||||
{
|
||||
return ValueTypeConverter<QByteArray>::toPython(cppObj);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
namespace Shiboken {
|
||||
|
||||
template<>
|
||||
struct Converter<QChar>
|
||||
{
|
||||
static bool checkType(PyObject* pyObj)
|
||||
{
|
||||
return Shiboken::String::check(pyObj) && (Shiboken::String::len(pyObj) == 1);
|
||||
}
|
||||
|
||||
static bool isConvertible(PyObject* pyObj)
|
||||
{
|
||||
return (Shiboken::String::check(pyObj) && (Shiboken::String::len(pyObj) == 1))
|
||||
|| pyObj == Py_None
|
||||
|| PyInt_Check(pyObj);
|
||||
}
|
||||
|
||||
static QChar toCpp(PyObject* pyObj)
|
||||
{
|
||||
if (Shiboken::String::check(pyObj) && (Shiboken::String::len(pyObj) == 1))
|
||||
return QChar(Shiboken::Converter<char >::toCpp(pyObj));
|
||||
else if (PyInt_Check(pyObj))
|
||||
return QChar(Shiboken::Converter<int >::toCpp(pyObj));
|
||||
return QChar();
|
||||
}
|
||||
|
||||
static PyObject* toPython(void* cppObj) { return toPython(*reinterpret_cast<QChar*>(cppObj)); }
|
||||
static PyObject* toPython(const QChar& cppObj)
|
||||
{
|
||||
wchar_t c = (wchar_t)cppObj.unicode();
|
||||
PyObject* pyObj = PyUnicode_FromWideChar(&c, 1);
|
||||
return pyObj;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
#ifdef IS_PY3K
|
||||
#define PySideDateTime_IMPORT PyDateTime_IMPORT
|
||||
#else
|
||||
#define PySideDateTime_IMPORT \
|
||||
PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_Import((char*)"datetime", \
|
||||
(char*)"datetime_CAPI")
|
||||
#endif
|
||||
|
||||
namespace Shiboken {
|
||||
|
||||
inline bool Converter<QDate>::checkType(PyObject* pyObj)
|
||||
{
|
||||
return ValueTypeConverter<QDate>::checkType(pyObj);
|
||||
}
|
||||
|
||||
inline PyObject* Converter<QDate>::toPython(const ::QDate& cppObj)
|
||||
{
|
||||
return ValueTypeConverter<QDate>::toPython(cppObj);
|
||||
}
|
||||
|
||||
inline bool Converter<QDate>::isConvertible(PyObject* pyObj)
|
||||
{
|
||||
if (ValueTypeConverter<QDate>::isConvertible(pyObj))
|
||||
return true;
|
||||
|
||||
if (!PyDateTimeAPI)
|
||||
PySideDateTime_IMPORT;
|
||||
|
||||
SbkObjectType* shiboType = reinterpret_cast<SbkObjectType*>(SbkType< ::QDate >());
|
||||
return PyDate_Check(pyObj) || ObjectType::isExternalConvertible(shiboType, pyObj);
|
||||
}
|
||||
|
||||
inline QDate Converter<QDate>::toCpp(PyObject* pyObj)
|
||||
{
|
||||
if (!PyDateTimeAPI)
|
||||
PySideDateTime_IMPORT;
|
||||
|
||||
if (pyObj == Py_None) {
|
||||
return QDate();
|
||||
} else if (PyObject_TypeCheck(pyObj, SbkType<QDate>())) {
|
||||
return *Converter<QDate*>::toCpp(pyObj);
|
||||
} else if (PyDate_Check(pyObj)) {
|
||||
int day = PyDateTime_GET_DAY(pyObj);
|
||||
int month = PyDateTime_GET_MONTH(pyObj);
|
||||
int year = PyDateTime_GET_YEAR(pyObj);
|
||||
return QDate(year, month, day);
|
||||
} else {
|
||||
return ValueTypeConverter<QDate>::toCpp(pyObj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
#ifdef IS_PY3K
|
||||
#define PySideDateTime_IMPORT PyDateTime_IMPORT
|
||||
#else
|
||||
#define PySideDateTime_IMPORT \
|
||||
PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_Import((char*)"datetime", \
|
||||
(char*)"datetime_CAPI")
|
||||
#endif
|
||||
namespace Shiboken {
|
||||
|
||||
inline bool Converter<QDateTime>::checkType(PyObject* pyObj)
|
||||
{
|
||||
return ValueTypeConverter<QDateTime>::checkType(pyObj);
|
||||
}
|
||||
|
||||
inline PyObject* Converter<QDateTime>::toPython(const ::QDateTime& cppObj)
|
||||
{
|
||||
return ValueTypeConverter<QDateTime>::toPython(cppObj);
|
||||
}
|
||||
|
||||
inline bool Converter<QDateTime>::isConvertible(PyObject* pyObj)
|
||||
{
|
||||
if (ValueTypeConverter<QDateTime>::isConvertible(pyObj))
|
||||
return true;
|
||||
|
||||
if (!PyDateTimeAPI)
|
||||
PySideDateTime_IMPORT;
|
||||
|
||||
SbkObjectType* shiboType = reinterpret_cast<SbkObjectType*>(SbkType< ::QDateTime >());
|
||||
return PyDateTime_Check(pyObj) || ObjectType::isExternalConvertible(shiboType, pyObj);
|
||||
}
|
||||
|
||||
|
||||
inline QDateTime Converter<QDateTime>::toCpp(PyObject* pyObj)
|
||||
{
|
||||
if (!PyDateTimeAPI)
|
||||
PySideDateTime_IMPORT;
|
||||
|
||||
if (pyObj == Py_None) {
|
||||
return QDateTime();
|
||||
} else if (PyObject_TypeCheck(pyObj, SbkType<QDateTime>())) {
|
||||
return *Converter<QDateTime*>::toCpp(pyObj);
|
||||
} else if (PyDateTime_Check(pyObj)) {
|
||||
int day = PyDateTime_GET_DAY(pyObj);
|
||||
int month = PyDateTime_GET_MONTH(pyObj);
|
||||
int year = PyDateTime_GET_YEAR(pyObj);
|
||||
int hour = PyDateTime_DATE_GET_HOUR(pyObj);
|
||||
int min = PyDateTime_DATE_GET_MINUTE(pyObj);
|
||||
int sec = PyDateTime_DATE_GET_SECOND(pyObj);
|
||||
int usec = PyDateTime_DATE_GET_MICROSECOND(pyObj);
|
||||
return QDateTime(QDate(year, month, day), QTime(hour, min, sec, usec/1000));
|
||||
} else {
|
||||
return ValueTypeConverter<QDateTime>::toCpp(pyObj);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
namespace Shiboken {
|
||||
template<typename KT, typename VT>
|
||||
struct Converter<QHash<KT, VT> > : QtDictConverter<QHash<KT, VT> > {};
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
namespace Shiboken {
|
||||
template<typename T>
|
||||
struct Converter<QList<T> > : StdListConverter<QList<T> > {};
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
namespace Shiboken {
|
||||
template<typename KT, typename VT>
|
||||
struct Converter<QMap<KT, VT> > : QtDictConverter<QMap<KT, VT> > {
|
||||
};
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
namespace Shiboken {
|
||||
template<typename KT, typename VT>
|
||||
struct Converter<QMultiMap<KT, VT> > : QtMultiMapConverter<QMap<KT, VT> > {
|
||||
};
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
namespace Shiboken {
|
||||
template<typename FT, typename ST>
|
||||
struct Converter<QPair<FT, ST> > : StdPairConverter<QPair<FT, ST> > {};
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
namespace Shiboken {
|
||||
template<typename T>
|
||||
struct Converter<QSet<T> > : QSequenceConverter<QSet<T> > {};
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
namespace Shiboken {
|
||||
template<typename T>
|
||||
struct Converter<QStack<T> > : StdListConverter<QStack<T> > {};
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
namespace Shiboken {
|
||||
|
||||
template<>
|
||||
inline PyTypeObject* SbkType<QString>()
|
||||
{
|
||||
return &PyUnicode_Type;
|
||||
}
|
||||
|
||||
template<>
|
||||
struct Converter<QString>
|
||||
{
|
||||
static bool checkType(PyObject* pyObj)
|
||||
{
|
||||
return Shiboken::String::check(pyObj);
|
||||
}
|
||||
|
||||
static bool isConvertible(PyObject* pyObj)
|
||||
{
|
||||
return Shiboken::String::isConvertible(pyObj);
|
||||
}
|
||||
|
||||
static QString toCpp(PyObject* pyObj)
|
||||
{
|
||||
if (PyUnicode_Check(pyObj)) {
|
||||
Py_UNICODE* unicode = PyUnicode_AS_UNICODE(pyObj);
|
||||
#if defined(Py_UNICODE_WIDE)
|
||||
// cast as Py_UNICODE can be a different type
|
||||
return QString::fromUcs4(reinterpret_cast<const uint*>(unicode));
|
||||
#else
|
||||
return QString::fromUtf16(unicode, PyUnicode_GET_SIZE(pyObj));
|
||||
#endif
|
||||
} else if (Shiboken::String::check(pyObj)) {
|
||||
return QString(Shiboken::String::toCString(pyObj));
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
static PyObject* toPython(void* cppObj) { return toPython(*reinterpret_cast<QString*>(cppObj)); }
|
||||
static PyObject* toPython(const QString& cppObj)
|
||||
{
|
||||
const int N = cppObj.length();
|
||||
wchar_t* str = new wchar_t[N];
|
||||
cppObj.toWCharArray(str);
|
||||
PyObject* pyObj = PyUnicode_FromWideChar(str, N);
|
||||
delete[] str;
|
||||
return pyObj;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
namespace Shiboken
|
||||
{
|
||||
template<>
|
||||
struct Converter<QStringList> : StdListConverter<QStringList> {};
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
namespace Shiboken {
|
||||
|
||||
template<>
|
||||
struct Converter<QStringRef> : public Converter<QString>
|
||||
{
|
||||
static PyObject* toPython(void* cppObj) { return toPython(*reinterpret_cast<QStringRef*>(cppObj)); }
|
||||
|
||||
static PyObject* toPython(const QStringRef& cppObj)
|
||||
{
|
||||
return Converter<QString>::toPython(cppObj.toString());
|
||||
}
|
||||
|
||||
static QStringRef toCpp(PyObject* pyObj)
|
||||
{
|
||||
return QStringRef();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
namespace Shiboken {
|
||||
|
||||
inline bool Converter<QTime>::checkType(PyObject* pyObj)
|
||||
{
|
||||
return ValueTypeConverter<QTime>::checkType(pyObj);
|
||||
}
|
||||
|
||||
inline PyObject* Converter<QTime>::toPython(const ::QTime& cppObj)
|
||||
{
|
||||
return ValueTypeConverter<QTime>::toPython(cppObj);
|
||||
}
|
||||
|
||||
inline bool Converter<QTime>::isConvertible(PyObject* pyObj)
|
||||
{
|
||||
if (ValueTypeConverter<QTime>::isConvertible(pyObj))
|
||||
return true;
|
||||
|
||||
if (!PyDateTimeAPI)
|
||||
PyDateTime_IMPORT;
|
||||
|
||||
SbkObjectType* shiboType = reinterpret_cast<SbkObjectType*>(SbkType< ::QTime >());
|
||||
return PyTime_Check(pyObj) || ObjectType::isExternalConvertible(shiboType, pyObj);
|
||||
}
|
||||
|
||||
inline QTime Converter<QTime>::toCpp(PyObject* pyObj)
|
||||
{
|
||||
if (!PyDateTimeAPI)
|
||||
PyDateTime_IMPORT;
|
||||
|
||||
if (pyObj == Py_None) {
|
||||
return QTime();
|
||||
} else if (PyObject_TypeCheck(pyObj, SbkType<QTime>())) {
|
||||
return *Converter<QTime*>::toCpp(pyObj);
|
||||
} else if (PyTime_Check(pyObj)) {
|
||||
int hour = PyDateTime_TIME_GET_HOUR(pyObj);
|
||||
int min = PyDateTime_TIME_GET_MINUTE(pyObj);
|
||||
int sec = PyDateTime_TIME_GET_SECOND(pyObj);
|
||||
int usec = PyDateTime_TIME_GET_MICROSECOND(pyObj);
|
||||
return QTime(hour, min, sec, usec/1000);
|
||||
} else {
|
||||
return ValueTypeConverter<QTime>::toCpp(pyObj);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,219 +0,0 @@
|
|||
namespace Shiboken {
|
||||
|
||||
template<>
|
||||
struct Converter<QVariant>
|
||||
{
|
||||
static bool checkType(PyObject* pyObj)
|
||||
{
|
||||
return false; // lets avoid the chaos
|
||||
}
|
||||
|
||||
// all types are convertible to QVariant
|
||||
static bool isConvertible(PyObject* pyObj)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static const char* resolveMetaType(PyTypeObject* type, int* typeId)
|
||||
{
|
||||
if (PyObject_TypeCheck(type, &SbkObjectType_Type)) {
|
||||
SbkObjectType* sbkType = reinterpret_cast<SbkObjectType*>(type);
|
||||
const char* typeName = Shiboken::ObjectType::getOriginalName(sbkType);
|
||||
if (!typeName)
|
||||
return 0;
|
||||
bool valueType = '*' != typeName[qstrlen(typeName) - 1];
|
||||
|
||||
// Do not convert user type of value
|
||||
if (valueType && Shiboken::ObjectType::isUserType(type))
|
||||
return 0;
|
||||
|
||||
int obTypeId = QMetaType::type(typeName);
|
||||
if (obTypeId) {
|
||||
*typeId = obTypeId;
|
||||
return typeName;
|
||||
}
|
||||
|
||||
// Do not resolve types to value type
|
||||
if (valueType)
|
||||
return 0;
|
||||
|
||||
// find in base types
|
||||
if (type->tp_base) {
|
||||
return resolveMetaType(type->tp_base, typeId);
|
||||
} else if (type->tp_bases) {
|
||||
int size = PyTuple_GET_SIZE(type->tp_bases);
|
||||
for(int i=0; i < size; i++){
|
||||
const char* derivedName = resolveMetaType(reinterpret_cast<PyTypeObject*>(PyTuple_GET_ITEM(type->tp_bases, i)), typeId);
|
||||
if (derivedName)
|
||||
return derivedName;
|
||||
}
|
||||
}
|
||||
}
|
||||
*typeId = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static QVariant toCpp(PyObject* pyObj)
|
||||
{
|
||||
using namespace Shiboken;
|
||||
|
||||
// Primitive types
|
||||
if (Converter<bool>::checkType(pyObj)) {
|
||||
// QVariant(bool)
|
||||
return QVariant(Converter<bool>::toCpp(pyObj));
|
||||
} else if (pyObj == Py_None) {
|
||||
// QVariant()
|
||||
return QVariant();
|
||||
} else if (Converter<QString>::checkType(pyObj)) {
|
||||
// QVariant(const char*)
|
||||
return QVariant(Converter<QString>::toCpp(pyObj));
|
||||
} else if (Converter<QByteArray>::checkType(pyObj)) {
|
||||
// QVariant(QByteArray)
|
||||
return QVariant(Converter<QByteArray>::toCpp(pyObj));
|
||||
} else if (PyFloat_CheckExact(pyObj)) {
|
||||
// QVariant(double)
|
||||
return QVariant(Converter<double>::toCpp(pyObj));
|
||||
} else if (PyInt_Check(pyObj)) {
|
||||
// QVariant(int)
|
||||
return QVariant(Converter<int>::toCpp(pyObj));
|
||||
} else if (PyLong_CheckExact(pyObj)) {
|
||||
// QVariant(qlonglong)
|
||||
return QVariant(Converter<qlonglong>::toCpp(pyObj));
|
||||
} else if (Shiboken::isShibokenEnum(pyObj)) {
|
||||
// QVariant(enum)
|
||||
return QVariant(Converter<int>::toCpp(pyObj));
|
||||
} else if (PyNumber_Check(pyObj)) {
|
||||
Shiboken::AutoDecRef pyValue(PyNumber_Long(pyObj));
|
||||
return QVariant((int)PyLong_AsLong(pyValue.object()));
|
||||
} else if (Shiboken::Object::checkType(pyObj)) {
|
||||
// a class supported by QVariant?
|
||||
int typeCode;
|
||||
const char* typeName = resolveMetaType(pyObj->ob_type, &typeCode);
|
||||
if (typeCode && typeName) {
|
||||
Shiboken::TypeResolver* tr = Shiboken::TypeResolver::get(typeName);
|
||||
QVariant var(typeCode, (void*)0);
|
||||
void* args[] = { var.data() };
|
||||
tr->toCpp(pyObj, args);
|
||||
return var;
|
||||
}
|
||||
}
|
||||
|
||||
//sequence and dictornay
|
||||
if (PyDict_Check(pyObj)) {
|
||||
QVariant ret = convertToVariantMap(pyObj);
|
||||
if (ret.isValid())
|
||||
return ret;
|
||||
} else if (PySequence_Check(pyObj)) {
|
||||
return convertToVariantList(pyObj);
|
||||
}
|
||||
|
||||
// Is a shiboken type not known by Qt
|
||||
return QVariant::fromValue<PySide::PyObjectWrapper>(pyObj);
|
||||
}
|
||||
|
||||
static PyObject* toPython(void* cppObj)
|
||||
{
|
||||
return toPython(*reinterpret_cast<QVariant*>(cppObj));
|
||||
}
|
||||
|
||||
static PyObject* toPython(const QVariant& cppObj)
|
||||
{
|
||||
if (cppObj.isValid()) {
|
||||
if (qstrcmp(cppObj.typeName(), "QVariantList") == 0)
|
||||
return Converter<QList<QVariant> >::toPython(cppObj.value<QVariantList>());
|
||||
|
||||
if (qstrcmp(cppObj.typeName(), "QStringList") == 0)
|
||||
return Converter<QList<QString> >::toPython(cppObj.value<QStringList>());
|
||||
|
||||
if (qstrcmp(cppObj.typeName(), "QVariantMap") == 0)
|
||||
return Converter<QMap<QString, QVariant> >::toPython(cppObj.value<QVariantMap>());
|
||||
|
||||
Shiboken::TypeResolver* tr = Shiboken::TypeResolver::get(cppObj.typeName());
|
||||
if (tr)
|
||||
return tr->toPython(const_cast<void*>(cppObj.data()));
|
||||
}
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static QVariant convertToValueList(PyObject* list)
|
||||
{
|
||||
if (PySequence_Size(list) < 1)
|
||||
return QVariant();
|
||||
|
||||
Shiboken::AutoDecRef element(PySequence_GetItem(list, 0));
|
||||
int typeId;
|
||||
const char* typeName = resolveMetaType(element.cast<PyTypeObject*>(), &typeId);
|
||||
if (typeName) {
|
||||
QByteArray listTypeName("QList<");
|
||||
listTypeName += typeName;
|
||||
listTypeName += '>';
|
||||
typeId = QMetaType::type(listTypeName);
|
||||
if (typeId > 0) {
|
||||
Shiboken::TypeResolver* tr = Shiboken::TypeResolver::get(listTypeName);
|
||||
if (!tr) {
|
||||
qWarning() << "TypeResolver for :" << listTypeName << "not registered.";
|
||||
} else {
|
||||
QVariant var(typeId, (void*)0);
|
||||
void* args[] = { var.data(), 0 };
|
||||
tr->toCpp(list, args);
|
||||
return var;
|
||||
}
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
static QVariant convertToVariantMap(PyObject* map)
|
||||
{
|
||||
PyObject *key, *value;
|
||||
Py_ssize_t pos = 0;
|
||||
AutoDecRef keys(PyDict_Keys(map));
|
||||
bool keysIsString = isStringList(keys);
|
||||
if (keysIsString) {
|
||||
QMap<QString, QVariant> ret;
|
||||
while (PyDict_Next(map, &pos, &key, &value))
|
||||
ret.insert(Converter<QString>::toCpp(key), toCpp(value));
|
||||
return QVariant(ret);
|
||||
} else {
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
|
||||
static bool isStringList(PyObject *list)
|
||||
{
|
||||
bool allString = true;
|
||||
AutoDecRef fast(PySequence_Fast(list, "Failed to convert QVariantList"));
|
||||
Py_ssize_t size = PySequence_Fast_GET_SIZE(fast.object());
|
||||
for(int i=0; i < size; i++) {
|
||||
PyObject* item = PySequence_Fast_GET_ITEM(fast.object(), i);
|
||||
if (!Converter<QString>::checkType(item)) {
|
||||
allString = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return allString;
|
||||
}
|
||||
|
||||
static QVariant convertToVariantList(PyObject* list)
|
||||
{
|
||||
bool allString = isStringList(list);
|
||||
if (allString) {
|
||||
QStringList lst = Converter<QList<QString> >::toCpp(list);
|
||||
return QVariant(lst);
|
||||
} else {
|
||||
QVariant valueList = convertToValueList(list);
|
||||
if (valueList.isValid())
|
||||
return valueList;
|
||||
QList<QVariant> lst;
|
||||
AutoDecRef fast(PySequence_Fast(list, "Failed to convert QVariantList"));
|
||||
Py_ssize_t size = PySequence_Fast_GET_SIZE(fast.object());
|
||||
for(int i=0; i < size; i++) {
|
||||
PyObject* item = PySequence_Fast_GET_ITEM(fast.object(), i);
|
||||
lst.append(toCpp(item));
|
||||
}
|
||||
return QVariant(lst);
|
||||
}
|
||||
Q_ASSERT(false);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
namespace Shiboken {
|
||||
|
||||
template<>
|
||||
struct Converter<QVariant::Type>
|
||||
{
|
||||
static bool checkType(PyObject* pyObj)
|
||||
{
|
||||
return pyObj == Py_None || PyType_Check(pyObj) || Converter<QString>::checkType(pyObj);
|
||||
}
|
||||
|
||||
static bool isConvertible(PyObject* pyObj)
|
||||
{
|
||||
return checkType(pyObj);
|
||||
}
|
||||
|
||||
static QVariant::Type toCpp(PyObject* pyObj)
|
||||
{
|
||||
const char* typeName = 0;
|
||||
if (pyObj == Py_None)
|
||||
return QVariant::Invalid;
|
||||
|
||||
if (Shiboken::String::checkType(reinterpret_cast<PyTypeObject*>(pyObj)))
|
||||
typeName = "QString";
|
||||
else if (pyObj == reinterpret_cast<PyObject*>(&PyFloat_Type))
|
||||
typeName = "double"; // float is a UserType in QVariant.
|
||||
else if (pyObj == reinterpret_cast<PyObject*>(&PyLong_Type))
|
||||
typeName = "int"; // long is a UserType in QVariant.
|
||||
else if (PyType_Check(pyObj)) {
|
||||
if (pyObj->ob_type == &SbkObjectType_Type)
|
||||
typeName = Shiboken::ObjectType::getOriginalName(reinterpret_cast<SbkObjectType*>(pyObj));
|
||||
else
|
||||
typeName = reinterpret_cast<PyTypeObject*>(pyObj)->tp_name;
|
||||
}
|
||||
else if (Shiboken::String::check(pyObj))
|
||||
typeName = Shiboken::String::toCString(pyObj);
|
||||
else if (PyDict_Check(pyObj) && checkAllStringKeys(pyObj))
|
||||
typeName = "QVariantMap";
|
||||
else if (PySequence_Check(pyObj))
|
||||
if (isStringList(pyObj))
|
||||
typeName = "QStringList";
|
||||
else
|
||||
typeName = "QVariantList";
|
||||
else
|
||||
Q_ASSERT(false);
|
||||
|
||||
return QVariant::nameToType(typeName);
|
||||
}
|
||||
|
||||
static PyObject* toPython(void* cppObj) { return toPython(*reinterpret_cast<QVariant::Type*>(cppObj)); }
|
||||
static PyObject* toPython(const QVariant::Type& cppObj)
|
||||
{
|
||||
const char* typeName = QVariant::typeToName(cppObj);
|
||||
PyObject* pyObj;
|
||||
if (!typeName) {
|
||||
pyObj = Py_None;
|
||||
} else {
|
||||
Shiboken::TypeResolver* tr = Shiboken::TypeResolver::get(typeName);
|
||||
pyObj = tr ? reinterpret_cast<PyObject*>(tr->pythonType()) : Py_None;
|
||||
}
|
||||
Py_INCREF(pyObj);
|
||||
return pyObj;
|
||||
}
|
||||
|
||||
static bool isStringList(PyObject* list)
|
||||
{
|
||||
bool allString = true;
|
||||
AutoDecRef fast(PySequence_Fast(list, "Failed to convert QVariantList"));
|
||||
Py_ssize_t size = PySequence_Fast_GET_SIZE(fast.object());
|
||||
for(int i=0; i < size; i++) {
|
||||
PyObject* item = PySequence_Fast_GET_ITEM(fast.object(), i);
|
||||
if (!Converter<QString>::checkType(item)) {
|
||||
allString = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return allString;
|
||||
}
|
||||
|
||||
static bool checkAllStringKeys(PyObject* dict)
|
||||
{
|
||||
AutoDecRef keys(PyDict_Keys(dict));
|
||||
return isStringList(keys);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
namespace Shiboken {
|
||||
template<typename T>
|
||||
struct Converter<QVector<T> > : StdListConverter<QVector<T> > {};
|
||||
}
|
||||
24
PySide/QtCore/typesystem_core.xml.in
Normal file
24
PySide/QtCore/typesystem_core.xml.in
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
This file is part of PySide project.
|
||||
Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
Contact: PySide team <contact@pyside.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<typesystem package="PySide.QtCore">
|
||||
<load-typesystem name="typesystem_core_@AUTO_OS@.xml" generate="yes"/>
|
||||
<load-typesystem name="typesystem_core_common.xml" generate="yes"/>
|
||||
</typesystem>
|
||||
File diff suppressed because it is too large
Load diff
23
PySide/QtCore/typesystem_core_mac.xml
Normal file
23
PySide/QtCore/typesystem_core_mac.xml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
This file is part of PySide project.
|
||||
Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
Contact: PySide team <contact@pyside.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<typesystem package="PySide.QtCore">
|
||||
<primitive-type name="Qt::HANDLE" target-lang-api-name="PyObject" />
|
||||
</typesystem>
|
||||
26
PySide/QtCore/typesystem_core_maemo.xml
Normal file
26
PySide/QtCore/typesystem_core_maemo.xml
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
This file is part of PySide project.
|
||||
Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
Contact: PySide team <contact@pyside.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<typesystem package="PySide.QtCore">
|
||||
<primitive-type name="Qt::HANDLE" target-lang-api-name="PyLong">
|
||||
<!-- FIXME APIExtractor or shiboken do not support multiple includes by primitive type -->
|
||||
<include file-name="QTextDocument" location="global"/>
|
||||
</primitive-type>
|
||||
</typesystem>
|
||||
|
|
@ -19,9 +19,33 @@
|
|||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<typesystem package="PySide.QtCore">
|
||||
<primitive-type name="Qt::HANDLE" target-lang-api-name="PyObject" />
|
||||
<primitive-type name="HWND">
|
||||
<conversion-rule file="glue/hwnd_conversions.h"/>
|
||||
<conversion-rule>
|
||||
<native-to-target>
|
||||
#ifdef IS_PY3K
|
||||
return PyCapsule_New(%in, 0, 0);
|
||||
#else
|
||||
return PyCObject_FromVoidPtr(%in, 0);
|
||||
#endif
|
||||
</native-to-target>
|
||||
<target-to-native>
|
||||
<add-conversion type="PyNone">
|
||||
%out = 0;
|
||||
</add-conversion>
|
||||
<add-conversion check="checkPyCapsuleOrPyCObject(%in)" type="PyObject">
|
||||
#ifdef IS_PY3K
|
||||
%out = (%OUTTYPE)PyCapsule_GetPointer(%in, 0);
|
||||
#else
|
||||
%out = (%OUTTYPE)PyCObject_AsVoidPtr(%in);
|
||||
#endif
|
||||
</add-conversion>
|
||||
</target-to-native>
|
||||
</conversion-rule>
|
||||
</primitive-type>
|
||||
<inject-code class="native" position="beginning">
|
||||
<insert-template name="checkPyCapsuleOrPyCObject_func"/>
|
||||
</inject-code>
|
||||
<value-type name="POINT">
|
||||
<include file-name="wtypes.h" location="global"/>
|
||||
</value-type>
|
||||
|
|
@ -30,6 +54,4 @@
|
|||
</value-type>
|
||||
<suppress-warning text="class 'MSG' inherits from unknown base class 'tagMSG'"/>
|
||||
<suppress-warning text="class not found for setup inheritance 'tagMSG'"/>
|
||||
<load-typesystem name="typesystem_core.xml" generate="yes"/>
|
||||
</typesystem>
|
||||
|
||||
|
|
|
|||
26
PySide/QtCore/typesystem_core_x11.xml
Normal file
26
PySide/QtCore/typesystem_core_x11.xml
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
This file is part of PySide project.
|
||||
Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
Contact: PySide team <contact@pyside.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<typesystem package="PySide.QtCore">
|
||||
<primitive-type name="Qt::HANDLE" target-lang-api-name="PyLong">
|
||||
<!-- FIXME APIExtractor or shiboken do not support multiple includes by primitive type -->
|
||||
<include file-name="QTextDocument" location="global"/>
|
||||
</primitive-type>
|
||||
</typesystem>
|
||||
|
|
@ -23,7 +23,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtDeclarative/qdeclarativeview_wrapper.cpp
|
|||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtDeclarative/qtdeclarative_module_wrapper.cpp
|
||||
)
|
||||
|
||||
set(QtDeclarative_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtNetwork_SOURCE_DIR}${PATH_SEP}${QtDeclarative_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
set(QtDeclarative_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtCore_BINARY_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtNetwork_SOURCE_DIR}${PATH_SEP}${QtDeclarative_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
|
||||
set(QtDeclarative_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${QT_QTCORE_INCLUDE_DIR}
|
||||
|
|
|
|||
|
|
@ -93,8 +93,8 @@ int PySide::qmlRegisterType(PyObject* pyObj, const char* uri, int versionMajor,
|
|||
{
|
||||
using namespace Shiboken;
|
||||
|
||||
static PyTypeObject* qobjectType = TypeResolver::get("QObject*")->pythonType();
|
||||
static PyTypeObject* qdeclarativeType = TypeResolver::get("QDeclarativeItem*")->pythonType();
|
||||
static PyTypeObject* qobjectType = Shiboken::Conversions::getPythonTypeObject("QObject*");
|
||||
static PyTypeObject* qdeclarativeType = Shiboken::Conversions::getPythonTypeObject("QDeclarativeItem*");
|
||||
assert(qobjectType);
|
||||
static int nextType = 0;
|
||||
|
||||
|
|
@ -113,6 +113,9 @@ int PySide::qmlRegisterType(PyObject* pyObj, const char* uri, int versionMajor,
|
|||
QMetaObject* metaObject = reinterpret_cast<QMetaObject*>(ObjectType::getTypeUserData(reinterpret_cast<SbkObjectType*>(pyObj)));
|
||||
Q_ASSERT(metaObject);
|
||||
|
||||
// Inc ref the type object, don't worry about dec ref them because there's no way to unregister a QML type
|
||||
Py_INCREF(pyObj);
|
||||
|
||||
// All ready... now the ugly code begins... :-)
|
||||
pyTypes[nextType] = pyObj;
|
||||
|
||||
|
|
@ -255,7 +258,10 @@ PyTypeObject PropertyListType = {
|
|||
void propListAppender(QDeclarativeListProperty<QDeclarativeItem>* propList, QDeclarativeItem* item)
|
||||
{
|
||||
Shiboken::GilState state;
|
||||
Shiboken::AutoDecRef args(Shiboken::makeTuple(propList->object, item));
|
||||
|
||||
Shiboken::AutoDecRef args(PyTuple_New(2));
|
||||
PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide_QtCoreTypes[SBK_QOBJECT_IDX], propList->object));
|
||||
PyTuple_SET_ITEM(args, 1, Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide_QtDeclarativeTypes[SBK_QDECLARATIVEITEM_IDX], item));
|
||||
|
||||
DeclarativeListProperty* data = reinterpret_cast<DeclarativeListProperty*>(propList->data);
|
||||
Shiboken::AutoDecRef retVal(PyObject_CallObject(data->append, args));
|
||||
|
|
@ -268,42 +274,50 @@ void propListAppender(QDeclarativeListProperty<QDeclarativeItem>* propList, QDec
|
|||
int propListCount(QDeclarativeListProperty<QDeclarativeItem>* propList)
|
||||
{
|
||||
Shiboken::GilState state;
|
||||
Shiboken::AutoDecRef args(Shiboken::makeTuple(propList->object));
|
||||
|
||||
Shiboken::AutoDecRef args(PyTuple_New(1));
|
||||
PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide_QtCoreTypes[SBK_QOBJECT_IDX], propList->object));
|
||||
|
||||
DeclarativeListProperty* data = reinterpret_cast<DeclarativeListProperty*>(propList->data);
|
||||
Shiboken::AutoDecRef retVal(PyObject_CallObject(data->count, args));
|
||||
|
||||
// Check return type
|
||||
int cppResult = 0;
|
||||
PythonToCppFunc pythonToCpp;
|
||||
if (PyErr_Occurred())
|
||||
PyErr_Print();
|
||||
else if (Shiboken::Converter<int>::isConvertible(retVal))
|
||||
return Shiboken::Converter<int>::toCpp(retVal);
|
||||
|
||||
return 0;
|
||||
else if ((pythonToCpp = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter<int>(), retVal)))
|
||||
pythonToCpp(retVal, &cppResult);
|
||||
return cppResult;
|
||||
}
|
||||
|
||||
// Implementation of QDeclarativeListProperty<T>::AtFunction callback
|
||||
QDeclarativeItem* propListAt(QDeclarativeListProperty<QDeclarativeItem>* propList, int index)
|
||||
{
|
||||
Shiboken::GilState state;
|
||||
Shiboken::AutoDecRef args(Shiboken::makeTuple(propList->object, index));
|
||||
|
||||
Shiboken::AutoDecRef args(PyTuple_New(2));
|
||||
PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide_QtCoreTypes[SBK_QOBJECT_IDX], propList->object));
|
||||
PyTuple_SET_ITEM(args, 1, Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<int>(), &index));
|
||||
|
||||
DeclarativeListProperty* data = reinterpret_cast<DeclarativeListProperty*>(propList->data);
|
||||
Shiboken::AutoDecRef retVal(PyObject_CallObject(data->at, args));
|
||||
|
||||
QDeclarativeItem* result = 0;
|
||||
if (PyErr_Occurred())
|
||||
PyErr_Print();
|
||||
else if (PyType_IsSubtype(Py_TYPE(retVal), data->type))
|
||||
return Shiboken::Converter<QDeclarativeItem*>::toCpp(retVal);
|
||||
|
||||
return 0;
|
||||
Shiboken::Conversions::pythonToCppPointer((SbkObjectType*)SbkPySide_QtCoreTypes[SBK_QDECLARATIVEITEM_IDX], retVal, &result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Implementation of QDeclarativeListProperty<T>::ClearFunction callback
|
||||
void propListClear(QDeclarativeListProperty<QDeclarativeItem>* propList)
|
||||
{
|
||||
Shiboken::GilState state;
|
||||
Shiboken::AutoDecRef args(Shiboken::makeTuple(propList->object));
|
||||
|
||||
Shiboken::AutoDecRef args(PyTuple_New(1));
|
||||
PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide_QtCoreTypes[SBK_QOBJECT_IDX], propList->object));
|
||||
|
||||
DeclarativeListProperty* data = reinterpret_cast<DeclarativeListProperty*>(propList->data);
|
||||
Shiboken::AutoDecRef retVal(PyObject_CallObject(data->clear, args));
|
||||
|
|
@ -319,7 +333,9 @@ static void propListMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::Ca
|
|||
return;
|
||||
|
||||
DeclarativeListProperty* data = reinterpret_cast<DeclarativeListProperty*>(PySide::Property::userData(pp));
|
||||
QDeclarativeListProperty<QDeclarativeItem> declProp(Shiboken::Converter<QObject*>::toCpp(self), data, &propListAppender);
|
||||
QObject* qobj;
|
||||
Shiboken::Conversions::pythonToCppPointer((SbkObjectType*)SbkPySide_QtCoreTypes[SBK_QOBJECT_IDX], self, &qobj);
|
||||
QDeclarativeListProperty<QDeclarativeItem> declProp(qobj, data, &propListAppender);
|
||||
|
||||
if (data->count)
|
||||
declProp.count = &propListCount;
|
||||
|
|
|
|||
|
|
@ -60,8 +60,7 @@
|
|||
</enum-type>
|
||||
|
||||
<inject-code class="target" position="end">
|
||||
Shiboken::TypeResolver::createValueTypeResolver< QList<QObject*> >("QList<QObject*>");
|
||||
PySide::initQmlSupport(module);
|
||||
PySide::initQmlSupport(module);
|
||||
</inject-code>
|
||||
|
||||
<object-type name="QDeclarativeExtensionInterface"/>
|
||||
|
|
@ -104,7 +103,9 @@
|
|||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE ok_ = %CPPSELF.%FUNCTION_NAME(%1, %2, &errorString);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(ok_, errorString);
|
||||
%PYARG_0 = PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](ok_));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QString](errorString));
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
</object-type>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ if(ENABLE_X11)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
if (${QT_VERSION_MAJOR} EQUAL 4 AND ${QT_VERSION_MINOR} LESS 6)
|
||||
set(QtGui_46_SRC "")
|
||||
else()
|
||||
|
|
@ -60,6 +59,14 @@ else()
|
|||
)
|
||||
endif ()
|
||||
|
||||
if (${QT_VERSION_MAJOR} EQUAL 4 AND ${QT_VERSION_MINOR} LESS 7)
|
||||
set(QtGui_47_SRC "")
|
||||
else()
|
||||
set(QtGui_47_SRC
|
||||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qpainter_pixmapfragment_wrapper.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
set(QtGui_OPTIONAL_SRC )
|
||||
set(QtGui_DROPPED_ENTRIES )
|
||||
check_qt_class(QtGui QAbstractPageSetupDialog QtGui_OPTIONAL_SRC QtGui_DROPPED_ENTRIES)
|
||||
|
|
@ -398,13 +405,15 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qworkspace_wrapper.cpp
|
|||
${SPECIFIC_OS_FILES}
|
||||
${QPYTEXTOBJECT_MOC}
|
||||
${QtGui_46_SRC}
|
||||
${QtGui_47_SRC}
|
||||
${QtGui_OPTIONAL_SRC}
|
||||
)
|
||||
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/typesystem_gui.xml.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/typesystem_gui.xml" @ONLY)
|
||||
|
||||
set(QtGui_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}")
|
||||
set(QtGui_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtCore_BINARY_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}")
|
||||
|
||||
set(QtGui_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/
|
||||
${pyside_SOURCE_DIR}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
#ifndef QLAYOUT_HELP_FUNCTIONS
|
||||
#define QLAYOUT_HELP_FUNCTIONS
|
||||
|
||||
void addLayoutOwnership(QLayout* layout, QLayoutItem* item);
|
||||
void removeLayoutOwnership(QLayout* layout, QWidget* widget);
|
||||
|
||||
|
|
@ -16,21 +13,20 @@ inline void addLayoutOwnership(QLayout* layout, QWidget* widget)
|
|||
QWidget *lw = layout->parentWidget();
|
||||
QWidget *pw = widget->parentWidget();
|
||||
|
||||
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QWidget*>::toPython(widget));
|
||||
Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget*](widget));
|
||||
|
||||
//Transfer parent to layout widget
|
||||
//Transfer parent to layout widget
|
||||
if (pw && lw && pw != lw)
|
||||
Shiboken::Object::setParent(0, pyChild);
|
||||
|
||||
if (!lw && !pw) {
|
||||
//keep the reference while the layout is orphan
|
||||
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(layout));
|
||||
Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](layout));
|
||||
Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true);
|
||||
} else {
|
||||
if (!lw)
|
||||
lw = pw;
|
||||
|
||||
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(lw));
|
||||
Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](lw));
|
||||
Shiboken::Object::setParent(pyParent, pyChild);
|
||||
}
|
||||
}
|
||||
|
|
@ -41,8 +37,8 @@ inline void addLayoutOwnership(QLayout* layout, QLayout* other)
|
|||
QWidget* parent = layout->parentWidget();
|
||||
if (!parent) {
|
||||
//keep the reference while the layout is orphan
|
||||
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QLayout*>::toPython(layout));
|
||||
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayout*>::toPython(other));
|
||||
Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QLayout*](layout));
|
||||
Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayout*](other));
|
||||
Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true);
|
||||
return;
|
||||
}
|
||||
|
|
@ -51,18 +47,19 @@ inline void addLayoutOwnership(QLayout* layout, QLayout* other)
|
|||
QLayoutItem* item = other->itemAt(i);
|
||||
if (PyErr_Occurred() || !item)
|
||||
return;
|
||||
|
||||
addLayoutOwnership(layout, item);
|
||||
}
|
||||
|
||||
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QLayout*>::toPython(layout));
|
||||
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayout*>::toPython(other));
|
||||
Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QLayout*](layout));
|
||||
Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayout*](other));
|
||||
Shiboken::Object::setParent(pyParent, pyChild);
|
||||
|
||||
}
|
||||
|
||||
inline void addLayoutOwnership(QLayout* layout, QLayoutItem* item)
|
||||
{
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
QWidget* w = item->widget();
|
||||
if (w)
|
||||
addLayoutOwnership(layout, w);
|
||||
|
|
@ -72,8 +69,8 @@ inline void addLayoutOwnership(QLayout* layout, QLayoutItem* item)
|
|||
addLayoutOwnership(layout, l);
|
||||
}
|
||||
|
||||
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QLayout*>::toPython(layout));
|
||||
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayoutItem*>::toPython(item));
|
||||
Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QLayout*](layout));
|
||||
Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayoutItem*](item));
|
||||
Shiboken::Object::setParent(pyParent, pyChild);
|
||||
}
|
||||
|
||||
|
|
@ -83,13 +80,13 @@ static void removeWidgetFromLayout(QLayout* layout, QWidget* widget)
|
|||
|
||||
if (!parent) {
|
||||
//remove reference on layout
|
||||
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(layout));
|
||||
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QWidget*>::toPython(widget));
|
||||
Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](layout));
|
||||
Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget*](widget));
|
||||
Shiboken::Object::removeReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild);
|
||||
} else {
|
||||
//give the ownership to parent
|
||||
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(parent));
|
||||
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QWidget*>::toPython(widget));
|
||||
Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](parent));
|
||||
Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget*](widget));
|
||||
Shiboken::Object::setParent(pyParent, pyChild);
|
||||
}
|
||||
}
|
||||
|
|
@ -105,7 +102,7 @@ inline void removeLayoutOwnership(QLayout* layout, QLayoutItem* item)
|
|||
removeLayoutOwnership(layout, l);
|
||||
}
|
||||
|
||||
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayoutItem*>::toPython(item));
|
||||
Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayoutItem*](item));
|
||||
Shiboken::Object::invalidate(pyChild);
|
||||
Shiboken::Object::setParent(0, pyChild);
|
||||
}
|
||||
|
|
@ -123,5 +120,3 @@ inline void removeLayoutOwnership(QLayout* layout, QWidget* widget)
|
|||
removeLayoutOwnership(layout, item);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
inline PyObject* addActionWithPyObject(QMenu* self, const QIcon& icon, const QString& text, PyObject* callback, const QKeySequence& shortcut)
|
||||
{
|
||||
QAction* act = new QAction(text, self);
|
||||
|
|
@ -11,7 +10,7 @@ inline PyObject* addActionWithPyObject(QMenu* self, const QIcon& icon, const QSt
|
|||
|
||||
self->addAction(act);
|
||||
|
||||
PyObject* pyAct = Shiboken::Converter<QAction*>::toPython(act);
|
||||
PyObject* pyAct = %CONVERTTOPYTHON[QAction*](act);
|
||||
Shiboken::AutoDecRef result(PyObject_CallMethod(pyAct, "connect", "OsO", pyAct, SIGNAL(triggered()), callback));
|
||||
if (result.isNull()) {
|
||||
Py_DECREF(pyAct);
|
||||
|
|
@ -5,7 +5,7 @@ addActionWithPyObject(QMenuBar* self, const QString& text, PyObject* callback)
|
|||
|
||||
self->addAction(act);
|
||||
|
||||
PyObject* pyAct = Shiboken::Converter<QAction*>::toPython(act);
|
||||
PyObject* pyAct = %CONVERTTOPYTHON[QAction*](act);
|
||||
PyObject* result = PyObject_CallMethod(pyAct, "connect", "OsO", pyAct,
|
||||
SIGNAL(triggered(bool)), callback);
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
// Init qApp macro to None.
|
||||
if (qApp) {
|
||||
PyObject* pyApp = Shiboken::Converter<QApplication*>::toPython(qApp);
|
||||
PyObject* pyApp = %CONVERTTOPYTHON[QApplication*](qApp);
|
||||
Py_INCREF(pyApp);
|
||||
PyModule_AddObject(module, "qApp", pyApp);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ static QString retrieveObjectName(PyObject *obj)
|
|||
**/
|
||||
static inline void qwidgetReparentLayout(QWidget *parent, QLayout *layout)
|
||||
{
|
||||
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(parent));
|
||||
Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](parent));
|
||||
|
||||
for (int i=0; i < layout->count(); i++) {
|
||||
QLayoutItem* item = layout->itemAt(i);
|
||||
|
|
@ -21,7 +21,7 @@ static inline void qwidgetReparentLayout(QWidget *parent, QLayout *layout)
|
|||
if (w) {
|
||||
QWidget* pw = w->parentWidget();
|
||||
if (pw != parent) {
|
||||
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QWidget*>::toPython(w));
|
||||
Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget*](w));
|
||||
Shiboken::Object::setParent(pyParent, pyChild);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -31,7 +31,7 @@ static inline void qwidgetReparentLayout(QWidget *parent, QLayout *layout)
|
|||
}
|
||||
}
|
||||
|
||||
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayout*>::toPython(layout));
|
||||
Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayout*](layout));
|
||||
Shiboken::Object::setParent(pyParent, pyChild);
|
||||
//remove previous references
|
||||
Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(pyChild.object()), qPrintable(retrieveObjectName(pyChild)), Py_None);
|
||||
|
|
@ -46,7 +46,7 @@ static inline void qwidgetSetLayout(QWidget *self, QLayout *layout)
|
|||
if (oldParent && oldParent != self) {
|
||||
if (oldParent->isWidgetType()) {
|
||||
// remove old parent policy
|
||||
Shiboken::AutoDecRef pyLayout(Shiboken::Converter<QLayout*>::toPython(layout));
|
||||
Shiboken::AutoDecRef pyLayout(%CONVERTTOPYTHON[QLayout*](layout));
|
||||
Shiboken::Object::setParent(Py_None, pyLayout);
|
||||
} else {
|
||||
PyErr_Format(PyExc_RuntimeError, "QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", when the QLayout already has a parent",
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
#ifndef Q_WS_WIN
|
||||
namespace Shiboken {
|
||||
template <>
|
||||
struct Converter<WId>
|
||||
{
|
||||
static bool checkType(PyObject* pyObj)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool isConvertible(PyObject* pyobj)
|
||||
{
|
||||
return PyCObject_Check(pyobj);
|
||||
}
|
||||
|
||||
static inline PyObject* toPython(void* cppobj)
|
||||
{
|
||||
// not supported
|
||||
Q_ASSERT(true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject* toPython(WId cppobj)
|
||||
{
|
||||
return PyCObject_FromVoidPtr(cppobj, 0);
|
||||
}
|
||||
|
||||
static WId toCpp(PyObject* pyobj)
|
||||
{
|
||||
return (WId) PyCObject_AsVoidPtr(pyobj);
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
namespace Shiboken {
|
||||
inline bool Converter<QPixmap>::checkType(PyObject* pyObj)
|
||||
{
|
||||
return ValueTypeConverter<QPixmap>::checkType(pyObj);
|
||||
}
|
||||
|
||||
inline bool Converter<QPixmap>::isConvertible(PyObject* pyobj)
|
||||
{
|
||||
if (ValueTypeConverter<QPixmap>::isConvertible(pyobj))
|
||||
return true;
|
||||
SbkObjectType* shiboType = reinterpret_cast<SbkObjectType*>(SbkType<QPixmap>());
|
||||
bool isVariant = Shiboken::Converter<QVariant>::checkType(pyobj);
|
||||
if (isVariant) {
|
||||
QVariant var(Shiboken::Converter<QVariant>::toCpp(pyobj));
|
||||
return var.type() == QVariant::Pixmap;
|
||||
} else if (Shiboken::Converter<QSize>::checkType(pyobj) || Shiboken::Converter<QString>::checkType(pyobj)) {
|
||||
return true;
|
||||
} else {
|
||||
return Shiboken::ObjectType::isExternalConvertible(shiboType, pyobj);
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
inline QPixmap Converter<QPixmap>::toCpp(PyObject* pyobj)
|
||||
{
|
||||
SbkObjectType* shiboType = reinterpret_cast<SbkObjectType*>(SbkType<QPixmap>());
|
||||
bool isVariant = Converter<QVariant>::checkType(pyobj);
|
||||
if (isVariant) {
|
||||
QVariant var(Converter<QVariant>::toCpp(pyobj));
|
||||
return var.value<QPixmap>();
|
||||
} else if (Converter<QSize>::checkType(pyobj)) {
|
||||
return QPixmap(Shiboken::Converter<QSize >::toCpp(pyobj));
|
||||
} else if (Converter<QString>::checkType(pyobj)) {
|
||||
return QPixmap(Shiboken::Converter<QString >::toCpp(pyobj));
|
||||
} else if (Shiboken::ObjectType::isExternalConvertible(shiboType, pyobj) && Shiboken::ObjectType::hasExternalCppConversions(shiboType)) {
|
||||
QPixmap* cptr = reinterpret_cast<QPixmap*>(Shiboken::ObjectType::callExternalCppConversion(shiboType, pyobj));
|
||||
std::auto_ptr<QPixmap> cptr_auto_ptr(cptr);
|
||||
return *cptr;
|
||||
}
|
||||
|
||||
return *Converter<QPixmap*>::toCpp(pyobj);
|
||||
}
|
||||
|
||||
inline PyObject* Converter<QPixmap>::toPython(const QPixmap& cppObj)
|
||||
{
|
||||
return ValueTypeConverter<QPixmap>::toPython(cppObj);
|
||||
}
|
||||
}
|
||||
|
|
@ -225,7 +225,7 @@
|
|||
<insert-template name="fix_bool*"/>
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
<add-function signature="quadToQuad(const QPolygonF&, const QPolygonF&)" return-type="PyObject*" static="true">
|
||||
<add-function signature="quadToQuad(QPolygonF&, QPolygonF&)" return-type="PyObject*" static="true">
|
||||
<inject-code>
|
||||
QTransform _result;
|
||||
if (QTransform::quadToQuad(%1, %2, _result)) {
|
||||
|
|
@ -236,7 +236,7 @@
|
|||
}
|
||||
</inject-code>
|
||||
</add-function>
|
||||
<add-function signature="quadToSquare(const QPolygonF &)" return-type="PyObject*" static="true">
|
||||
<add-function signature="quadToSquare(QPolygonF &)" return-type="PyObject*" static="true">
|
||||
<inject-code>
|
||||
QTransform _result;
|
||||
if (QTransform::quadToSquare(%1, _result)) {
|
||||
|
|
@ -248,7 +248,7 @@
|
|||
</inject-code>
|
||||
</add-function>
|
||||
|
||||
<add-function signature="squareToQuad(const QPolygonF &)" return-type="PyObject*" static="true">
|
||||
<add-function signature="squareToQuad(QPolygonF &)" return-type="PyObject*" static="true">
|
||||
<inject-code>
|
||||
QTransform _result;
|
||||
if (QTransform::squareToQuad(%1, _result)) {
|
||||
|
|
@ -396,22 +396,22 @@
|
|||
<enum-type name="StyleOptionVersion"/>
|
||||
<enum-type name="ToolButtonFeature" flags="ToolButtonFeatures" />
|
||||
</object-type>
|
||||
<object-type name="QStyleOptionViewItem" polymorphic-id-expression="%1->type == QStyleOptionViewItem::Type && %1->version == QStyleOptionViewItem::Version">
|
||||
<value-type name="QStyleOptionViewItem" polymorphic-id-expression="%1->type == QStyleOptionViewItem::Type && %1->version == QStyleOptionViewItem::Version">
|
||||
<enum-type name="Position"/>
|
||||
<enum-type name="StyleOptionType"/>
|
||||
<enum-type name="StyleOptionVersion"/>
|
||||
</object-type>
|
||||
<object-type name="QStyleOptionViewItemV2" polymorphic-id-expression="%1->type == QStyleOptionViewItemV2::Type && %1->version == QStyleOptionViewItemV2::Version">
|
||||
</value-type>
|
||||
<value-type name="QStyleOptionViewItemV2" polymorphic-id-expression="%1->type == QStyleOptionViewItemV2::Type && %1->version == QStyleOptionViewItemV2::Version">
|
||||
<enum-type name="StyleOptionVersion"/>
|
||||
<enum-type name="ViewItemFeature" flags="ViewItemFeatures"/>
|
||||
</object-type>
|
||||
<object-type name="QStyleOptionViewItemV3" polymorphic-id-expression="%1->type == QStyleOptionViewItemV3::Type && %1->version == QStyleOptionViewItemV3::Version">
|
||||
</value-type>
|
||||
<value-type name="QStyleOptionViewItemV3" polymorphic-id-expression="%1->type == QStyleOptionViewItemV3::Type && %1->version == QStyleOptionViewItemV3::Version">
|
||||
<enum-type name="StyleOptionVersion"/>
|
||||
</object-type>
|
||||
<object-type name="QStyleOptionViewItemV4" polymorphic-id-expression="%1->type == QStyleOptionViewItemV4::Type && %1->version == QStyleOptionViewItemV4::Version" >
|
||||
</value-type>
|
||||
<value-type name="QStyleOptionViewItemV4" polymorphic-id-expression="%1->type == QStyleOptionViewItemV4::Type && %1->version == QStyleOptionViewItemV4::Version" >
|
||||
<enum-type name="StyleOptionVersion"/>
|
||||
<enum-type name="ViewItemPosition"/>
|
||||
</object-type>
|
||||
</value-type>
|
||||
<value-type name="QTextFragment" />
|
||||
<value-type name="QBitmap" >
|
||||
<modify-function signature="fromData(QSize,const uchar*,QImage::Format)">
|
||||
|
|
@ -448,10 +448,12 @@
|
|||
<replace-type modified-type="PyObject" />
|
||||
</modify-argument>
|
||||
<inject-code class="target" position="beginning">
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE %0 = %CPPSELF->::%TYPE::%FUNCTION_NAME(&%1, %2);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(%0, %1);
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE %0 = %CPPSELF->::%TYPE::%FUNCTION_NAME(&%1, %2);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](%0));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG1_TYPE](%1));
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
<modify-function signature="xToCursor(qreal,QTextLine::CursorPosition)const">
|
||||
|
|
@ -688,7 +690,7 @@
|
|||
<!-- ### "QPolygon(int, const int*)" is an internal constructor. -->
|
||||
<modify-function signature="QPolygon(int, const int *)" remove="all"/>
|
||||
<!-- ### A QVector parameter, for no defined type, will generate wrong code. -->
|
||||
<modify-function signature="operator+=(QVector)" remove="all"/>
|
||||
<modify-function signature="operator+=(QVector<QPoint>)" remove="all"/>
|
||||
<modify-function signature="operator<<(QPoint)">
|
||||
<inject-code>
|
||||
// %FUNCTION_NAME()
|
||||
|
|
@ -711,7 +713,7 @@
|
|||
<include file-name="QTransform" location="global"/>
|
||||
</extra-includes>
|
||||
<!-- ### A QVector parameter, for no defined type, will generate wrong code. -->
|
||||
<modify-function signature="operator+=(QVector)" remove="all"/>
|
||||
<modify-function signature="operator+=(QVector<QPointF>)" remove="all"/>
|
||||
<!-- ### See bug 776 -->
|
||||
<modify-function signature="operator<<(QPointF)" remove="all"/>
|
||||
<!-- ### See bug 777 -->
|
||||
|
|
@ -796,7 +798,14 @@
|
|||
free(xpm);
|
||||
</template>
|
||||
<value-type name="QPixmap" >
|
||||
<conversion-rule file="qpixmap_conversion.h" />
|
||||
<!--<conversion-rule>-->
|
||||
<!--<target-to-native replace="no">-->
|
||||
<!--<add-conversion type="QVariant" check="%CHECKTYPE[QVariant](%in)">-->
|
||||
<!--QVariant in = %CONVERTTOCPP[QVariant](%in);-->
|
||||
<!--%out = in.value<%OUTTYPE>();-->
|
||||
<!--</add-conversion>-->
|
||||
<!--</target-to-native>-->
|
||||
<!--</conversion-rule>-->
|
||||
<add-function signature="QPixmap(const QImage&)">
|
||||
<modify-argument index="1">
|
||||
<rename to="image"/>
|
||||
|
|
@ -911,9 +920,11 @@
|
|||
</inject-code>
|
||||
</add-function>
|
||||
<template name="qmatrix_map">
|
||||
%ARG1_TYPE a, b;
|
||||
%CPPSELF.%FUNCTION_NAME(%1, %2, &a, &b);
|
||||
%PYARG_0 = Shiboken::makeTuple(a, b);
|
||||
%ARG1_TYPE a, b;
|
||||
%CPPSELF.%FUNCTION_NAME(%1, %2, &a, &b);
|
||||
%PYARG_0 = PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%ARG1_TYPE](a));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG1_TYPE](b));
|
||||
</template>
|
||||
<modify-function signature="map(int,int,int*,int*)const">
|
||||
<modify-argument index="3">
|
||||
|
|
@ -1008,14 +1019,14 @@
|
|||
</inject-code>
|
||||
</modify-function>
|
||||
|
||||
<add-function signature="QImage(QString,int,int,int,QImage::Format)">
|
||||
<add-function signature="QImage(QString&,int,int,int,QImage::Format)">
|
||||
<inject-code>
|
||||
<insert-template name="qimage_buffer_constructor">
|
||||
<replace from="%ARGS" to="%2, %3, %4, %5" />
|
||||
</insert-template>
|
||||
</inject-code>
|
||||
</add-function>
|
||||
<add-function signature="QImage(QString,int,int,QImage::Format)">
|
||||
<add-function signature="QImage(QString&,int,int,QImage::Format)">
|
||||
<inject-code>
|
||||
<insert-template name="qimage_buffer_constructor">
|
||||
<replace from="%ARGS" to="%2, %3, %4" />
|
||||
|
|
@ -1068,11 +1079,17 @@
|
|||
<inject-code>
|
||||
%PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(%1), %CPPSELF.bytesPerLine());
|
||||
</inject-code>
|
||||
<modify-argument index="return">
|
||||
<replace-type modified-type="PyObject" />
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="scanLine(int)">
|
||||
<inject-code>
|
||||
%PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(%1), %CPPSELF.bytesPerLine(), Shiboken::Buffer::ReadWrite);
|
||||
</inject-code>
|
||||
<modify-argument index="return">
|
||||
<replace-type modified-type="PyObject" />
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<!--
|
||||
Only the non-const version of bits() and scanLine() is exported to Python
|
||||
|
|
@ -1290,7 +1307,9 @@
|
|||
</modify-argument>
|
||||
|
||||
<inject-code class="target" position="beginning">
|
||||
<insert-template name="fix_int*,int*,int*,int*,int*"/>
|
||||
<insert-template name="fix_number*,number*,number*,number*,number*">
|
||||
<replace from="$TYPE" to="int" />
|
||||
</insert-template>
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
<modify-function signature="getCmykF(qreal*,qreal*,qreal*,qreal*,qreal*)">
|
||||
|
|
@ -1315,7 +1334,9 @@
|
|||
</modify-argument>
|
||||
|
||||
<inject-code class="target" position="beginning">
|
||||
<insert-template name="fix_qreal*,qreal*,qreal*,qreal*,qreal*"/>
|
||||
<insert-template name="fix_number*,number*,number*,number*,number*">
|
||||
<replace from="$TYPE" to="qreal" />
|
||||
</insert-template>
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
<modify-function signature="getHsl(int*,int*,int*,int*)const" since="4.6">
|
||||
|
|
@ -1769,11 +1790,25 @@
|
|||
<replace-type modified-type="(retval, blockingPanel)"/>
|
||||
</modify-argument>
|
||||
<inject-code class="target" position="beginning">
|
||||
QGraphicsItem *item_ = NULL;
|
||||
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&item_);
|
||||
%PYARG_0 = Shiboken::makeTuple(retval_, item_);
|
||||
QGraphicsItem *item_ = NULL;
|
||||
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&item_);
|
||||
%PYARG_0 = PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QGraphicsItem*](item_));
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
<modify-function signature="itemTransform(const QGraphicsItem*,bool*)const">
|
||||
<modify-argument index="2">
|
||||
<remove-argument />
|
||||
<remove-default-expression />
|
||||
</modify-argument>
|
||||
<modify-argument index="return">
|
||||
<replace-type modified-type="(QTransform, bool ok)"/>
|
||||
</modify-argument>
|
||||
<inject-code class="target" position="beginning">
|
||||
<insert-template name="fix_args,bool*" />
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
<modify-function signature="isObscuredBy(const QGraphicsItem*)const">
|
||||
<modify-argument index="1" invalidate-after-use="yes"/>
|
||||
</modify-function>
|
||||
|
|
@ -2065,6 +2100,17 @@
|
|||
<insert-template name="fix_bool*,arg,arg,arg"/>
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
<modify-function signature="getFont(bool*,QFont,QWidget*,QString,QFlags<QFontDialog::FontDialogOption>)">
|
||||
<modify-argument index="1">
|
||||
<remove-argument />
|
||||
</modify-argument>
|
||||
<modify-argument index="return">
|
||||
<replace-type modified-type="PyTuple" />
|
||||
</modify-argument>
|
||||
<inject-code class="target" position="beginning">
|
||||
<insert-template name="fix_bool*,arg,arg,arg,arg"/>
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
</object-type>
|
||||
<object-type name="QGraphicsEllipseItem">
|
||||
</object-type>
|
||||
|
|
@ -2187,7 +2233,6 @@
|
|||
<object-type name="QItemSelectionModel">
|
||||
<enum-type name="SelectionFlag" flags="SelectionFlags"/>
|
||||
</object-type>
|
||||
<primitive-type name="QModelIndexList"/>
|
||||
<object-type name="QListView">
|
||||
<enum-type name="Flow"/>
|
||||
<enum-type name="LayoutMode"/>
|
||||
|
|
@ -2319,9 +2364,7 @@
|
|||
</modify-function>
|
||||
</object-type>
|
||||
<object-type name="QMenu">
|
||||
<extra-includes>
|
||||
<include file-name="glue/qmenu_glue.h" location="local"/>
|
||||
</extra-includes>
|
||||
<inject-code class="native" position="beginning" file="glue/qmenu_glue.cpp"/>
|
||||
|
||||
<modify-function signature="exec()" rename="exec_" allow-thread="yes" />
|
||||
<modify-function signature="exec(const QPoint&, QAction*)" rename="exec_" allow-thread="yes" />
|
||||
|
|
@ -2371,7 +2414,7 @@
|
|||
<!-- ### "setNoReplayFor(QWidget*)" is an internal method. -->
|
||||
<modify-function signature="setNoReplayFor(QWidget*)" remove="all" />
|
||||
|
||||
<add-function signature="addAction(const QString&, PyObject*, const QKeySequence&)">
|
||||
<add-function signature="addAction(QString&, PyObject*, QKeySequence&)">
|
||||
<modify-argument index="3">
|
||||
<replace-default-expression with="0" />
|
||||
</modify-argument>
|
||||
|
|
@ -2384,7 +2427,7 @@
|
|||
</inject-code>
|
||||
</add-function>
|
||||
|
||||
<add-function signature="addAction(const QIcon&, const QString&, PyObject*, const QKeySequence&)">
|
||||
<add-function signature="addAction(QIcon&, QString&, PyObject*, QKeySequence&)">
|
||||
<modify-argument index="4">
|
||||
<replace-default-expression with="0" />
|
||||
</modify-argument>
|
||||
|
|
@ -2415,9 +2458,7 @@
|
|||
</object-type>
|
||||
|
||||
<object-type name="QMenuBar">
|
||||
<extra-includes>
|
||||
<include file-name="glue/qmenubar_glue.h" location="local"/>
|
||||
</extra-includes>
|
||||
<inject-code class="native" position="beginning" file="glue/qmenubar_glue.cpp"/>
|
||||
<modify-function signature="addAction(const QString&)">
|
||||
<modify-argument index="return">
|
||||
<parent index="this" action="add"/>
|
||||
|
|
@ -2487,7 +2528,7 @@
|
|||
</object-type>
|
||||
<object-type name="QPixmapCache">
|
||||
<value-type name="Key"/>
|
||||
<add-function signature="find(QPixmapCache::Key)">
|
||||
<add-function signature="find(QPixmapCache::Key&)">
|
||||
<inject-code>
|
||||
QPixmap p;
|
||||
if (%CPPSELF.%FUNCTION_NAME(%1, &p)) {
|
||||
|
|
@ -2522,7 +2563,7 @@
|
|||
</object-type>
|
||||
|
||||
<object-type name="QShortcut">
|
||||
<add-function signature="QShortcut(const QKeySequence&, QWidget*, PyCallable*, Qt::ShortcutContext)">
|
||||
<add-function signature="QShortcut(QKeySequence&, QWidget*, PyCallable*, Qt::ShortcutContext)">
|
||||
<modify-argument index="4">
|
||||
<replace-default-expression with="Qt::WindowShortcut"/>
|
||||
</modify-argument>
|
||||
|
|
@ -2685,6 +2726,11 @@
|
|||
<parent index="this" action="add"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="document() const">
|
||||
<modify-argument index="this">
|
||||
<parent index="return" action="add"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
</object-type>
|
||||
<object-type name="QTableView">
|
||||
<modify-function signature="setHorizontalHeader(QHeaderView*)">
|
||||
|
|
@ -3093,10 +3139,7 @@
|
|||
<modify-function signature="getColor(const QColor&, QWidget*, const QString&, QFlags<QColorDialog::ColorDialogOption>)" allow-thread="yes" />
|
||||
</object-type>
|
||||
<object-type name="QLayout">
|
||||
|
||||
<extra-includes>
|
||||
<include file-name="glue/qlayout_help_functions.h" location="local"/>
|
||||
</extra-includes>
|
||||
<inject-code class="native" position="beginning" file="glue/qlayout_help_functions.cpp"/>
|
||||
|
||||
<enum-type name="SizeConstraint"/>
|
||||
|
||||
|
|
@ -3196,9 +3239,7 @@
|
|||
</object-type>
|
||||
|
||||
<object-type name="QStackedLayout">
|
||||
<extra-includes>
|
||||
<include file-name="glue/qlayout_help_functions.h" location="local"/>
|
||||
</extra-includes>
|
||||
<inject-code class="native" position="beginning" file="glue/qlayout_help_functions.cpp"/>
|
||||
<enum-type name="StackingMode"/>
|
||||
<modify-function signature="insertWidget(int,QWidget*)">
|
||||
<inject-code class="target" position="beginning">
|
||||
|
|
@ -3208,9 +3249,7 @@
|
|||
</object-type>
|
||||
|
||||
<object-type name="QBoxLayout">
|
||||
<extra-includes>
|
||||
<include file-name="glue/qlayout_help_functions.h" location="local"/>
|
||||
</extra-includes>
|
||||
<inject-code class="native" position="beginning" file="glue/qlayout_help_functions.cpp"/>
|
||||
|
||||
<enum-type name="Direction" />
|
||||
|
||||
|
|
@ -3254,9 +3293,7 @@
|
|||
</object-type>
|
||||
|
||||
<object-type name="QGridLayout">
|
||||
<extra-includes>
|
||||
<include file-name="glue/qlayout_help_functions.h" location="local"/>
|
||||
</extra-includes>
|
||||
<inject-code class="native" position="beginning" file="glue/qlayout_help_functions.cpp"/>
|
||||
<modify-function signature="itemAtPosition (int, int) const">
|
||||
<modify-argument index="return">
|
||||
<define-ownership owner="default"/>
|
||||
|
|
@ -3329,9 +3366,13 @@
|
|||
<remove-default-expression/>
|
||||
</modify-argument>
|
||||
<inject-code class="target" position="beginning">
|
||||
int a, b, c, d;
|
||||
%CPPSELF.%FUNCTION_NAME(%1, &a, &b, &c, &d);
|
||||
%PYARG_0 = Shiboken::makeTuple(a, b, c, d);
|
||||
int a, b, c, d;
|
||||
%CPPSELF.%FUNCTION_NAME(%1, &a, &b, &c, &d);
|
||||
%PYARG_0 = PyTuple_New(4);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[int](a));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[int](b));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[int](c));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 3, %CONVERTTOPYTHON[int](d));
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
</object-type>
|
||||
|
|
@ -3410,9 +3451,10 @@
|
|||
<conversion-rule class="target">
|
||||
Shiboken::AutoDecRef option_object(PyList_New(0));
|
||||
for (int i=0, max=numItems; i < max; i++) {
|
||||
PyList_Append(option_object, %CONVERTTOPYTHON[QStyleOptionGraphicsItem](%in[i]));
|
||||
const QStyleOptionGraphicsItem* item = &%in[i];
|
||||
PyList_Append(option_object, %CONVERTTOPYTHON[QStyleOptionGraphicsItem](item));
|
||||
}
|
||||
PyObject *%out = option_object.object();
|
||||
PyObject* %out = option_object.object();
|
||||
</conversion-rule>
|
||||
|
||||
<conversion-rule class="native">
|
||||
|
|
@ -3428,7 +3470,7 @@
|
|||
<object-type name="QInputDialog">
|
||||
<enum-type name="InputDialogOption"/>
|
||||
<enum-type name="InputMode"/>
|
||||
<modify-function signature="getInteger(QWidget *, const QString &, const QString &, int, int, int, int, bool *, QFlags<Qt::WindowType>)" allow-thread="yes">
|
||||
<modify-function signature="getInteger(QWidget*, const QString&, const QString&, int, int, int, int, bool*, QFlags<Qt::WindowType>)" allow-thread="yes">
|
||||
<modify-argument index="8">
|
||||
<remove-default-expression/>
|
||||
<remove-argument/>
|
||||
|
|
@ -3437,7 +3479,7 @@
|
|||
<insert-template name="fix_arg,arg,arg,arg,arg,arg,arg,bool*,arg"/>
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
<modify-function signature="getInt(QWidget *, const QString &, const QString &, int, int, int, int, bool *, QFlags<Qt::WindowType>)" allow-thread="yes">
|
||||
<modify-function signature="getInt(QWidget*, const QString&, const QString&, int, int, int, int, bool*, QFlags<Qt::WindowType>)" allow-thread="yes">
|
||||
<modify-argument index="8">
|
||||
<remove-default-expression/>
|
||||
<remove-argument/>
|
||||
|
|
@ -3446,7 +3488,7 @@
|
|||
<insert-template name="fix_arg,arg,arg,arg,arg,arg,arg,bool*,arg"/>
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
<modify-function signature="getItem(QWidget *, const QString &, const QString &, const QStringList &, int, bool, bool *, QFlags<Qt::WindowType>)" allow-thread="yes">
|
||||
<modify-function signature="getItem(QWidget*, const QString&, const QString&, const QStringList&, int, bool, bool*, QFlags<Qt::WindowType>)" allow-thread="yes">
|
||||
<modify-argument index="7">
|
||||
<remove-default-expression/>
|
||||
<remove-argument/>
|
||||
|
|
@ -3455,7 +3497,7 @@
|
|||
<insert-template name="fix_arg,arg,arg,arg,arg,arg,bool*,arg"/>
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
<modify-function signature="getText(QWidget *, const QString &, const QString &, QLineEdit::EchoMode, const QString &, bool *, QFlags<Qt::WindowType>)" allow-thread="yes">
|
||||
<modify-function signature="getText(QWidget *, const QString&, const QString&, QLineEdit::EchoMode, const QString&, bool*, QFlags<Qt::WindowType>)" allow-thread="yes">
|
||||
<modify-argument index="6">
|
||||
<remove-default-expression/>
|
||||
<remove-argument/>
|
||||
|
|
@ -3464,7 +3506,7 @@
|
|||
<insert-template name="fix_arg,arg,arg,arg,arg,bool*,arg"/>
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
<modify-function signature="getDouble(QWidget *, const QString &, const QString &, double, double, double, int, bool *, QFlags<Qt::WindowType>)" allow-thread="yes">
|
||||
<modify-function signature="getDouble(QWidget*, const QString&, const QString&, double, double, double, int, bool*, QFlags<Qt::WindowType>)" allow-thread="yes">
|
||||
<modify-argument index="8">
|
||||
<remove-default-expression/>
|
||||
<remove-argument/>
|
||||
|
|
@ -3562,24 +3604,24 @@
|
|||
<modify-function signature="wheelEvent(QGraphicsSceneWheelEvent*)">
|
||||
<modify-argument index="1" invalidate-after-use="yes"/>
|
||||
</modify-function>
|
||||
<modify-function signature="addItem(QGraphicsItem *)">
|
||||
<modify-function signature="addItem(QGraphicsItem*)">
|
||||
<modify-argument index="1">
|
||||
<parent index="this" action="add" />
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
|
||||
<modify-function signature="addEllipse(const QRectF &, const QPen &, const QBrush &)">
|
||||
<modify-function signature="addEllipse(const QRectF&, const QPen&, const QBrush&)">
|
||||
<modify-argument index="return">
|
||||
<parent index="this" action="add" />
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="addEllipse(qreal, qreal, qreal, qreal, const QPen &, const QBrush &)">
|
||||
<modify-function signature="addEllipse(qreal, qreal, qreal, qreal, const QPen&, const QBrush&)">
|
||||
<modify-argument index="return">
|
||||
<parent index="this" action="add" />
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
|
||||
<modify-function signature="addLine(const QLineF &, const QPen &)">
|
||||
<modify-function signature="addLine(const QLineF&, const QPen&)">
|
||||
<modify-argument index="return">
|
||||
<parent index="this" action="add" />
|
||||
</modify-argument>
|
||||
|
|
@ -3590,38 +3632,38 @@
|
|||
</modify-argument>
|
||||
</modify-function>
|
||||
|
||||
<modify-function signature="addPath(const QPainterPath &, const QPen &, const QBrush &)">
|
||||
<modify-function signature="addPath(const QPainterPath&, const QPen&, const QBrush&)">
|
||||
<modify-argument index="return">
|
||||
<parent index="this" action="add" />
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="addPixmap(const QPixmap &)">
|
||||
<modify-function signature="addPixmap(const QPixmap&)">
|
||||
<modify-argument index="return">
|
||||
<parent index="this" action="add" />
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="addPolygon(const QPolygonF &, const QPen &, const QBrush &)">
|
||||
<modify-function signature="addPolygon(const QPolygonF&, const QPen&, const QBrush&)">
|
||||
<modify-argument index="return">
|
||||
<parent index="this" action="add" />
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="addRect(const QRectF &, const QPen &, const QBrush &)">
|
||||
<modify-function signature="addRect(const QRectF&, const QPen&, const QBrush&)">
|
||||
<modify-argument index="return">
|
||||
<parent index="this" action="add" />
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="addRect(qreal, qreal, qreal, qreal, const QPen &, const QBrush &)">
|
||||
<modify-function signature="addRect(qreal, qreal, qreal, qreal, const QPen&, const QBrush&)">
|
||||
<modify-argument index="return">
|
||||
<parent index="this" action="add" />
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
|
||||
<modify-function signature="addText(const QString &, const QFont &)">
|
||||
<modify-function signature="addText(const QString&, const QFont&)">
|
||||
<modify-argument index="return">
|
||||
<parent index="this" action="add" />
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="addSimpleText(const QString &, const QFont &)">
|
||||
<modify-function signature="addSimpleText(const QString&, const QFont&)">
|
||||
<modify-argument index="return">
|
||||
<parent index="this" action="add" />
|
||||
</modify-argument>
|
||||
|
|
@ -3717,7 +3759,7 @@
|
|||
<parent index="this" action="add"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="setHeaderItem(QTreeWidgetItem *)">
|
||||
<modify-function signature="setHeaderItem(QTreeWidgetItem*)">
|
||||
<modify-argument index="1">
|
||||
<parent index="this" action="add"/>
|
||||
</modify-argument>
|
||||
|
|
@ -3779,17 +3821,17 @@
|
|||
</object-type>
|
||||
<object-type name="QListWidgetItem" >
|
||||
<enum-type name="ItemType"/>
|
||||
<modify-function signature="QListWidgetItem(const QString &, QListWidget *, int)">
|
||||
<modify-function signature="QListWidgetItem(const QString&, QListWidget*, int)">
|
||||
<modify-argument index="this">
|
||||
<parent index="2" action="add"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="QListWidgetItem(const QIcon &, const QString &, QListWidget *, int)">
|
||||
<modify-function signature="QListWidgetItem(const QIcon&, const QString&, QListWidget*, int)">
|
||||
<modify-argument index="this">
|
||||
<parent index="3" action="add"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="QListWidgetItem(QListWidget *, int)">
|
||||
<modify-function signature="QListWidgetItem(QListWidget*, int)">
|
||||
<modify-argument index="this">
|
||||
<parent index="1" action="add"/>
|
||||
</modify-argument>
|
||||
|
|
@ -3826,17 +3868,17 @@
|
|||
<object-type name="QCompleter">
|
||||
<enum-type name="CompletionMode"/>
|
||||
<enum-type name="ModelSorting"/>
|
||||
<modify-function signature="setModel(QAbstractItemModel *)">
|
||||
<modify-function signature="setModel(QAbstractItemModel*)">
|
||||
<modify-argument index="1">
|
||||
<reference-count action="set"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="setPopup(QAbstractItemView *)">
|
||||
<modify-function signature="setPopup(QAbstractItemView*)">
|
||||
<modify-argument index="1">
|
||||
<parent index="this" action="add"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="setWidget(QWidget *)">
|
||||
<modify-function signature="setWidget(QWidget*)">
|
||||
<modify-argument index="this">
|
||||
<parent index="1" action="add"/>
|
||||
</modify-argument>
|
||||
|
|
@ -3851,17 +3893,17 @@
|
|||
<modify-function signature="write(QDataStream&)const">
|
||||
<modify-argument index="1" invalidate-after-use="yes"/>
|
||||
</modify-function>
|
||||
<modify-function signature="QTreeWidgetItem(QTreeWidget *,int)">
|
||||
<modify-function signature="QTreeWidgetItem(QTreeWidget*, int)">
|
||||
<modify-argument index="this">
|
||||
<parent index="1" action="add"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="QTreeWidgetItem(QTreeWidget *,const QStringList&,int)">
|
||||
<modify-function signature="QTreeWidgetItem(QTreeWidget*, const QStringList&, int)">
|
||||
<modify-argument index="this">
|
||||
<parent index="1" action="add"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="QTreeWidgetItem(QTreeWidget *,QTreeWidgetItem *,int)">
|
||||
<modify-function signature="QTreeWidgetItem(QTreeWidget*, QTreeWidgetItem*, int)">
|
||||
<modify-argument index="this">
|
||||
<parent index="1" action="add"/>
|
||||
</modify-argument>
|
||||
|
|
@ -3871,12 +3913,12 @@
|
|||
<parent index="1" action="add"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="QTreeWidgetItem(QTreeWidgetItem *,const QStringList &,int)">
|
||||
<modify-function signature="QTreeWidgetItem(QTreeWidgetItem*, const QStringList &, int)">
|
||||
<modify-argument index="this">
|
||||
<parent index="1" action="add"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="QTreeWidgetItem(QTreeWidgetItem *,QTreeWidgetItem *,int)">
|
||||
<modify-function signature="QTreeWidgetItem(QTreeWidgetItem*, QTreeWidgetItem*, int)">
|
||||
<modify-argument index="this">
|
||||
<parent index="1" action="add"/>
|
||||
</modify-argument>
|
||||
|
|
@ -3952,12 +3994,12 @@
|
|||
<parent index="1" action="add"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="addItem(QListWidgetItem *)">
|
||||
<modify-function signature="addItem(QListWidgetItem*)">
|
||||
<modify-argument index="1">
|
||||
<parent index="this" action="add"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="insertItem(int, QListWidgetItem *)">
|
||||
<modify-function signature="insertItem(int, QListWidgetItem*)">
|
||||
<modify-argument index="2">
|
||||
<parent index="this" action="add"/>
|
||||
</modify-argument>
|
||||
|
|
@ -3979,9 +4021,10 @@
|
|||
<extra-includes>
|
||||
<include file-name="QIcon" location="global"/>
|
||||
<include file-name="QMessageBox" location="global"/>
|
||||
<include file-name="glue/qwidget_glue.h" location="local"/>
|
||||
</extra-includes>
|
||||
|
||||
<inject-code class="native" file="glue/qwidget_glue.cpp" position="beginning" />
|
||||
|
||||
<enum-type name="RenderFlag" flags="RenderFlags"/>
|
||||
|
||||
<modify-function signature="setParent(QWidget*)">
|
||||
|
|
@ -4204,7 +4247,7 @@
|
|||
</insert-template>
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
<modify-function signature="insertAction(QAction *, QAction *)">
|
||||
<modify-function signature="insertAction(QAction*, QAction*)">
|
||||
<modify-argument index="2">
|
||||
<parent index="this" action="add"/>
|
||||
</modify-argument>
|
||||
|
|
@ -4240,7 +4283,7 @@
|
|||
|
||||
If a widget is non-native (alien) and winId() is invoked on it, that widget will be provided a native handle.
|
||||
|
||||
On X11 the type returned is long, on other platforms it's a PyCObject.
|
||||
On X11 the type returned is long, on other platforms it's void pointer casted to a Python long long.
|
||||
|
||||
This value may change at run-time. An event with type PySide.QtCore.QEvent.WinIdChange will be sent to the widget following a change in window system identifier.
|
||||
</inject-documentation>
|
||||
|
|
@ -4486,7 +4529,7 @@
|
|||
<define-ownership owner="target"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="setMimeData(QMimeData *)">
|
||||
<modify-function signature="setMimeData(QMimeData*)">
|
||||
<modify-argument index="1">
|
||||
<!-- TODO: maybe this is not the best solution -->
|
||||
<parent index="this" action="add"/>
|
||||
|
|
@ -4497,7 +4540,7 @@
|
|||
</object-type>
|
||||
<object-type name="QDateTimeEdit">
|
||||
<enum-type name="Section" flags="Sections"/>
|
||||
<modify-function signature="setCalendarWidget(QCalendarWidget *)">
|
||||
<modify-function signature="setCalendarWidget(QCalendarWidget*)">
|
||||
<modify-argument index="1">
|
||||
<parent index="this" action="add"/>
|
||||
</modify-argument>
|
||||
|
|
@ -4512,7 +4555,7 @@
|
|||
<include file-name="QStringList" location="global"/>
|
||||
<include file-name="QSize" location="global"/>
|
||||
</extra-includes>
|
||||
<modify-function signature="setSourceModel(QAbstractItemModel *)">
|
||||
<modify-function signature="setSourceModel(QAbstractItemModel*)">
|
||||
<modify-argument index="1">
|
||||
<reference-count action="set"/>
|
||||
</modify-argument>
|
||||
|
|
@ -4688,29 +4731,29 @@
|
|||
</modify-argument>
|
||||
</modify-function>
|
||||
|
||||
<modify-function signature="appendRow(const QList<QStandardItem *>&)">
|
||||
<modify-function signature="appendRow(const QList<QStandardItem*>&)">
|
||||
<modify-argument index="1">
|
||||
<parent index="this" action="add" />
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="appendRow(QStandardItem *)">
|
||||
<modify-function signature="appendRow(QStandardItem*)">
|
||||
<modify-argument index="1">
|
||||
<parent index="this" action="add" />
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
|
||||
<modify-function signature="insertRow(int, QStandardItem *)">
|
||||
<modify-function signature="insertRow(int, QStandardItem*)">
|
||||
<modify-argument index="2">
|
||||
<parent index="this" action="add" />
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="setHorizontalHeaderItem(int, QStandardItem *)">
|
||||
<modify-function signature="setHorizontalHeaderItem(int, QStandardItem*)">
|
||||
<modify-argument index="2">
|
||||
<parent index="this" action="add" />
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
|
||||
<modify-function signature="setItem(int, int, QStandardItem *)">
|
||||
<modify-function signature="setItem(int, int, QStandardItem*)">
|
||||
<inject-code class="target" position="beginning">
|
||||
// Clear parent from the old child
|
||||
QStandardItem* _i = %CPPSELF->item(%1, %2);
|
||||
|
|
@ -4723,7 +4766,7 @@
|
|||
<parent index="this" action="add" />
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="setItem(int, QStandardItem *)">
|
||||
<modify-function signature="setItem(int, QStandardItem*)">
|
||||
<inject-code class="target" position="beginning">
|
||||
// Clear parent from the old child
|
||||
QStandardItem* _i = %CPPSELF->item(%1);
|
||||
|
|
@ -4736,13 +4779,13 @@
|
|||
<parent index="this" action="add" />
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="setItemPrototype(const QStandardItem *)">
|
||||
<modify-function signature="setItemPrototype(const QStandardItem*)">
|
||||
<modify-argument index="1">
|
||||
<parent index="this" action="add" />
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
|
||||
<modify-function signature="setVerticalHeaderItem(int, QStandardItem *)">
|
||||
<modify-function signature="setVerticalHeaderItem(int, QStandardItem*)">
|
||||
<inject-code class="target" position="beginning">
|
||||
// Clear parent from the old child
|
||||
QStandardItem* _i = %CPPSELF->verticalHeaderItem(%1);
|
||||
|
|
@ -4774,19 +4817,19 @@
|
|||
</modify-argument>
|
||||
</modify-function>
|
||||
|
||||
<modify-function signature="insertColumn(int, const QList<QStandardItem *>&)">
|
||||
<modify-function signature="insertColumn(int, const QList<QStandardItem*>&)">
|
||||
<modify-argument index="2">
|
||||
<parent index="this" action="add" />
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
|
||||
<modify-function signature="insertRow(int, const QList<QStandardItem *>&)">
|
||||
<modify-function signature="insertRow(int, const QList<QStandardItem*>&)">
|
||||
<modify-argument index="2">
|
||||
<parent index="this" action="add" />
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
|
||||
<modify-function signature="appendColumn(const QList<QStandardItem *>&)">
|
||||
<modify-function signature="appendColumn(const QList<QStandardItem*>&)">
|
||||
<modify-argument index="1">
|
||||
<parent index="this" action="add" />
|
||||
</modify-argument>
|
||||
|
|
@ -4826,8 +4869,12 @@
|
|||
<replace-type modified-type="(retval, subtype)"/>
|
||||
</modify-argument>
|
||||
<inject-code class="target" position="end">
|
||||
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2);
|
||||
%PYARG_0 = Shiboken::makeTuple(retval_, %1);
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG1_TYPE](%1));
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
</object-type>
|
||||
|
|
@ -5039,18 +5086,18 @@
|
|||
<object-type name="QDial" />
|
||||
<object-type name="QLineEdit">
|
||||
<enum-type name="EchoMode"/>
|
||||
<modify-function signature="setCompleter(QCompleter *)">
|
||||
<modify-function signature="setCompleter(QCompleter*)">
|
||||
<modify-argument index="1">
|
||||
<parent index="this" action="add"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="setValidator(const QValidator *)">
|
||||
<modify-function signature="setValidator(const QValidator*)">
|
||||
<modify-argument index="1">
|
||||
<parent index="this" action="add"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="del()" rename="del_" />
|
||||
<modify-function signature="getTextMargins(int *, int *, int *, int *) const">
|
||||
<modify-function signature="getTextMargins(int*, int*, int*, int*) const">
|
||||
<modify-argument index="0">
|
||||
<replace-type modified-type="PyObject *" />
|
||||
</modify-argument>
|
||||
|
|
@ -5153,13 +5200,13 @@
|
|||
<object-type name="QTextBrowser"/>
|
||||
<object-type name="QDoubleSpinBox"/>
|
||||
<object-type name="QButtonGroup">
|
||||
<modify-function signature="addButton(QAbstractButton *)">
|
||||
<modify-function signature="addButton(QAbstractButton*)">
|
||||
<modify-argument index="1">
|
||||
<parent index="this" action="add"/>
|
||||
<no-null-pointer/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="addButton(QAbstractButton *, int)">
|
||||
<modify-function signature="addButton(QAbstractButton*, int)">
|
||||
<modify-argument index="1">
|
||||
<parent index="this" action="add"/>
|
||||
<no-null-pointer/>
|
||||
|
|
@ -5211,12 +5258,12 @@
|
|||
Shiboken::AutoDecRef result(PyObject_CallMethod(%PYARG_0, "connect", "OsO", %PYARG_0, SIGNAL(triggered()), %PYARG_2));
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
<modify-function signature="addAction(const QString &)">
|
||||
<modify-function signature="addAction(const QString&)">
|
||||
<modify-argument index="return">
|
||||
<parent index="this" action="add"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="addAction(const QIcon &, const QString &)">
|
||||
<modify-function signature="addAction(const QIcon&, const QString&)">
|
||||
<modify-argument index="return">
|
||||
<parent index="this" action="add"/>
|
||||
</modify-argument>
|
||||
|
|
@ -5378,9 +5425,12 @@
|
|||
<enum-type name="CompositionMode"/>
|
||||
<enum-type name="PixmapFragmentHint" flags="PixmapFragmentHints" since="4.7"/>
|
||||
<enum-type name="RenderHint" flags="RenderHints"/>
|
||||
<value-type name="PixmapFragment" since="4.7">
|
||||
<include file-name="QPainter" location="global"/>
|
||||
</value-type>
|
||||
|
||||
<!-- ### "drawText(...)" is an internal method. -->
|
||||
<modify-function signature="drawText(const QPointF &, const QString &, int, int)" remove="all"/>
|
||||
<modify-function signature="drawText(const QPointF&, const QString&, int, int)" remove="all"/>
|
||||
|
||||
<template name="qpainter_drawlist">
|
||||
%BEGIN_ALLOW_THREADS
|
||||
|
|
@ -5388,39 +5438,39 @@
|
|||
%END_ALLOW_THREADS
|
||||
</template>
|
||||
|
||||
<modify-function signature="drawConvexPolygon(const QPoint *, int)" remove="all" />
|
||||
<modify-function signature="drawConvexPolygon(const QPoint*, int)" remove="all" />
|
||||
<add-function signature="drawConvexPolygon(QVector<QPoint>)">
|
||||
<inject-code>
|
||||
<insert-template name="qpainter_drawlist" />
|
||||
</inject-code>
|
||||
</add-function>
|
||||
<modify-function signature="drawConvexPolygon(const QPointF *, int)" remove="all" />
|
||||
<modify-function signature="drawConvexPolygon(const QPointF*, int)" remove="all" />
|
||||
<add-function signature="drawConvexPolygon(QVector<QPointF>)">
|
||||
<inject-code>
|
||||
<insert-template name="qpainter_drawlist" />
|
||||
</inject-code>
|
||||
</add-function>
|
||||
<!-- ### Overloads using QVector<T> does the job of these methods -->
|
||||
<modify-function signature="drawLines(const QLine *, int)" remove="all" />
|
||||
<modify-function signature="drawLines(const QLineF *, int)" remove="all" />
|
||||
<modify-function signature="drawLines(const QPoint *, int)" remove="all" />
|
||||
<modify-function signature="drawLines(const QPointF *, int)" remove="all" />
|
||||
<modify-function signature="drawRects(const QRect *, int)" remove="all" />
|
||||
<modify-function signature="drawRects(const QRectF *, int)" remove="all" />
|
||||
<modify-function signature="drawLines(const QLine*, int)" remove="all" />
|
||||
<modify-function signature="drawLines(const QLineF*, int)" remove="all" />
|
||||
<modify-function signature="drawLines(const QPoint*, int)" remove="all" />
|
||||
<modify-function signature="drawLines(const QPointF*, int)" remove="all" />
|
||||
<modify-function signature="drawRects(const QRect*, int)" remove="all" />
|
||||
<modify-function signature="drawRects(const QRectF*, int)" remove="all" />
|
||||
<!-- ### -->
|
||||
<modify-function signature="drawPoints(const QPoint *, int)" remove="all" />
|
||||
<modify-function signature="drawPoints(const QPoint*, int)" remove="all" />
|
||||
<add-function signature="drawPoints(QVector<QPoint>)">
|
||||
<inject-code>
|
||||
<insert-template name="qpainter_drawlist" />
|
||||
</inject-code>
|
||||
</add-function>
|
||||
<modify-function signature="drawPoints(const QPointF *, int)" remove="all" />
|
||||
<modify-function signature="drawPoints(const QPointF*, int)" remove="all" />
|
||||
<add-function signature="drawPoints(QVector<QPointF>)">
|
||||
<inject-code>
|
||||
<insert-template name="qpainter_drawlist" />
|
||||
</inject-code>
|
||||
</add-function>
|
||||
<modify-function signature="drawPolygon(const QPoint *, int, Qt::FillRule)" remove="all" />
|
||||
<modify-function signature="drawPolygon(const QPoint*, int, Qt::FillRule)" remove="all" />
|
||||
<add-function signature="drawPolygon(QVector<QPoint>, Qt::FillRule)">
|
||||
<inject-code>
|
||||
%BEGIN_ALLOW_THREADS
|
||||
|
|
@ -5428,7 +5478,7 @@
|
|||
%END_ALLOW_THREADS
|
||||
</inject-code>
|
||||
</add-function>
|
||||
<modify-function signature="drawPolygon(const QPointF *, int, Qt::FillRule)" remove="all" />
|
||||
<modify-function signature="drawPolygon(const QPointF*, int, Qt::FillRule)" remove="all" />
|
||||
<add-function signature="drawPolygon(QVector<QPointF>, Qt::FillRule)">
|
||||
<inject-code>
|
||||
%BEGIN_ALLOW_THREADS
|
||||
|
|
@ -5436,13 +5486,13 @@
|
|||
%END_ALLOW_THREADS
|
||||
</inject-code>
|
||||
</add-function>
|
||||
<modify-function signature="drawPolyline(const QPoint *, int)" remove="all" />
|
||||
<modify-function signature="drawPolyline(const QPoint*, int)" remove="all" />
|
||||
<add-function signature="drawPolyline(QVector<QPoint>)">
|
||||
<inject-code>
|
||||
<insert-template name="qpainter_drawlist" />
|
||||
</inject-code>
|
||||
</add-function>
|
||||
<modify-function signature="drawPolyline(const QPointF *, int)" remove="all" />
|
||||
<modify-function signature="drawPolyline(const QPointF*, int)" remove="all" />
|
||||
<add-function signature="drawPolyline(QVector<QPointF>)">
|
||||
<inject-code>
|
||||
<insert-template name="qpainter_drawlist" />
|
||||
|
|
@ -5456,32 +5506,32 @@
|
|||
<rename to="yRound"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="drawTiledPixmap(const QRect &,const QPixmap &, const QPoint &)">
|
||||
<modify-function signature="drawTiledPixmap(const QRect&,const QPixmap&, const QPoint&)">
|
||||
<modify-argument index="3">
|
||||
<rename to="pos"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="QPainter(QPaintDevice *)">
|
||||
<modify-function signature="QPainter(QPaintDevice*)">
|
||||
<modify-argument index="1">
|
||||
<no-null-pointer/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="begin(QPaintDevice *)">
|
||||
<modify-function signature="begin(QPaintDevice*)">
|
||||
<modify-argument index="1">
|
||||
<no-null-pointer/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="initFrom(const QWidget *)">
|
||||
<modify-function signature="initFrom(const QWidget*)">
|
||||
<modify-argument index="1">
|
||||
<no-null-pointer/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="setRedirected(const QPaintDevice *, QPaintDevice *, const QPoint &)">
|
||||
<modify-function signature="setRedirected(const QPaintDevice*, QPaintDevice*, const QPoint&)">
|
||||
<modify-argument index="1">
|
||||
<no-null-pointer/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
<modify-function signature="restoreRedirected(const QPaintDevice *)">
|
||||
<modify-function signature="restoreRedirected(const QPaintDevice*)">
|
||||
<modify-argument index="1">
|
||||
<no-null-pointer/>
|
||||
</modify-argument>
|
||||
|
|
@ -5635,21 +5685,21 @@
|
|||
</modify-function>
|
||||
</object-type>
|
||||
<object-type name="QFormLayout">
|
||||
<extra-includes>
|
||||
<include file-name="glue/qlayout_help_functions.h" location="local"/>
|
||||
</extra-includes>
|
||||
<inject-code class="native" position="beginning" file="glue/qlayout_help_functions.cpp"/>
|
||||
|
||||
<enum-type name="FieldGrowthPolicy"/>
|
||||
<enum-type name="ItemRole"/>
|
||||
<enum-type name="RowWrapPolicy"/>
|
||||
|
||||
<template name="fix_args,int*,ItemRole*">
|
||||
int _row;
|
||||
QFormLayout::ItemRole _role;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%CPPSELF->%FUNCTION_NAME(%ARGUMENT_NAMES, &_row, &_role);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(_row, _role);
|
||||
int _row;
|
||||
QFormLayout::ItemRole _role;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%CPPSELF->%FUNCTION_NAME(%ARGUMENT_NAMES, &_row, &_role);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[int](_row));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QFormLayout::ItemRole](_role));
|
||||
</template>
|
||||
|
||||
<modify-function signature="getLayoutPosition(QLayout*,int*,QFormLayout::ItemRole*)const">
|
||||
|
|
@ -6702,6 +6752,18 @@
|
|||
</inject-code>
|
||||
</modify-function>
|
||||
|
||||
<modify-function signature="inverted(bool*)const">
|
||||
<modify-argument index="1">
|
||||
<remove-argument/>
|
||||
</modify-argument>
|
||||
<modify-argument index="return">
|
||||
<replace-type modified-type="PyTuple"/>
|
||||
</modify-argument>
|
||||
<inject-code class="target" position="beginning">
|
||||
<insert-template name="fix_bool*"/>
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
|
||||
<!-- ### "constData() const" and "data() const" are unnecessary in Python and their function is performed by "data()". -->
|
||||
<modify-function signature="data() const" remove="all"/>
|
||||
<modify-function signature="constData() const" remove="all"/>
|
||||
|
|
|
|||
|
|
@ -19,9 +19,31 @@
|
|||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<typesystem package="PySide.QtGui">
|
||||
<primitive-type name="Qt::HANDLE" target-lang-api-name="PyObject" />
|
||||
<primitive-type name="WId" target-lang-api-name="PyObject">
|
||||
<conversion-rule file="glue/wid_conversions.h"/>
|
||||
<conversion-rule>
|
||||
<native-to-target>
|
||||
#ifdef IS_PY3K
|
||||
return PyCapsule_New(%in, 0, 0);
|
||||
#else
|
||||
return PyCObject_FromVoidPtr(%in, 0);
|
||||
#endif
|
||||
</native-to-target>
|
||||
<target-to-native>
|
||||
<add-conversion type="PyNone">
|
||||
%out = 0;
|
||||
</add-conversion>
|
||||
<add-conversion check="checkPyCapsuleOrPyCObject(%in)" type="PyObject">
|
||||
#ifdef IS_PY3K
|
||||
%out = (%OUTTYPE)PyCapsule_GetPointer(%in, 0);
|
||||
#else
|
||||
%out = (%OUTTYPE)PyCObject_AsVoidPtr(%in);
|
||||
#endif
|
||||
</add-conversion>
|
||||
</target-to-native>
|
||||
</conversion-rule>
|
||||
</primitive-type>
|
||||
<inject-code class="native" position="beginning">
|
||||
<insert-template name="checkPyCapsuleOrPyCObject_func"/>
|
||||
</inject-code>
|
||||
<enum-type name="QPixmap::HBitmapFormat" />
|
||||
</typesystem>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ set(QtHelp_SRC
|
|||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtHelp/qthelp_module_wrapper.cpp
|
||||
)
|
||||
|
||||
set(QtHelp_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtHelp_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
set(QtHelp_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtCore_BINARY_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtHelp_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
set(QtHelp_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${QT_QTCORE_INCLUDE_DIR}
|
||||
${QT_QTGUI_INCLUDE_DIR}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/${BINDING_NAME}/QtMaemo5/qmaemo5valuebutton_wrapper.
|
|||
${CMAKE_CURRENT_BINARY_DIR}/${BINDING_NAME}/QtMaemo5/qtmaemo5_module_wrapper.cpp
|
||||
)
|
||||
|
||||
set(QtMaemo5_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtMaemo5_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
set(QtMaemo5_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtCore_BINARY_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtMaemo5_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
|
||||
# QT_QTMAEMO5_* variables are not defined by CMake
|
||||
if(NOT QT_QTMAEMO5_INCLUDE_DIR)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ set(QtMultimedia_SRC
|
|||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtMultimedia/qvideoframe_wrapper.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtMultimedia/qtmultimedia_module_wrapper.cpp
|
||||
)
|
||||
set(QtMultimedia_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
set(QtMultimedia_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtCore_BINARY_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
|
||||
set(QtMultimedia_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtMultimedia/
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@
|
|||
<object-type name="QAbstractVideoBuffer">
|
||||
<enum-type name="HandleType"/>
|
||||
<enum-type name="MapMode"/>
|
||||
<modify-function signature="map(QAbstractVideoBuffer::MapMode, int*, int*)" remove="all"/>
|
||||
<!-- TODO: discuss a way to have this working with the virtual method.
|
||||
<modify-function signature="map(QAbstractVideoBuffer::MapMode, int*, int*)">
|
||||
<modify-argument index="0">
|
||||
<replace-type modified-type="PyObject"/>
|
||||
|
|
@ -51,6 +53,7 @@
|
|||
<insert-template name="fix_arg,int*,int*"/>
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
-->
|
||||
</object-type>
|
||||
<object-type name="QAbstractVideoSurface">
|
||||
<enum-type name="Error"/>
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ ${QtNetwork_47_SRC}
|
|||
${QtNetwork_OPTIONAL_SRC}
|
||||
)
|
||||
|
||||
set(QtNetwork_typesystem_path "${QtCore_SOURCE_DIR}")
|
||||
set(QtNetwork_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtCore_BINARY_DIR}")
|
||||
set(QtNetwork_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/
|
||||
${QT_INCLUDE_DIR}
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
Shiboken::AutoArrayPointer<char> data(%ARGUMENT_NAMES);
|
||||
QHostAddress ha;
|
||||
quint16 port;
|
||||
|
||||
%RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(data, %ARGUMENT_NAMES, &ha, &port);
|
||||
%PYARG_0 = Shiboken::makeTuple(QByteArray(data, retval), ha, port);
|
||||
|
|
@ -136,7 +136,19 @@
|
|||
<modify-argument index="return">
|
||||
<replace-type modified-type="(data, address, port)"/>
|
||||
</modify-argument>
|
||||
<inject-code class="target" position="beginning" file="glue/qudpsocket_read_datagram_glue.cpp"/>
|
||||
<inject-code class="target" position="beginning">
|
||||
Shiboken::AutoArrayPointer<char> data(%ARGUMENT_NAMES);
|
||||
QHostAddress ha;
|
||||
quint16 port;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(data, %ARGUMENT_NAMES, &ha, &port);
|
||||
%END_ALLOW_THREADS
|
||||
QByteArray ba(data, retval);
|
||||
%PYARG_0 = PyTuple_New(3);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[QByteArray](ba));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QHostAddress](ha));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[quint16](port));
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
<modify-function signature="writeDatagram(const QByteArray&, const QHostAddress&, quint16)" allow-thread="yes"/>
|
||||
<!-- ### writeDatagram(QByteArray, ...) does the trick -->
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ set(QtOpenGL_SRC
|
|||
${QtOpenGL_47_SRC}
|
||||
)
|
||||
|
||||
set(QtOpenGL_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtOpenGL_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
set(QtOpenGL_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtCore_BINARY_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtOpenGL_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
set(QtOpenGL_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${QT_QTCORE_INCLUDE_DIR}
|
||||
${QT_QTGUI_INCLUDE_DIR}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,21 @@
|
|||
<typesystem package="PySide.QtOpenGL">
|
||||
<load-typesystem name="typesystem_gui.xml" generate="no" />
|
||||
|
||||
<primitive-type name="GLbitfield"/>
|
||||
<primitive-type name="GLboolean"/>
|
||||
<primitive-type name="GLbyte"/>
|
||||
<primitive-type name="GLclampd"/>
|
||||
<primitive-type name="GLclampf"/>
|
||||
<primitive-type name="GLdouble"/>
|
||||
<primitive-type name="GLenum"/>
|
||||
<primitive-type name="GLfloat"/>
|
||||
<primitive-type name="GLint"/>
|
||||
<primitive-type name="GLshort"/>
|
||||
<primitive-type name="GLsizei"/>
|
||||
<primitive-type name="GLubyte"/>
|
||||
<primitive-type name="GLuint"/>
|
||||
<primitive-type name="GLushort"/>
|
||||
|
||||
<rejection class="QGLColormap::QGLColormapData"/>
|
||||
<rejection class="QGLContext" field-name="currentCtx"/>
|
||||
|
||||
|
|
@ -190,9 +205,8 @@
|
|||
</inject-code>
|
||||
</modify-function>
|
||||
|
||||
|
||||
<!-- setUniformValueArray -->
|
||||
<modify-function signature="setUniformValueArray(int, const int*, int)" rename="setUniformValueArrayInt">
|
||||
<modify-function signature="setUniformValueArray(int, const GLint*, int)" rename="setUniformValueArrayInt">
|
||||
<modify-argument index="2" >
|
||||
<replace-type modified-type="PySequence" />
|
||||
</modify-argument>
|
||||
|
|
@ -208,7 +222,7 @@
|
|||
</inject-code>
|
||||
</modify-function>
|
||||
|
||||
<modify-function signature="setUniformValueArray(int, const uint*, int)" rename="setUniformValueArrayUint">
|
||||
<modify-function signature="setUniformValueArray(int, const GLuint*, int)" rename="setUniformValueArrayUint">
|
||||
<modify-argument index="2" >
|
||||
<replace-type modified-type="PySequence" />
|
||||
</modify-argument>
|
||||
|
|
@ -416,7 +430,7 @@
|
|||
</inject-code>
|
||||
</modify-function>
|
||||
|
||||
<modify-function signature="setUniformValueArray(const char*, const int*, int)" rename="setUniformValueArrayInt">
|
||||
<modify-function signature="setUniformValueArray(const char*, const GLint*, int)" rename="setUniformValueArrayInt">
|
||||
<modify-argument index="2" >
|
||||
<replace-type modified-type="PySequence" />
|
||||
</modify-argument>
|
||||
|
|
@ -432,7 +446,7 @@
|
|||
</inject-code>
|
||||
</modify-function>
|
||||
|
||||
<modify-function signature="setUniformValueArray(const char*, const uint*, int)" rename="setUniformValueArrayUint">
|
||||
<modify-function signature="setUniformValueArray(const char*, const GLuint*, int)" rename="setUniformValueArrayUint">
|
||||
<modify-argument index="2" >
|
||||
<replace-type modified-type="PySequence" />
|
||||
</modify-argument>
|
||||
|
|
@ -640,13 +654,20 @@
|
|||
</inject-code>
|
||||
</modify-function>
|
||||
|
||||
<!-- ### TODO: must evaluate if anything other than removal should be done. -->
|
||||
<modify-function signature="setAttributeArray(int,const GLfloat*,int,int)" remove="all" />
|
||||
<modify-function signature="setAttributeArray(const char*,const GLfloat*,int,int)" remove="all" />
|
||||
<modify-function signature="setUniformValueArray(int,const GLfloat*,int,int)" remove="all" />
|
||||
<modify-function signature="setUniformValueArray(const char*,const GLfloat*,int,int)" remove="all" />
|
||||
<!-- ### -->
|
||||
|
||||
<!-- ### Use QMatrixZxY overloads -->
|
||||
<modify-function signature="setUniformValue(int,Array)" remove="all" />
|
||||
<modify-function signature="setUniformValue(const char*,Array)" remove="all" />
|
||||
<modify-function signature="setAttributeValue(int,const float*,int,int)" remove="all" />
|
||||
<modify-function signature="setAttributeValue(const char*,const float*,int,int)" remove="all" />
|
||||
<modify-function signature="setAttributeArray(int, uint, const void*, int, int)" remove="all" since="4.7" />
|
||||
<modify-function signature="setAttributeArray(const char*, uint, const void*, int, int)" remove="all" since="4.7" />
|
||||
<modify-function signature="setAttributeValue(int,const GLfloat*,int,int)" remove="all" />
|
||||
<modify-function signature="setAttributeValue(const char*,const GLfloat*,int,int)" remove="all" />
|
||||
<modify-function signature="setAttributeArray(int, GLenum, const void*, int, int)" remove="all" since="4.7" />
|
||||
<modify-function signature="setAttributeArray(const char*, GLenum, const void*, int, int)" remove="all" since="4.7" />
|
||||
<!-- ### -->
|
||||
</object-type>
|
||||
|
||||
|
|
@ -657,15 +678,13 @@
|
|||
<enum-type name="UsagePattern" since="4.7"/>
|
||||
<modify-function signature="allocate(const void*, int)">
|
||||
<modify-argument index="1">
|
||||
<replace-type modified-type="const QByteArray&"/>
|
||||
<replace-type modified-type="QByteArray&"/>
|
||||
</modify-argument>
|
||||
<modify-argument index="2">
|
||||
<replace-default-expression with="-1"/>
|
||||
</modify-argument>
|
||||
<inject-code class="target" position="beginning">
|
||||
int size = %2;
|
||||
if (size < 0)
|
||||
size = %1.size();
|
||||
int size = (%2 < 0) ? %1.size() : %2;
|
||||
%CPPSELF.allocate((const void*) %1.data(), size);
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
|
|
@ -697,21 +716,21 @@
|
|||
QByteArray ret;
|
||||
if (result)
|
||||
ret.append((const char*)data, %3);
|
||||
%PYARG_0 = Shiboken::makeTuple(result, ret);
|
||||
%PYARG_0 = PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[bool](result));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QByteArray](ret));
|
||||
delete[] data;
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
<modify-function signature="write(int, const void*, int)">
|
||||
<modify-argument index="2">
|
||||
<replace-type modified-type="const QByteArray&"/>
|
||||
<replace-type modified-type="QByteArray&"/>
|
||||
</modify-argument>
|
||||
<modify-argument index="3">
|
||||
<replace-default-expression with="-1"/>
|
||||
</modify-argument>
|
||||
<inject-code class="target" position="beginning">
|
||||
int size = %3;
|
||||
if (size < 0)
|
||||
size = %2.size();
|
||||
int size = (%3 < 0) ? %2.size() : %3;
|
||||
%CPPSELF.write(%1, (const void*) %2.data(), size);
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtScript/qscriptvalueiterator_wrapper.cpp
|
|||
${QtScript_47_SRC}
|
||||
)
|
||||
|
||||
set(QtScript_typesystem_path "${QtCore_SOURCE_DIR}")
|
||||
set(QtScript_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtCore_BINARY_DIR}")
|
||||
set(QtScript_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtScript
|
||||
${QT_INCLUDE_DIR}
|
||||
|
|
|
|||
|
|
@ -98,12 +98,16 @@
|
|||
</add-function>
|
||||
<add-function signature="__next__()" return-type="PyObject*">
|
||||
<inject-code>
|
||||
if (%CPPSELF.hasNext()) {
|
||||
%CPPSELF.next();
|
||||
%PYARG_0 = Shiboken::makeTuple(%CPPSELF.name(), %CPPSELF.value().toVariant());
|
||||
} else {
|
||||
PyErr_SetNone(PyExc_StopIteration);
|
||||
}
|
||||
if (%CPPSELF.hasNext()) {
|
||||
%CPPSELF.next();
|
||||
QString name = %CPPSELF.name();
|
||||
QVariant value = %CPPSELF.value().toVariant();
|
||||
%PYARG_0 = PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[QString](name));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QVariant](value));
|
||||
} else {
|
||||
PyErr_SetNone(PyExc_StopIteration);
|
||||
}
|
||||
</inject-code>
|
||||
</add-function>
|
||||
</object-type>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ set(QtScriptTools_SRC
|
|||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtScriptTools/qscriptenginedebugger_wrapper.cpp
|
||||
)
|
||||
|
||||
set(QtScriptTools_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtScript_SOURCE_DIR}${PATH_SEP}${QtScriptTools_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
set(QtScriptTools_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtCore_BINARY_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtScript_SOURCE_DIR}${PATH_SEP}${QtScriptTools_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
|
||||
set(QtScriptTools_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${QT_QTCORE_INCLUDE_DIR}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ set(QtSql_SRC
|
|||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtSql/qtsql_module_wrapper.cpp
|
||||
)
|
||||
|
||||
set(QtSql_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtSql_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
set(QtSql_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtCore_BINARY_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtSql_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
set(QtSql_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${QT_QTCORE_INCLUDE_DIR}
|
||||
${QT_QTGUI_INCLUDE_DIR}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtSvg/qsvgwidget_wrapper.cpp
|
|||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtSvg/qtsvg_module_wrapper.cpp
|
||||
)
|
||||
|
||||
set(QtSvg_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
set(QtSvg_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtCore_BINARY_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
set(QtSvg_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtSvg/
|
||||
${QT_INCLUDE_DIR}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtTest/qttest_module_wrapper.cpp
|
|||
${QtTest_46_SRC}
|
||||
)
|
||||
|
||||
set(QtTest_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
set(QtTest_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtCore_BINARY_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
set(QtTest_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtTest/
|
||||
${QT_INCLUDE_DIR}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ set(QtUiTools_SRC
|
|||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtUiTools/quiloader_wrapper.cpp
|
||||
)
|
||||
|
||||
set(QtUiTools_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtXml_SOURCE_DIR}${PATH_SEP}${QtUiTools_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
set(QtUiTools_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtCore_BINARY_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtXml_SOURCE_DIR}${PATH_SEP}${QtUiTools_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
set(QtUiTools_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${QT_QTCORE_INCLUDE_DIR}
|
||||
${QT_QTGUI_INCLUDE_DIR}
|
||||
|
|
@ -23,10 +23,10 @@ set(QtUiTools_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
|
|||
set(QtUiTools_libraries pyside
|
||||
uiplugin
|
||||
${SHIBOKEN_PYTHON_LIBRARIES}
|
||||
${QT_QTCORE_LIBRARY}
|
||||
${QT_QTGUI_LIBRARY}
|
||||
${QT_QTUITOOLS_LIBRARY}
|
||||
${QT_QTDESIGNER_LIBRARY}
|
||||
${QT_QTUITOOLS_LIBRARY})
|
||||
${QT_QTCORE_LIBRARY}
|
||||
${QT_QTGUI_LIBRARY})
|
||||
set(QtUiTools_deps QtGui QtXml)
|
||||
create_pyside_module(QtUiTools
|
||||
QtUiTools_include_dirs
|
||||
|
|
|
|||
|
|
@ -33,13 +33,13 @@ inline void registerCustomWidget(PyObject* obj)
|
|||
if (plugin == 0) {
|
||||
foreach(QObject* o, QPluginLoader::staticInstances()) {
|
||||
plugin = qobject_cast<PyCustomWidgets*>(o);
|
||||
if (o)
|
||||
if (plugin)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!plugin)
|
||||
qDebug() << "Fail to load uiloader plugin";
|
||||
qDebug() << "Failed to load uiloader plugin.";
|
||||
else
|
||||
plugin->registerWidgetType(obj);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ static void createChildrenNameAttributes(PyObject* root, QObject* object)
|
|||
if (!name.isEmpty() && !name.startsWith("_") && !name.startsWith("qt_")) {
|
||||
bool hasAttr = PyObject_HasAttrString(root, name.constData());
|
||||
if (!hasAttr) {
|
||||
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QObject*>::toPython(child));
|
||||
Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QObject*](child));
|
||||
PyObject_SetAttrString(root, name.constData(), pyChild);
|
||||
}
|
||||
createChildrenNameAttributes(root, child);
|
||||
|
|
@ -31,14 +31,12 @@ static PyObject* QUiLoadedLoadUiFromDevice(QUiLoader* self, QIODevice* dev, QWid
|
|||
QWidget* wdg = self->load(dev, parent);
|
||||
|
||||
if (wdg) {
|
||||
PyObject* pyWdg = Shiboken::Converter<QWidget*>::toPython(wdg);
|
||||
|
||||
PyObject* pyWdg = %CONVERTTOPYTHON[QWidget*](wdg);
|
||||
createChildrenNameAttributes(pyWdg, wdg);
|
||||
if (parent) {
|
||||
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(parent));
|
||||
Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](parent));
|
||||
Shiboken::Object::setParent(pyParent, pyWdg);
|
||||
}
|
||||
|
||||
return pyWdg;
|
||||
}
|
||||
|
||||
|
|
@ -26,6 +26,7 @@
|
|||
<extra-includes>
|
||||
<include file-name="glue/plugins.h" location="local"/>
|
||||
</extra-includes>
|
||||
<inject-code class="native" position="beginning" file="glue/uitools_loadui.cpp"/>
|
||||
<inject-code>
|
||||
Q_IMPORT_PLUGIN(uiplugin);
|
||||
</inject-code>
|
||||
|
|
@ -69,34 +70,32 @@
|
|||
%CPPSELF.addPluginPath(""); // force reload widgets
|
||||
</inject-code>
|
||||
</add-function>
|
||||
<modify-function signature="createAction(QObject *, const QString&)">
|
||||
<modify-function signature="createAction(QObject*, const QString&)">
|
||||
<modify-argument index="return">
|
||||
<parent index="1" action="add"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
|
||||
<modify-function signature="createActionGroup(QObject *, const QString&)">
|
||||
<modify-function signature="createActionGroup(QObject*, const QString&)">
|
||||
<modify-argument index="return">
|
||||
<parent index="1" action="add"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
|
||||
<modify-function signature="createLayout(const QString&,QObject *, const QString&)">
|
||||
<modify-function signature="createLayout(const QString&, QObject*, const QString&)">
|
||||
<modify-argument index="return">
|
||||
<parent index="2" action="add"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
|
||||
<modify-function signature="createWidget(const QString&,QWidget*, const QString&)">
|
||||
<modify-function signature="createWidget(const QString&, QWidget*, const QString&)">
|
||||
<modify-argument index="return">
|
||||
<parent index="2" action="add"/>
|
||||
<parent index="2" action="add"/>
|
||||
<define-ownership class="target" owner="default"/>
|
||||
</modify-argument>
|
||||
</modify-function>
|
||||
|
||||
<modify-function signature="load(QIODevice*, QWidget*)">
|
||||
<extra-includes>
|
||||
<include file-name="glue/uitools_loadui.h" location="local"/>
|
||||
</extra-includes>
|
||||
<modify-argument index="2">
|
||||
<replace-default-expression with="0" />
|
||||
<rename to="parentWidget" />
|
||||
|
|
@ -112,9 +111,6 @@
|
|||
|
||||
<!-- Syntax sugar -->
|
||||
<add-function signature="load(QString, QWidget*)" return-type="QWidget*">
|
||||
<extra-includes>
|
||||
<include file-name="glue/uitools_loadui.h" location="local"/>
|
||||
</extra-includes>
|
||||
<modify-argument index="2">
|
||||
<replace-default-expression with="0" />
|
||||
<rename to="parentWidget" />
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebKit/webcore_wrapper.cpp
|
|||
${QtWebKit_46_SRC}
|
||||
)
|
||||
|
||||
set(QtWebKit_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtNetwork_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
set(QtWebKit_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtCore_BINARY_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtNetwork_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
set(QtWebkit_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebkit/
|
||||
${QT_INCLUDE_DIR}
|
||||
|
|
|
|||
|
|
@ -98,11 +98,11 @@
|
|||
// Cast the parameters according to the extension type
|
||||
if (extension == QWebPage::ChooseMultipleFilesExtension) {
|
||||
const ChooseMultipleFilesExtension$TYPE_SUFFIX* _in = reinterpret_cast<const ChooseMultipleFilesExtension$TYPE_SUFFIX*>(%in);
|
||||
%out = %CONVERTTOPYTHON[const ChooseMultipleFilesExtension$TYPE_SUFFIX*](_in);
|
||||
%out = %CONVERTTOPYTHON[const QWebPage::ChooseMultipleFilesExtension$TYPE_SUFFIX*](_in);
|
||||
#if QT_VERSION >= 0x040600
|
||||
} else if (extension == QWebPage::ErrorPageExtension) {
|
||||
const ErrorPageExtension$TYPE_SUFFIX* _in = reinterpret_cast<const ErrorPageExtension$TYPE_SUFFIX*>(%in);
|
||||
%out = %CONVERTTOPYTHON[const ErrorPageExtension$TYPE_SUFFIX*](_in);
|
||||
%out = %CONVERTTOPYTHON[const QWebPage::ErrorPageExtension$TYPE_SUFFIX*](_in);
|
||||
#endif
|
||||
}
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtXml/qxmlreader_wrapper.cpp
|
|||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtXml/qxmlsimplereader_wrapper.cpp
|
||||
)
|
||||
|
||||
set(QtXml_typesystem_path "${QtCore_SOURCE_DIR}")
|
||||
set(QtXml_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtCore_BINARY_DIR}")
|
||||
set(QtXml_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtXml
|
||||
${CMAKE_SOURCE_DIR}
|
||||
|
|
|
|||
|
|
@ -33,14 +33,17 @@
|
|||
<value-type name="QDomComment" />
|
||||
|
||||
<template name="qdomdocument_setcontent">
|
||||
QString _errorMsg_;
|
||||
int _errorLine_ = 0;
|
||||
int _errorColumn_ = 0;
|
||||
|
||||
%BEGIN_ALLOW_THREADS
|
||||
bool _ret_ = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &_errorMsg_, &_errorLine_, &_errorColumn_);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(_ret_, _errorMsg_, _errorLine_, _errorColumn_);
|
||||
QString _errorMsg_;
|
||||
int _errorLine_ = 0;
|
||||
int _errorColumn_ = 0;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
bool _ret_ = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &_errorMsg_, &_errorLine_, &_errorColumn_);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = PyTuple_New(4);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[bool](_ret_));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QString](_errorMsg_));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[int](_errorLine_));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 3, %CONVERTTOPYTHON[int](_errorColumn_));
|
||||
</template>
|
||||
|
||||
<value-type name="QDomDocument">
|
||||
|
|
@ -269,13 +272,13 @@
|
|||
</conversion-rule>
|
||||
</modify-argument>
|
||||
<inject-code class="target" position="end">
|
||||
QXmlInputSource* _qxmlinputsource_arg_ = 0;
|
||||
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(%1, %2, _qxmlinputsource_arg_);
|
||||
%END_ALLOW_THREADS
|
||||
|
||||
%PYARG_0 = Shiboken::makeTuple(%0, _qxmlinputsource_arg_);
|
||||
QXmlInputSource* _qxmlinputsource_arg_ = 0;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(%1, %2, _qxmlinputsource_arg_);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](%0));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QXmlInputSource*](_qxmlinputsource_arg_));
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
</object-type>
|
||||
|
|
@ -296,11 +299,13 @@
|
|||
</conversion-rule>
|
||||
</modify-argument>
|
||||
<inject-code class="target" position="end">
|
||||
QXmlInputSource* _qxmlinputsource_arg_ = 0;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE %0 = %CPPSELF.%TYPE::%FUNCTION_NAME(%1, %2, _qxmlinputsource_arg_);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(%0, _qxmlinputsource_arg_);
|
||||
QXmlInputSource* _qxmlinputsource_arg_ = 0;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE %0 = %CPPSELF.%TYPE::%FUNCTION_NAME(%1, %2, _qxmlinputsource_arg_);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](%0));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QXmlInputSource*](_qxmlinputsource_arg_));
|
||||
</inject-code>
|
||||
</modify-function>
|
||||
</object-type>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ set(QtXmlPatterns_SRC
|
|||
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtXmlPatterns/qxmlserializer_wrapper.cpp
|
||||
${QtXmlPatterns_46_SRC}
|
||||
)
|
||||
set(QtXmlPatterns_typesystem_path "${QtCore_SOURCE_DIR}")
|
||||
set(QtXmlPatterns_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtCore_BINARY_DIR}")
|
||||
set(QtXmlPatterns_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${QT_QTCORE_INCLUDE_DIR}
|
||||
${QT_QTXMLPATTERNS_INCLUDE_DIR}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,11 @@
|
|||
</value-type>
|
||||
|
||||
<value-type name="QXmlQuery">
|
||||
<!-- ### TODO: must evaluate if anything other than removal is needed. -->
|
||||
<enum-type name="QueryLanguage" />
|
||||
<modify-function signature="evaluateTo(QStringList*)const" remove="all" />
|
||||
<modify-function signature="evaluateTo(QString*)const" remove="all" />
|
||||
<!-- ### -->
|
||||
</value-type>
|
||||
<object-type name="QXmlResultItems" />
|
||||
<object-type name="QXmlSerializer" />
|
||||
|
|
|
|||
|
|
@ -1,9 +1,3 @@
|
|||
import sys
|
||||
|
||||
__all__ = ['QtCore', 'QtGui', 'QtNetwork', 'QtOpenGL', 'QtSql', 'QtSvg', 'QtTest', 'QtWebKit', 'QtScript']
|
||||
|
||||
if sys.version_info[0] < 3:
|
||||
import private
|
||||
|
||||
__version__ = "@BINDING_API_VERSION_FULL@"
|
||||
__version_info__ = (@BINDING_API_MAJOR_VERSION@, @BINDING_API_MINOR_VERSION@, @BINDING_API_MICRO_VERSION@, "@BINDING_API_RELEASE_LEVEL@", @BINDING_API_SERIAL@)
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/phonon/phonon_backendcapabilities_notifierwra
|
|||
${phonon_OPTIONAL_SRC}
|
||||
)
|
||||
|
||||
set(phonon_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${phonon_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
set(phonon_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtCore_BINARY_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${phonon_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}")
|
||||
set(phonon_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${QT_QTCORE_INCLUDE_DIR}
|
||||
${QT_QTGUI_INCLUDE_DIR}
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
import atexit
|
||||
from QtCore import __moduleShutdown
|
||||
|
||||
atexit.register(__moduleShutdown)
|
||||
|
|
@ -30,68 +30,80 @@
|
|||
</template>
|
||||
|
||||
<!-- Templates to fix bool* parameters -->
|
||||
<template name="tuple_retval_ok">
|
||||
%PYARG_0 = PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[bool](ok_));
|
||||
</template>
|
||||
<template name="fix_bool*">
|
||||
bool ok_;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&ok_);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(retval_, ok_);
|
||||
<insert-template name="tuple_retval_ok"/>
|
||||
</template>
|
||||
<template name="fix_args,bool*">
|
||||
bool ok_;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &ok_);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(retval_, ok_);
|
||||
<insert-template name="tuple_retval_ok"/>
|
||||
</template>
|
||||
<template name="fix_arg,bool*,arg">
|
||||
bool ok_;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, &ok_, %3);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(retval_, ok_);
|
||||
<insert-template name="tuple_retval_ok"/>
|
||||
</template>
|
||||
<template name="fix_bool*,arg">
|
||||
bool ok_;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&ok_, %2);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(retval_, ok_);
|
||||
<insert-template name="tuple_retval_ok"/>
|
||||
</template>
|
||||
<template name="fix_bool*,arg,arg">
|
||||
bool ok_;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&ok_, %2, %3);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(retval_, ok_);
|
||||
<insert-template name="tuple_retval_ok"/>
|
||||
</template>
|
||||
<template name="fix_bool*,arg,arg,arg">
|
||||
bool ok_;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&ok_, %2, %3, %4);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(retval_, ok_);
|
||||
<insert-template name="tuple_retval_ok"/>
|
||||
</template>
|
||||
<template name="fix_bool*,arg,arg,arg,arg">
|
||||
bool ok_;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&ok_, %2, %3, %4, %5);
|
||||
%END_ALLOW_THREADS
|
||||
<insert-template name="tuple_retval_ok"/>
|
||||
</template>
|
||||
<template name="fix_arg,arg,arg,arg,arg,arg,arg,bool*,arg">
|
||||
bool ok_;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, %7, &ok_, %9);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(retval_, ok_);
|
||||
<insert-template name="tuple_retval_ok"/>
|
||||
</template>
|
||||
<template name="fix_arg,arg,arg,arg,arg,arg,bool*,arg">
|
||||
bool ok_;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, &ok_, %8);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(retval_, ok_);
|
||||
<insert-template name="tuple_retval_ok"/>
|
||||
</template>
|
||||
<template name="fix_arg,arg,arg,arg,arg,bool*,arg">
|
||||
bool ok_;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, &ok_, %7);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(retval_, ok_);
|
||||
<insert-template name="tuple_retval_ok"/>
|
||||
</template>
|
||||
<template name="get_slice">
|
||||
%TYPE* sequence;
|
||||
|
|
@ -136,27 +148,35 @@
|
|||
</template>
|
||||
|
||||
<template name="fix_char*">
|
||||
char val_;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&val_);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(retval_, val_);
|
||||
char val_;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&val_);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[char](val_));
|
||||
</template>
|
||||
|
||||
<template name="tuple_abcd_same_type">
|
||||
%PYARG_0 = PyTuple_New(4);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[$TYPE](a));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[$TYPE](b));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[$TYPE](c));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 3, %CONVERTTOPYTHON[$TYPE](d));
|
||||
</template>
|
||||
<template name="fix_number*,number*,number*,number*">
|
||||
$TYPE a, b, c, d;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%CPPSELF->::%TYPE::%FUNCTION_NAME(&a, &b, &c, &d);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(a, b, c, d);
|
||||
$TYPE a, b, c, d;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%CPPSELF->::%TYPE::%FUNCTION_NAME(&a, &b, &c, &d);
|
||||
%END_ALLOW_THREADS
|
||||
<insert-template name="tuple_abcd_same_type"/>
|
||||
</template>
|
||||
|
||||
<template name="fix_number*,number*,number*,number*,args">
|
||||
$TYPE a, b, c, d;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%CPPSELF->::%TYPE::%FUNCTION_NAME(&a, &b, &c, &d, %ARGUMENT_NAMES);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(a, b, c, d);
|
||||
$TYPE a, b, c, d;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%CPPSELF->::%TYPE::%FUNCTION_NAME(&a, &b, &c, &d, %ARGUMENT_NAMES);
|
||||
%END_ALLOW_THREADS
|
||||
<insert-template name="tuple_abcd_same_type"/>
|
||||
</template>
|
||||
|
||||
<template name="fix_native_return_number*,number*,number*,number*">
|
||||
|
|
@ -176,18 +196,19 @@
|
|||
}
|
||||
</template>
|
||||
|
||||
<template name="fix_int*,int*,int*,int*,int*">
|
||||
int a, b, c, d, e;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%CPPSELF.%FUNCTION_NAME(&a, &b, &c, &d, &e);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(a, b, c, d, e);
|
||||
</template>
|
||||
<template name="fix_qreal*,qreal*,qreal*,qreal*,qreal*">
|
||||
qreal a, b, c, d, e;
|
||||
%CPPSELF.%FUNCTION_NAME(&a, &b, &c, &d, &e);
|
||||
%PYARG_0 = Shiboken::makeTuple(a, b, c, d, e);
|
||||
<template name="fix_number*,number*,number*,number*,number*">
|
||||
$TYPE a, b, c, d, e;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%CPPSELF.%FUNCTION_NAME(&a, &b, &c, &d, &e);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = PyTuple_New(5);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[$TYPE](a));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[$TYPE](b));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[$TYPE](c));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 3, %CONVERTTOPYTHON[$TYPE](d));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 4, %CONVERTTOPYTHON[$TYPE](e));
|
||||
</template>
|
||||
|
||||
<template name="read_wrapper">
|
||||
Shiboken::AutoArrayPointer<char> _data(%2);
|
||||
qint64 _size = %CPPSELF.%FUNCTION_NAME(_data, %2);
|
||||
|
|
@ -196,21 +217,15 @@
|
|||
ba = QByteArray(_data, _size);
|
||||
%PYARG_0 = %CONVERTTOPYTHON[QByteArray](ba);
|
||||
</template>
|
||||
<template name="fix_return_args,int*">
|
||||
RETURNTYPE _ret;
|
||||
int _arg;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
_ret = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &_arg);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(_ret, _arg);
|
||||
</template>
|
||||
|
||||
<template name="fix_args,number*,number*">
|
||||
$TYPE a, b;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &a, &b);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(a, b);
|
||||
$TYPE a, b;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &a, &b);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[$TYPE](a));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[$TYPE](b));
|
||||
</template>
|
||||
|
||||
<template name="fix_virtual_method_return_value_and_bool*">
|
||||
|
|
@ -221,12 +236,15 @@
|
|||
</template>
|
||||
|
||||
<template name="fix_arg,int*,int*">
|
||||
%RETURN_TYPE _ret;
|
||||
int a, b;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
_ret = %CPPSELF.%FUNCTION_NAME(%1, &a, &b);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(_ret, a, b);
|
||||
%RETURN_TYPE _ret;
|
||||
int a, b;
|
||||
%BEGIN_ALLOW_THREADS
|
||||
_ret = %CPPSELF.%FUNCTION_NAME(%1, &a, &b);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = PyTuple_New(3);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](_ret));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[int](a));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[int](b));
|
||||
</template>
|
||||
|
||||
<template name="return_QString">
|
||||
|
|
@ -234,17 +252,22 @@
|
|||
</template>
|
||||
|
||||
<template name="return_tuple_QValidator_QString_int">
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE retval_ = %RETURN_TYPE(%CPPSELF.%FUNCTION_NAME(%1, %2));
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(retval_, %1, %2);
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE retval_ = %RETURN_TYPE(%CPPSELF.%FUNCTION_NAME(%1, %2));
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = PyTuple_New(3);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG1_TYPE](%1));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[%ARG2_TYPE](%2));
|
||||
</template>
|
||||
|
||||
<template name="return_for_QFileDialog">
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, &%5, %6);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = Shiboken::makeTuple(retval_, %5);
|
||||
%BEGIN_ALLOW_THREADS
|
||||
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, &%5, %6);
|
||||
%END_ALLOW_THREADS
|
||||
%PYARG_0 = PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_));
|
||||
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG5_TYPE](%5));
|
||||
</template>
|
||||
<template name="set_qapp_parent_for_orphan">
|
||||
if (%PYARG_0 && (%PYARG_0 != Py_None)) {
|
||||
|
|
@ -374,5 +397,32 @@
|
|||
%PYARG_0 = Py_BuildValue("%TT_FORMAT", %TT_ARGS);
|
||||
</template>
|
||||
|
||||
</typesystem>
|
||||
<template name="cpplist_to_pylist_convertion">
|
||||
PyObject* %out = PyList_New((int) %in.size());
|
||||
%INTYPE::const_iterator it = %in.begin();
|
||||
for (int idx = 0; it != %in.end(); ++it, ++idx) {
|
||||
%INTYPE_0 cppItem(*it);
|
||||
PyList_SET_ITEM(%out, idx, %CONVERTTOPYTHON[%INTYPE_0](cppItem));
|
||||
}
|
||||
return %out;
|
||||
</template>
|
||||
<template name="pyseq_to_cpplist_convertion">
|
||||
for (int i = 0; i < PySequence_Size(%in); i++) {
|
||||
Shiboken::AutoDecRef pyItem(PySequence_GetItem(%in, i));
|
||||
%OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem);
|
||||
%out << cppItem;
|
||||
}
|
||||
</template>
|
||||
|
||||
<template name="checkPyCapsuleOrPyCObject_func">
|
||||
static bool checkPyCapsuleOrPyCObject(PyObject* pyObj)
|
||||
{
|
||||
#ifdef IS_PY3K
|
||||
return PyCapsule_CheckExact(pyObj);
|
||||
#else
|
||||
return PyCObject_Check(pyObj);
|
||||
#endif
|
||||
}
|
||||
</template>
|
||||
|
||||
</typesystem>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ macro(create_pyside_module module_name module_include_dir module_libraries modul
|
|||
endif()
|
||||
|
||||
add_custom_command(OUTPUT ${${module_sources}}
|
||||
COMMAND ${GENERATORRUNNER_BINARY} ${GENERATOR_EXTRA_FLAGS}
|
||||
COMMAND ${SHIBOKEN_BINARY} ${GENERATOR_EXTRA_FLAGS}
|
||||
${pyside_BINARY_DIR}/pyside_global.h
|
||||
--include-paths=${pyside_SOURCE_DIR}${PATH_SEP}${QT_INCLUDE_DIR}
|
||||
--typesystem-paths=${pyside_SOURCE_DIR}${PATH_SEP}${${module_typesystem_path}}
|
||||
|
|
@ -39,7 +39,7 @@ macro(create_pyside_module module_name module_include_dir module_libraries modul
|
|||
set_target_properties(${module_name} PROPERTIES SUFFIX ".pyd")
|
||||
set(${module_name}_suffix ".pyd")
|
||||
else()
|
||||
set(${module_name}_suffix ".so")
|
||||
set(${module_name}_suffix ${CMAKE_SHARED_MODULE_SUFFIX})
|
||||
endif()
|
||||
target_link_libraries(${module_name} ${${module_libraries}})
|
||||
if(${module_deps})
|
||||
|
|
@ -71,7 +71,7 @@ macro(check_qt_class module class optional_source_files dropped_entries)
|
|||
endif ()
|
||||
string(TOLOWER ${class} _class)
|
||||
string(TOUPPER ${module} _module)
|
||||
if (${namespace})
|
||||
if (_namespace)
|
||||
set(_cppfile ${CMAKE_CURRENT_BINARY_DIR}/PySide/${module}/${_namespace}_${_class}_wrapper.cpp)
|
||||
else ()
|
||||
set(_cppfile ${CMAKE_CURRENT_BINARY_DIR}/PySide/${module}/${_class}_wrapper.cpp)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ configure_file("conf.py.in" "rst/conf.py" @ONLY)
|
|||
configure_file(typesystem_doc.xml.in typesystem_doc.xml @ONLY)
|
||||
|
||||
add_custom_target("docrsts"
|
||||
COMMAND ${GENERATORRUNNER_BINARY} --generator-set=qtdoc
|
||||
COMMAND ${SHIBOKEN_BINARY} --generator-set=qtdoc
|
||||
${pyside_BINARY_DIR}/pyside_global.h
|
||||
--include-paths="${QT_INCLUDE_DIR}${PATH_SEP}${pyside_SOURCE_DIR}"
|
||||
--api-version=${SUPPORTED_QT_VERSION}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,15 @@
|
|||
# PYSIDE_TYPESYSTEMS - Type system files that should be used by other bindings extending PySide
|
||||
|
||||
SET(PYSIDE_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include/PySide@pyside_SUFFIX@")
|
||||
SET(PYSIDE_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@pyside@pyside_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@@SHIBOKEN_PYTHON_SUFFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@")
|
||||
# Platform specific library names
|
||||
if(MSVC)
|
||||
SET(PYSIDE_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@pyside@pyside_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@@SHIBOKEN_PYTHON_SUFFIX@.lib")
|
||||
elseif(CYGWIN)
|
||||
SET(PYSIDE_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@pyside@pyside_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@@SHIBOKEN_PYTHON_SUFFIX@@CMAKE_IMPORT_LIBRARY_SUFFIX@")
|
||||
elseif(WIN32)
|
||||
SET(PYSIDE_LIBRARY "@CMAKE_INSTALL_PREFIX@/bin/@CMAKE_SHARED_LIBRARY_PREFIX@pyside@pyside_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@@SHIBOKEN_PYTHON_SUFFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@")
|
||||
else()
|
||||
SET(PYSIDE_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@pyside@pyside_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@@SHIBOKEN_PYTHON_SUFFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@")
|
||||
endif()
|
||||
SET(PYSIDE_PYTHONPATH "@SITE_PACKAGE@")
|
||||
SET(PYSIDE_TYPESYSTEMS "@CMAKE_INSTALL_PREFIX@/share/PySide@pyside_SUFFIX@/typesystems")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
if (NOT PYTHON_BASENAME)
|
||||
message(STATUS "Using default python: @PYTHON_BASENAME@")
|
||||
SET(PYTHON_BASENAME @PYTHON_BASENAME@)
|
||||
message(STATUS "Using default python: @SHIBOKEN_PYTHON_SUFFIX@")
|
||||
SET(PYTHON_BASENAME @SHIBOKEN_PYTHON_SUFFIX@)
|
||||
endif()
|
||||
include(@LIB_INSTALL_DIR@/cmake/PySide-@BINDING_API_VERSION@/PySideConfig${SHIBOKEN_PYTHON_SUFFIX}.cmake)
|
||||
include(@LIB_INSTALL_DIR@/cmake/PySide-@BINDING_API_VERSION@/PySideConfig${PYTHON_BASENAME}.cmake)
|
||||
|
|
|
|||
|
|
@ -456,7 +456,7 @@ void DynamicQMetaObject::DynamicQMetaObjectPrivate::writeMethodsData(const QList
|
|||
(*data)[index++] = m_emptyMethod; // func name
|
||||
|
||||
(*data)[index++] = nullIndex; // arguments
|
||||
(*data)[index++] = (it->type().size() > 0 ? registerString(it->type(), strings) : nullIndex); // normalized type
|
||||
(*data)[index++] = !it->type().isEmpty() ? registerString(it->type(), strings) : nullIndex; // normalized type
|
||||
(*data)[index++] = nullIndex; // tags
|
||||
(*data)[index++] = flags | (it->methodType() == QMetaMethod::Signal ? MethodSignal : MethodSlot);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include <QEvent>
|
||||
#include <QLinkedList>
|
||||
#include <autodecref.h>
|
||||
#include <sbkconverter.h>
|
||||
#include <gilstate.h>
|
||||
|
||||
#include "typeresolver.h"
|
||||
|
|
@ -293,8 +294,9 @@ int GlobalReceiver::qt_metacall(QMetaObject::Call call, int id, void** args)
|
|||
QList<QByteArray> paramTypes = slot.parameterTypes();
|
||||
Shiboken::AutoDecRef preparedArgs(PyTuple_New(paramTypes.count()));
|
||||
for (int i = 0, max = paramTypes.count(); i < max; ++i) {
|
||||
PyObject* arg = Shiboken::TypeResolver::get(paramTypes[i].constData())->toPython(args[i+1]); // Do not increment the reference
|
||||
PyTuple_SET_ITEM(preparedArgs.object(), i, arg);
|
||||
const QByteArray& paramType = paramTypes[i];
|
||||
Shiboken::Conversions::SpecificConverter converter(paramType.constData());
|
||||
PyTuple_SET_ITEM(preparedArgs.object(), i, converter.toPython(args[i+1]));
|
||||
}
|
||||
retval = data->call(preparedArgs);
|
||||
}
|
||||
|
|
@ -306,4 +308,3 @@ int GlobalReceiver::qt_metacall(QMetaObject::Call call, int id, void** args)
|
|||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ QByteArray DynamicSlotDataV2::hash(PyObject* callback)
|
|||
{
|
||||
Shiboken::GilState gil;
|
||||
if (PyMethod_Check(callback))
|
||||
return QByteArray::number((qlonglong)PyObject_Hash(PyMethod_GET_FUNCTION(callback)))
|
||||
return QByteArray::number((qlonglong)PyObject_Hash(PyMethod_GET_FUNCTION(callback)))
|
||||
+ QByteArray::number((qlonglong)PyObject_Hash(PyMethod_GET_SELF(callback)));
|
||||
else
|
||||
return QByteArray::number((qlonglong)PyObject_Hash(callback));
|
||||
|
|
|
|||
|
|
@ -35,9 +35,11 @@
|
|||
|
||||
#include <basewrapper.h>
|
||||
#include <conversions.h>
|
||||
#include <sbkconverter.h>
|
||||
#include <typeresolver.h>
|
||||
#include <bindingmanager.h>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <cctype>
|
||||
#include <QStack>
|
||||
#include <QCoreApplication>
|
||||
|
|
@ -140,7 +142,7 @@ void destroyQCoreApplication()
|
|||
|
||||
Shiboken::BindingManager& bm = Shiboken::BindingManager::instance();
|
||||
SbkObject* pyQApp = bm.retrieveWrapper(app);
|
||||
PyTypeObject* pyQObjectType = Shiboken::TypeResolver::get("QObject*")->pythonType();
|
||||
PyTypeObject* pyQObjectType = Shiboken::Conversions::getPythonTypeObject("QObject*");
|
||||
assert(pyQObjectType);
|
||||
|
||||
void* data[2] = {pyQApp, pyQObjectType};
|
||||
|
|
@ -173,7 +175,10 @@ void initDynamicMetaObject(SbkObjectType* type, const QMetaObject* base, const s
|
|||
|
||||
//initialize staticQMetaObject property
|
||||
void* metaObjectPtr = &userData->mo;
|
||||
Shiboken::AutoDecRef pyMetaObject(Shiboken::TypeResolver::get("QMetaObject*")->toPython(&metaObjectPtr));
|
||||
static SbkConverter* converter = Shiboken::Conversions::getConverter("QMetaObject");
|
||||
if (!converter)
|
||||
return;
|
||||
Shiboken::AutoDecRef pyMetaObject(Shiboken::Conversions::pointerToPython(converter, metaObjectPtr));
|
||||
PyObject_SetAttrString(reinterpret_cast<PyObject*>(type), "staticMetaObject", pyMetaObject);
|
||||
}
|
||||
|
||||
|
|
@ -184,7 +189,7 @@ void initDynamicMetaObject(SbkObjectType* type, const QMetaObject* base)
|
|||
|
||||
void initQObjectSubType(SbkObjectType* type, PyObject* args, PyObject* kwds)
|
||||
{
|
||||
PyTypeObject* qObjType = Shiboken::TypeResolver::get("QObject*")->pythonType();
|
||||
PyTypeObject* qObjType = Shiboken::Conversions::getPythonTypeObject("QObject*");
|
||||
QByteArray className(Shiboken::String::toCString(PyTuple_GET_ITEM(args, 0)));
|
||||
|
||||
PyObject* bases = PyTuple_GET_ITEM(args, 1);
|
||||
|
|
@ -233,30 +238,34 @@ PyObject* getMetaDataFromQObject(QObject* cppSelf, PyObject* self, PyObject* nam
|
|||
}
|
||||
|
||||
//search on metaobject (avoid internal attributes started with '__')
|
||||
if (!attr && !QString(Shiboken::String::toCString(name)).startsWith("__")) {
|
||||
const QMetaObject* metaObject = cppSelf->metaObject();
|
||||
QByteArray cname(Shiboken::String::toCString(name));
|
||||
cname += '(';
|
||||
//signal
|
||||
QList<QMetaMethod> signalList;
|
||||
for(int i=0, i_max = metaObject->methodCount(); i < i_max; i++) {
|
||||
QMetaMethod method = metaObject->method(i);
|
||||
if (QString(method.signature()).startsWith(cname)) {
|
||||
if (method.methodType() == QMetaMethod::Signal) {
|
||||
signalList.append(method);
|
||||
} else {
|
||||
PySideMetaFunction* func = MetaFunction::newObject(cppSelf, i);
|
||||
if (func) {
|
||||
PyObject_SetAttr(self, name, (PyObject*)func);
|
||||
return (PyObject*)func;
|
||||
if (!attr) {
|
||||
const char* cname = Shiboken::String::toCString(name);
|
||||
uint cnameLen = qstrlen(cname);
|
||||
if (std::strncmp("__", cname, 2)) {
|
||||
const QMetaObject* metaObject = cppSelf->metaObject();
|
||||
//signal
|
||||
QList<QMetaMethod> signalList;
|
||||
for(int i=0, i_max = metaObject->methodCount(); i < i_max; i++) {
|
||||
QMetaMethod method = metaObject->method(i);
|
||||
const char* methSig = method.signature();
|
||||
bool methMacth = !std::strncmp(cname, methSig, cnameLen) && methSig[cnameLen] == '(';
|
||||
if (methMacth) {
|
||||
if (method.methodType() == QMetaMethod::Signal) {
|
||||
signalList.append(method);
|
||||
} else {
|
||||
PySideMetaFunction* func = MetaFunction::newObject(cppSelf, i);
|
||||
if (func) {
|
||||
PyObject_SetAttr(self, name, (PyObject*)func);
|
||||
return (PyObject*)func;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (signalList.size() > 0) {
|
||||
PyObject* pySignal = reinterpret_cast<PyObject*>(Signal::newObjectFromMethod(self, signalList));
|
||||
PyObject_SetAttr(self, name, pySignal);
|
||||
return pySignal;
|
||||
if (signalList.size() > 0) {
|
||||
PyObject* pySignal = reinterpret_cast<PyObject*>(Signal::newObjectFromMethod(self, signalList));
|
||||
PyObject_SetAttr(self, name, pySignal);
|
||||
return pySignal;
|
||||
}
|
||||
}
|
||||
}
|
||||
return attr;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#ifndef PYSIDEMACROS_H
|
||||
#define PYSIDEMACROS_H
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined _WIN32
|
||||
#if PYSIDE_EXPORTS
|
||||
#define PYSIDE_API __declspec(dllexport)
|
||||
#else
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
#define PYSIDE_DEPRECATED(func) func __attribute__ ((deprecated))
|
||||
#else
|
||||
#define PYSIDE_API
|
||||
#define DEPRECATED(func) func
|
||||
#define PYSIDE_DEPRECATED(func) func
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
#include <sbkpython.h>
|
||||
#include "pysidemetafunction.h"
|
||||
#include "pysidemetafunction_p.h"
|
||||
|
||||
#include <shiboken.h>
|
||||
#include <QObject>
|
||||
|
|
@ -33,7 +34,7 @@ extern "C"
|
|||
struct PySideMetaFunctionPrivate
|
||||
{
|
||||
QObject* qobject;
|
||||
QMetaMethod method;
|
||||
int methodIndex;
|
||||
};
|
||||
|
||||
//methods
|
||||
|
|
@ -97,31 +98,12 @@ void functionFree(void *self)
|
|||
|
||||
PyObject* functionCall(PyObject* self, PyObject* args, PyObject* kw)
|
||||
{
|
||||
static Shiboken::TypeResolver* typeResolver = Shiboken::TypeResolver::get("QVariant");
|
||||
Q_ASSERT(typeResolver);
|
||||
|
||||
QGenericArgument gArgs[10];
|
||||
QVariant vArgs[10];
|
||||
PySideMetaFunction* function = reinterpret_cast<PySideMetaFunction*>(self);
|
||||
QMetaMethod method = function->d->method;
|
||||
int argsGiven = method.parameterTypes().size();
|
||||
|
||||
for (int i = 0; i < argsGiven; ++i) {
|
||||
Shiboken::AutoDecRef pyArg(PySequence_GetItem(args, i));
|
||||
gArgs[i] = Q_ARG(QVariant, vArgs[i]);
|
||||
void* v[1] = { &vArgs[i] };
|
||||
typeResolver->toCpp(pyArg, v);
|
||||
}
|
||||
|
||||
QVariant retVariant;
|
||||
QGenericReturnArgument returnValue = Q_RETURN_ARG(QVariant, retVariant);
|
||||
method.invoke(function->d->qobject, returnValue, gArgs[0], gArgs[1], gArgs[2], gArgs[3], gArgs[4], gArgs[5], gArgs[6], gArgs[7], gArgs[8], gArgs[9]);
|
||||
|
||||
|
||||
if (retVariant.isValid())
|
||||
return typeResolver->toPython(&retVariant);
|
||||
|
||||
Py_RETURN_NONE;
|
||||
PyObject* retVal;
|
||||
if (!PySide::MetaFunction::call(function->d->qobject, function->d->methodIndex, args, &retVal))
|
||||
return 0;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
|
@ -147,12 +129,97 @@ PySideMetaFunction* newObject(QObject* source, int methodIndex)
|
|||
PySideMetaFunction* function = PyObject_New(PySideMetaFunction, &PySideMetaFunctionType);
|
||||
function->d = new PySideMetaFunctionPrivate();
|
||||
function->d->qobject = source;
|
||||
function->d->method = method;
|
||||
function->d->methodIndex = methodIndex;
|
||||
return function;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool call(QObject* self, int methodIndex, PyObject* args, PyObject** retVal)
|
||||
{
|
||||
|
||||
QMetaMethod method = self->metaObject()->method(methodIndex);
|
||||
QList<QByteArray> argTypes = method.parameterTypes();
|
||||
|
||||
// args given plus return type
|
||||
Shiboken::AutoDecRef sequence(PySequence_Fast(args, 0));
|
||||
int numArgs = PySequence_Fast_GET_SIZE(sequence.object()) + 1;
|
||||
|
||||
if (numArgs - 1 != argTypes.count()) {
|
||||
PyErr_Format(PyExc_TypeError, "%s only accepts %d arguments, %d given!", method.signature(), argTypes.count(), numArgs);
|
||||
return false;
|
||||
}
|
||||
|
||||
QVariant* methValues = new QVariant[numArgs];
|
||||
void** methArgs = new void*[numArgs];
|
||||
|
||||
// Prepare room for return type
|
||||
const char* returnType = method.typeName();
|
||||
if (returnType)
|
||||
argTypes.prepend(returnType);
|
||||
else
|
||||
argTypes.prepend(QByteArray());
|
||||
|
||||
int i;
|
||||
for (i = 0; i < numArgs; ++i) {
|
||||
const QByteArray& typeName = argTypes[i];
|
||||
// This must happen only when the method hasn't return type.
|
||||
if (typeName.isEmpty()) {
|
||||
methArgs[i] = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
Shiboken::Conversions::SpecificConverter converter(typeName);
|
||||
if (converter) {
|
||||
int typeId = QMetaType::type(typeName);
|
||||
if (!Shiboken::Conversions::pythonTypeIsObjectType(converter)) {
|
||||
if (!typeId) {
|
||||
PyErr_Format(PyExc_TypeError, "Value types used on meta functions (including signals) need to be "
|
||||
"registered on meta type: %s", typeName.data());
|
||||
break;
|
||||
}
|
||||
methValues[i] = QVariant(typeId, (void*) 0);
|
||||
}
|
||||
methArgs[i] = methValues[i].data();
|
||||
if (i == 0) // Don't do this for return type
|
||||
continue;
|
||||
if (typeId == QVariant::String) {
|
||||
QString tmp;
|
||||
converter.toCpp(PySequence_Fast_GET_ITEM(sequence.object(), i - 1), &tmp);
|
||||
methValues[i] = tmp;
|
||||
} else {
|
||||
converter.toCpp(PySequence_Fast_GET_ITEM(sequence.object(), i - 1), methArgs[i]);
|
||||
}
|
||||
} else {
|
||||
PyErr_Format(PyExc_TypeError, "Unknown type used to call meta function (that may be a signal): %s", argTypes[i].constData());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool ok = i == numArgs;
|
||||
if (ok) {
|
||||
QMetaObject::metacall(self, QMetaObject::InvokeMetaMethod, method.methodIndex(), methArgs);
|
||||
|
||||
if (retVal) {
|
||||
if (methArgs[0]) {
|
||||
static SbkConverter* qVariantTypeConverter = Shiboken::Conversions::getConverter("QVariant");
|
||||
Q_ASSERT(qVariantTypeConverter);
|
||||
*retVal = Shiboken::Conversions::copyToPython(qVariantTypeConverter, &methValues[0]);
|
||||
SbkDbg() << (*retVal);
|
||||
} else {
|
||||
*retVal = Py_None;
|
||||
Py_INCREF(*retVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete[] methArgs;
|
||||
delete[] methValues;
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
} //namespace MetaFunction
|
||||
} //namespace PySide
|
||||
|
||||
|
|
|
|||
|
|
@ -24,10 +24,18 @@
|
|||
#define PYSIDE_METAFUNCTION_P_H
|
||||
|
||||
#include <sbkpython.h>
|
||||
#include <QList>
|
||||
#include <QByteArray>
|
||||
|
||||
class QObject;
|
||||
|
||||
namespace PySide { namespace MetaFunction {
|
||||
|
||||
void init(PyObject* module);
|
||||
void init(PyObject* module);
|
||||
/**
|
||||
* Does a Qt metacall on a QObject
|
||||
*/
|
||||
bool call(QObject* self, int methodIndex, PyObject* args, PyObject** retVal = 0);
|
||||
|
||||
} //namespace MetaFunction
|
||||
} //namespace PySide
|
||||
|
|
|
|||
|
|
@ -38,12 +38,14 @@ extern "C"
|
|||
|
||||
static PyObject* qpropertyTpNew(PyTypeObject* subtype, PyObject* args, PyObject* kwds);
|
||||
static int qpropertyTpInit(PyObject*, PyObject*, PyObject*);
|
||||
static void qpropertyFree(void*);
|
||||
static void qpropertyDeAlloc(PyObject* self);
|
||||
|
||||
//methods
|
||||
static PyObject* qPropertyCall(PyObject*, PyObject*, PyObject*);
|
||||
static PyObject* qPropertySetter(PyObject*, PyObject*);
|
||||
static PyObject* qPropertyGetter(PyObject*, PyObject*);
|
||||
static int qpropertyTraverse(PyObject* self, visitproc visit, void* arg);
|
||||
static int qpropertyClear(PyObject* self);
|
||||
|
||||
static PyMethodDef PySidePropertyMethods[] = {
|
||||
{"setter", (PyCFunction)qPropertySetter, METH_O},
|
||||
|
|
@ -58,7 +60,7 @@ PyTypeObject PySidePropertyType = {
|
|||
QPROPERTY_CLASS_NAME, /*tp_name*/
|
||||
sizeof(PySideProperty), /*tp_basicsize*/
|
||||
0, /*tp_itemsize*/
|
||||
0, /*tp_dealloc*/
|
||||
qpropertyDeAlloc, /*tp_dealloc*/
|
||||
0, /*tp_print*/
|
||||
0, /*tp_getattr*/
|
||||
0, /*tp_setattr*/
|
||||
|
|
@ -73,10 +75,10 @@ PyTypeObject PySidePropertyType = {
|
|||
0, /*tp_getattro*/
|
||||
0, /*tp_setattro*/
|
||||
0, /*tp_as_buffer*/
|
||||
Py_TPFLAGS_DEFAULT, /*tp_flags*/
|
||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
|
||||
0, /*tp_doc */
|
||||
0, /*tp_traverse */
|
||||
0, /*tp_clear */
|
||||
qpropertyTraverse, /*tp_traverse */
|
||||
qpropertyClear, /*tp_clear */
|
||||
0, /*tp_richcompare */
|
||||
0, /*tp_weaklistoffset */
|
||||
0, /*tp_iter */
|
||||
|
|
@ -92,7 +94,7 @@ PyTypeObject PySidePropertyType = {
|
|||
qpropertyTpInit, /*tp_init */
|
||||
0, /*tp_alloc */
|
||||
qpropertyTpNew, /*tp_new */
|
||||
qpropertyFree, /*tp_free */
|
||||
0, /*tp_free */
|
||||
0, /*tp_is_gc */
|
||||
0, /*tp_bases */
|
||||
0, /*tp_mro */
|
||||
|
|
@ -104,8 +106,10 @@ PyTypeObject PySidePropertyType = {
|
|||
|
||||
static void qpropertyMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::Call call, void** args)
|
||||
{
|
||||
Shiboken::TypeResolver* typeResolver = Shiboken::TypeResolver::get(pp->d->typeName);
|
||||
Q_ASSERT(typeResolver);
|
||||
Shiboken::Conversions::SpecificConverter converter(pp->d->typeName);
|
||||
Q_ASSERT(converter);
|
||||
|
||||
QByteArray type(pp->d->typeName);
|
||||
|
||||
switch(call) {
|
||||
case QMetaObject::ReadProperty:
|
||||
|
|
@ -113,7 +117,7 @@ static void qpropertyMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::C
|
|||
Shiboken::GilState gil;
|
||||
PyObject* value = PySide::Property::getValue(pp, self);
|
||||
if (value) {
|
||||
typeResolver->toCpp(value, &args[0]);
|
||||
converter.toCpp(value, args[0]);
|
||||
Py_DECREF(value);
|
||||
} else if (PyErr_Occurred()) {
|
||||
PyErr_Print(); // Clear any errors but print them to stderr
|
||||
|
|
@ -124,7 +128,7 @@ static void qpropertyMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::C
|
|||
case QMetaObject::WriteProperty:
|
||||
{
|
||||
Shiboken::GilState gil;
|
||||
Shiboken::AutoDecRef value(typeResolver->toPython(args[0]));
|
||||
Shiboken::AutoDecRef value(converter.toPython(args[0]));
|
||||
PySide::Property::setValue(pp, self, value);
|
||||
break;
|
||||
}
|
||||
|
|
@ -206,23 +210,10 @@ int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds)
|
|||
}
|
||||
}
|
||||
|
||||
void qpropertyFree(void *self)
|
||||
void qpropertyDeAlloc(PyObject* self)
|
||||
{
|
||||
PyObject *pySelf = reinterpret_cast<PyObject*>(self);
|
||||
PySideProperty *data = reinterpret_cast<PySideProperty*>(self);
|
||||
PySidePropertyPrivate* pData = data->d;
|
||||
|
||||
Py_XDECREF(pData->fget);
|
||||
Py_XDECREF(pData->fset);
|
||||
Py_XDECREF(pData->freset);
|
||||
Py_XDECREF(pData->fdel);
|
||||
Py_XDECREF(pData->notify);
|
||||
|
||||
free(pData->typeName);
|
||||
free(pData->doc);
|
||||
free(pData->notifySignature);
|
||||
delete data->d;
|
||||
pySelf->ob_type->tp_base->tp_free(self);
|
||||
qpropertyClear(self);
|
||||
Py_TYPE(self)->tp_free(self);
|
||||
}
|
||||
|
||||
PyObject* qPropertyCall(PyObject* self, PyObject* args, PyObject* kw)
|
||||
|
|
@ -277,6 +268,41 @@ PyObject* qPropertyGetter(PyObject* self, PyObject* callback)
|
|||
}
|
||||
}
|
||||
|
||||
static int qpropertyTraverse(PyObject* self, visitproc visit, void* arg)
|
||||
{
|
||||
PySidePropertyPrivate* data = reinterpret_cast<PySideProperty*>(self)->d;
|
||||
if (!data)
|
||||
return 0;
|
||||
|
||||
Py_VISIT(data->fget);
|
||||
Py_VISIT(data->fset);
|
||||
Py_VISIT(data->freset);
|
||||
Py_VISIT(data->fdel);
|
||||
Py_VISIT(data->notify);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qpropertyClear(PyObject* self)
|
||||
{
|
||||
PySidePropertyPrivate* data = reinterpret_cast<PySideProperty*>(self)->d;
|
||||
if (!data)
|
||||
return 0;
|
||||
|
||||
Py_CLEAR(data->fget);
|
||||
Py_CLEAR(data->fset);
|
||||
Py_CLEAR(data->freset);
|
||||
Py_CLEAR(data->fdel);
|
||||
Py_CLEAR(data->notify);
|
||||
|
||||
|
||||
free(data->typeName);
|
||||
free(data->doc);
|
||||
free(data->notifySignature);
|
||||
delete data;
|
||||
reinterpret_cast<PySideProperty*>(self)->d = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
namespace {
|
||||
|
|
|
|||
|
|
@ -21,26 +21,51 @@
|
|||
*/
|
||||
|
||||
#include "pysideqflags.h"
|
||||
#include <sbkenum.h>
|
||||
#include <autodecref.h>
|
||||
|
||||
extern "C" {
|
||||
struct SbkConverter;
|
||||
|
||||
/**
|
||||
* Type of all QFlags
|
||||
*/
|
||||
struct PySideQFlagsType
|
||||
{
|
||||
PyHeapTypeObject super;
|
||||
SbkConverter** converterPtr;
|
||||
SbkConverter* converter;
|
||||
};
|
||||
|
||||
#define PYSIDE_QFLAGS(X) reinterpret_cast<PySideQFlagsObject*>(X)
|
||||
|
||||
PyObject* PySideQFlagsNew(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||
PyObject* PySideQFlagsNew(PyTypeObject* type, PyObject* args, PyObject* kwds)
|
||||
{
|
||||
long val = 0;
|
||||
if (PyTuple_GET_SIZE(args)) {
|
||||
PyObject* arg = PyTuple_GET_ITEM(args, 0);
|
||||
if (Shiboken::isShibokenEnum(arg)) {// faster call
|
||||
val = Shiboken::Enum::getValue(arg);
|
||||
} else if (PyNumber_Check(arg)) {
|
||||
Shiboken::AutoDecRef number(PyNumber_Long(arg));
|
||||
val = PyLong_AsLong(number);
|
||||
} else {
|
||||
PyErr_SetString(PyExc_TypeError,"QFlags must be created using enums or numbers.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
PySideQFlagsObject* self = PyObject_New(PySideQFlagsObject, type);
|
||||
self->ob_value = 0;
|
||||
self->ob_value = val;
|
||||
return reinterpret_cast<PyObject*>(self);
|
||||
}
|
||||
|
||||
static long getNumberValue(PyObject* v)
|
||||
{
|
||||
PyObject* number = PyNumber_Long(v);
|
||||
long result = PyLong_AsLong(number);
|
||||
Py_XDECREF(number);
|
||||
return result;
|
||||
Shiboken::AutoDecRef number(PyNumber_Long(v));
|
||||
return PyLong_AsLong(number);
|
||||
}
|
||||
|
||||
PyObject* PySideQFlagsRichCompare(PyObject *self, PyObject *other, int op)
|
||||
PyObject* PySideQFlagsRichCompare(PyObject* self, PyObject* other, int op)
|
||||
{
|
||||
int result = 0;
|
||||
if (!PyNumber_Check(other)) {
|
||||
|
|
@ -89,6 +114,27 @@ namespace PySide
|
|||
{
|
||||
namespace QFlags
|
||||
{
|
||||
PyTypeObject* create(const char* name, PyNumberMethods* numberMethods)
|
||||
{
|
||||
PyTypeObject* type = reinterpret_cast<PyTypeObject*>(new PySideQFlagsType);
|
||||
::memset(type, 0, sizeof(PySideQFlagsType));
|
||||
Py_TYPE(type) = &PyType_Type;
|
||||
type->tp_basicsize = sizeof(PySideQFlagsObject);
|
||||
type->tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES;
|
||||
type->tp_name = name;
|
||||
type->tp_new = &PySideQFlagsNew;
|
||||
type->tp_as_number = numberMethods;
|
||||
type->tp_richcompare = &PySideQFlagsRichCompare;
|
||||
|
||||
PySideQFlagsType* flagsType = reinterpret_cast<PySideQFlagsType*>(type);
|
||||
flagsType->converterPtr = &flagsType->converter;
|
||||
|
||||
if (PyType_Ready(type) < 0)
|
||||
return 0;
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
PySideQFlagsObject* newObject(long value, PyTypeObject* type)
|
||||
{
|
||||
PySideQFlagsObject* qflags = PyObject_New(PySideQFlagsObject, type);
|
||||
|
|
@ -102,4 +148,3 @@ namespace QFlags
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@
|
|||
#define PYSIDE_QFLAGS_H
|
||||
|
||||
#include <sbkpython.h>
|
||||
#include <pysidemacros.h>
|
||||
#include "pysidemacros.h"
|
||||
|
||||
|
||||
extern "C"
|
||||
extern "C"
|
||||
{
|
||||
struct PYSIDE_API PySideQFlagsObject {
|
||||
PyObject_HEAD
|
||||
|
|
@ -43,7 +43,17 @@ namespace PySide
|
|||
{
|
||||
namespace QFlags
|
||||
{
|
||||
/**
|
||||
* Creates a new QFlags type.
|
||||
*/
|
||||
PYSIDE_API PyTypeObject* create(const char* name, PyNumberMethods* numberMethods);
|
||||
/**
|
||||
* Creates a new QFlags instance of type \p type and value \p value.
|
||||
*/
|
||||
PYSIDE_API PySideQFlagsObject* newObject(long value, PyTypeObject* type);
|
||||
/**
|
||||
* Returns the value held by a QFlag.
|
||||
*/
|
||||
PYSIDE_API long getValue(PySideQFlagsObject* self);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <sbkpython.h>
|
||||
#include "pysidesignal.h"
|
||||
#include "pysidesignal_p.h"
|
||||
|
|
@ -31,12 +32,12 @@
|
|||
#define SIGNAL_INSTANCE_NAME "SignalInstance"
|
||||
#define QT_SIGNAL_SENTINEL '2'
|
||||
|
||||
|
||||
namespace PySide { namespace Signal {
|
||||
namespace PySide {
|
||||
namespace Signal {
|
||||
//aux
|
||||
static char* buildSignature(const char*, const char*);
|
||||
static void appendSignature(PySideSignal*, char*);
|
||||
static void instanceInitialize(PySideSignalInstance*, PyObject*, PySideSignal*, PyObject *, int);
|
||||
static void instanceInitialize(PySideSignalInstance*, PyObject*, PySideSignal*, PyObject*, int);
|
||||
static char* parseSignature(PyObject*);
|
||||
static PyObject* buildQtCompatible(const char*);
|
||||
}
|
||||
|
|
@ -45,14 +46,14 @@ namespace PySide { namespace Signal {
|
|||
extern "C"
|
||||
{
|
||||
|
||||
//Signal methods
|
||||
// Signal methods
|
||||
static int signalTpInit(PyObject*, PyObject*, PyObject*);
|
||||
static void signalFree(void*);
|
||||
static void signalInstanceFree(void*);
|
||||
static PyObject* signalGetItem(PyObject* self, PyObject* key);
|
||||
static PyObject* signalToString(PyObject* self);
|
||||
|
||||
//Signal Instance methods
|
||||
// Signal Instance methods
|
||||
static PyObject* signalInstanceConnect(PyObject*, PyObject*, PyObject*);
|
||||
static PyObject* signalInstanceDisconnect(PyObject*, PyObject*);
|
||||
static PyObject* signalInstanceEmit(PyObject*, PyObject*);
|
||||
|
|
@ -221,25 +222,25 @@ PyTypeObject PySideSignalInstanceType = {
|
|||
|
||||
int signalTpInit(PyObject* self, PyObject* args, PyObject* kwds)
|
||||
{
|
||||
static PyObject *emptyTuple = 0;
|
||||
static const char *kwlist[] = {"name", 0};
|
||||
static PyObject* emptyTuple = 0;
|
||||
static const char* kwlist[] = {"name", 0};
|
||||
char* argName = 0;
|
||||
|
||||
if (emptyTuple == 0)
|
||||
emptyTuple = PyTuple_New(0);
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(emptyTuple, kwds,
|
||||
"|s:QtCore."SIGNAL_CLASS_NAME, (char**) kwlist, &argName))
|
||||
"|s:QtCore."SIGNAL_CLASS_NAME, const_cast<char**>(kwlist), &argName))
|
||||
return 0;
|
||||
|
||||
bool tupledArgs = false;
|
||||
PySideSignal *data = reinterpret_cast<PySideSignal*>(self);
|
||||
PySideSignal* data = reinterpret_cast<PySideSignal*>(self);
|
||||
if (argName) {
|
||||
data->signalName = strdup(argName);
|
||||
}
|
||||
|
||||
for(Py_ssize_t i = 0, i_max = PyTuple_Size(args); i < i_max; i++) {
|
||||
PyObject *arg = PyTuple_GET_ITEM(args, i);
|
||||
for (Py_ssize_t i = 0, i_max = PyTuple_Size(args); i < i_max; i++) {
|
||||
PyObject* arg = PyTuple_GET_ITEM(args, i);
|
||||
if (PySequence_Check(arg) && !Shiboken::String::check(arg)) {
|
||||
tupledArgs = true;
|
||||
PySide::Signal::appendSignature(data, PySide::Signal::parseSignature(arg));
|
||||
|
|
@ -252,12 +253,12 @@ int signalTpInit(PyObject* self, PyObject* args, PyObject* kwds)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void signalFree(void *self)
|
||||
void signalFree(void* self)
|
||||
{
|
||||
PyObject *pySelf = reinterpret_cast<PyObject*>(self);
|
||||
PySideSignal *data = reinterpret_cast<PySideSignal*>(self);
|
||||
PyObject* pySelf = reinterpret_cast<PyObject*>(self);
|
||||
PySideSignal* data = reinterpret_cast<PySideSignal*>(self);
|
||||
|
||||
for(int i = 0, i_max = data->signaturesSize; i < i_max; i++) {
|
||||
for (int i = 0, i_max = data->signaturesSize; i < i_max; i++) {
|
||||
if (data->signatures[i])
|
||||
free(data->signatures[i]);
|
||||
}
|
||||
|
|
@ -319,26 +320,26 @@ void signalInstanceFree(void* self)
|
|||
|
||||
PyObject* signalInstanceConnect(PyObject* self, PyObject* args, PyObject* kwds)
|
||||
{
|
||||
PyObject *slot = 0;
|
||||
PyObject *type = 0;
|
||||
static const char *kwlist[] = {"slot", "type", 0};
|
||||
PyObject* slot = 0;
|
||||
PyObject* type = 0;
|
||||
static const char* kwlist[] = {"slot", "type", 0};
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds,
|
||||
"O|O:"SIGNAL_INSTANCE_NAME, (char**) kwlist, &slot, &type))
|
||||
"O|O:"SIGNAL_INSTANCE_NAME, const_cast<char**>(kwlist), &slot, &type))
|
||||
return 0;
|
||||
|
||||
PySideSignalInstance *source = reinterpret_cast<PySideSignalInstance*>(self);
|
||||
PySideSignalInstance* source = reinterpret_cast<PySideSignalInstance*>(self);
|
||||
Shiboken::AutoDecRef pyArgs(PyList_New(0));
|
||||
|
||||
bool match = false;
|
||||
if (slot->ob_type == &PySideSignalInstanceType) {
|
||||
PySideSignalInstance *sourceWalk = source;
|
||||
PySideSignalInstance *targetWalk;
|
||||
PySideSignalInstance* sourceWalk = source;
|
||||
PySideSignalInstance* targetWalk;
|
||||
|
||||
//find best match
|
||||
while(sourceWalk && !match) {
|
||||
while (sourceWalk && !match) {
|
||||
targetWalk = reinterpret_cast<PySideSignalInstance*>(slot);
|
||||
while(targetWalk && !match) {
|
||||
while (targetWalk && !match) {
|
||||
if (QMetaObject::checkConnectArgs(sourceWalk->d->signature, targetWalk->d->signature)) {
|
||||
PyList_Append(pyArgs, sourceWalk->d->source);
|
||||
Shiboken::AutoDecRef sourceSignature(PySide::Signal::buildQtCompatible(sourceWalk->d->signature));
|
||||
|
|
@ -377,19 +378,19 @@ PyObject* signalInstanceConnect(PyObject* self, PyObject* args, PyObject* kwds)
|
|||
Py_XDECREF(result);
|
||||
}
|
||||
if (!PyErr_Occurred())
|
||||
PyErr_Format(PyExc_RuntimeError, "Fail to connect signal %s.", source->d->signature);
|
||||
PyErr_Format(PyExc_RuntimeError, "Failed to connect signal %s.", source->d->signature);
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyObject* signalInstanceEmit(PyObject* self, PyObject* args)
|
||||
{
|
||||
PySideSignalInstance *source = reinterpret_cast<PySideSignalInstance*>(self);
|
||||
PySideSignalInstance* source = reinterpret_cast<PySideSignalInstance*>(self);
|
||||
|
||||
Shiboken::AutoDecRef pyArgs(PyList_New(0));
|
||||
Shiboken::AutoDecRef sourceSignature(PySide::Signal::buildQtCompatible(source->d->signature));
|
||||
|
||||
PyList_Append(pyArgs, sourceSignature);
|
||||
for(Py_ssize_t i = 0, max = PyTuple_Size(args); i < max; i++)
|
||||
for (Py_ssize_t i = 0, max = PyTuple_Size(args); i < max; i++)
|
||||
PyList_Append(pyArgs, PyTuple_GetItem(args, i));
|
||||
|
||||
Shiboken::AutoDecRef pyMethod(PyObject_GetAttrString(source->d->source, "emit"));
|
||||
|
|
@ -406,15 +407,16 @@ PyObject* signalInstanceGetItem(PyObject* self, PyObject* key)
|
|||
free(sigKey);
|
||||
const char* sigName = data->d->signalName;
|
||||
|
||||
while(data) {
|
||||
while (data) {
|
||||
if (strcmp(data->d->signature, sig) == 0) {
|
||||
free(sig);
|
||||
PyObject *result = reinterpret_cast<PyObject*>(data);
|
||||
PyObject* result = reinterpret_cast<PyObject*>(data);
|
||||
Py_INCREF(result);
|
||||
return result;
|
||||
}
|
||||
data = reinterpret_cast<PySideSignalInstance*>(data->d->next);
|
||||
}
|
||||
|
||||
PyErr_Format(PyExc_IndexError, "Signature %s not found for signal: %s", sig, sigName);
|
||||
free(sig);
|
||||
return 0;
|
||||
|
|
@ -433,7 +435,7 @@ PyObject* signalInstanceDisconnect(PyObject* self, PyObject* args)
|
|||
|
||||
bool match = false;
|
||||
if (slot->ob_type == &PySideSignalInstanceType) {
|
||||
PySideSignalInstance *target = reinterpret_cast<PySideSignalInstance*>(slot);
|
||||
PySideSignalInstance* target = reinterpret_cast<PySideSignalInstance*>(slot);
|
||||
if (QMetaObject::checkConnectArgs(source->d->signature, target->d->signature)) {
|
||||
PyList_Append(pyArgs, source->d->source);
|
||||
Shiboken::AutoDecRef source_signature(PySide::Signal::buildQtCompatible(source->d->signature));
|
||||
|
|
@ -467,7 +469,7 @@ PyObject* signalInstanceDisconnect(PyObject* self, PyObject* args)
|
|||
Py_DECREF(result);
|
||||
}
|
||||
|
||||
PyErr_Format(PyExc_RuntimeError, "Fail to disconnect signal %s.", source->d->signature);
|
||||
PyErr_Format(PyExc_RuntimeError, "Failed to disconnect signal %s.", source->d->signature);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -503,7 +505,6 @@ PyObject* signalInstanceCall(PyObject* self, PyObject* args, PyObject* kw)
|
|||
return PyCFunction_Call(homonymousMethod, args, kw);
|
||||
}
|
||||
|
||||
|
||||
static PyObject* metaSignalCheck(PyObject* klass, PyObject* args)
|
||||
{
|
||||
if (PyType_IsSubtype(args->ob_type, &PySideSignalInstanceType))
|
||||
|
|
@ -514,7 +515,8 @@ static PyObject* metaSignalCheck(PyObject* klass, PyObject* args)
|
|||
|
||||
} // extern "C"
|
||||
|
||||
namespace PySide { namespace Signal {
|
||||
namespace PySide {
|
||||
namespace Signal {
|
||||
|
||||
void init(PyObject* module)
|
||||
{
|
||||
|
|
@ -542,7 +544,7 @@ bool checkType(PyObject* pyObj)
|
|||
|
||||
void updateSourceObject(PyObject* source)
|
||||
{
|
||||
PyTypeObject * objType = reinterpret_cast<PyTypeObject *>(PyObject_Type(source));
|
||||
PyTypeObject* objType = reinterpret_cast<PyTypeObject*>(PyObject_Type(source));
|
||||
|
||||
Py_ssize_t pos = 0;
|
||||
PyObject* value;
|
||||
|
|
@ -562,13 +564,13 @@ void updateSourceObject(PyObject* source)
|
|||
char* getTypeName(PyObject* type)
|
||||
{
|
||||
if (PyType_Check(type)) {
|
||||
char *typeName = NULL;
|
||||
char* typeName = NULL;
|
||||
if (PyType_IsSubtype(reinterpret_cast<PyTypeObject*>(type), reinterpret_cast<PyTypeObject*>(&SbkObject_Type))) {
|
||||
SbkObjectType* objType = reinterpret_cast<SbkObjectType*>(type);
|
||||
typeName = strdup(Shiboken::ObjectType::getOriginalName(objType));
|
||||
} else {
|
||||
// Translate python types to Qt names
|
||||
PyTypeObject *objType = reinterpret_cast<PyTypeObject*>(type);
|
||||
PyTypeObject* objType = reinterpret_cast<PyTypeObject*>(type);
|
||||
if (Shiboken::String::checkType(objType))
|
||||
typeName = strdup("QString");
|
||||
else if (objType == &PyInt_Type)
|
||||
|
|
@ -593,7 +595,7 @@ char* getTypeName(PyObject* type)
|
|||
return 0;
|
||||
}
|
||||
|
||||
char* buildSignature(const char *name, const char *signature)
|
||||
char* buildSignature(const char* name, const char* signature)
|
||||
{
|
||||
QByteArray signal(name);
|
||||
signal += '(';
|
||||
|
|
@ -602,13 +604,13 @@ char* buildSignature(const char *name, const char *signature)
|
|||
return strdup(QMetaObject::normalizedSignature(signal));
|
||||
}
|
||||
|
||||
char* parseSignature(PyObject *args)
|
||||
char* parseSignature(PyObject* args)
|
||||
{
|
||||
char *signature = 0;
|
||||
char* signature = 0;
|
||||
if (args && (Shiboken::String::check(args) || !PySequence_Check(args)))
|
||||
return getTypeName(args);
|
||||
|
||||
for(Py_ssize_t i = 0, i_max = PySequence_Size(args); i < i_max; i++) {
|
||||
for (Py_ssize_t i = 0, i_max = PySequence_Size(args); i < i_max; i++) {
|
||||
Shiboken::AutoDecRef arg(PySequence_ITEM(args, i));
|
||||
char* typeName = getTypeName(arg);
|
||||
if (typeName) {
|
||||
|
|
@ -630,14 +632,14 @@ void appendSignature(PySideSignal* self, char* signature)
|
|||
self->signaturesSize++;
|
||||
|
||||
if (self->signaturesSize > 1) {
|
||||
self->signatures = (char**) realloc(self->signatures, sizeof(char**) * self->signaturesSize);
|
||||
self->signatures = reinterpret_cast<char**>(realloc(self->signatures, sizeof(char**) * self->signaturesSize));
|
||||
} else {
|
||||
self->signatures = (char**) malloc(sizeof(char**));
|
||||
self->signatures = reinterpret_cast<char**>(malloc(sizeof(char**)));
|
||||
}
|
||||
self->signatures[self->signaturesSize-1] = signature;
|
||||
self->signatures[self->signaturesSize - 1] = signature;
|
||||
}
|
||||
|
||||
PySideSignalInstance* initialize(PySideSignal* self, PyObject* name, PyObject *object)
|
||||
PySideSignalInstance* initialize(PySideSignal* self, PyObject* name, PyObject* object)
|
||||
{
|
||||
PySideSignalInstance* instance = PyObject_New(PySideSignalInstance, &PySideSignalInstanceType);
|
||||
instanceInitialize(instance, name, self, object, 0);
|
||||
|
|
@ -681,7 +683,7 @@ bool connect(PyObject* source, const char* signal, PyObject* callback)
|
|||
Shiboken::AutoDecRef pyArgs(PyTuple_Pack(3, source, pySignature.object(), callback));
|
||||
PyObject* result = PyObject_CallObject(pyMethod, pyArgs);
|
||||
if (result == Py_False) {
|
||||
PyErr_Format(PyExc_RuntimeError, "Fail to connect signal %s, to python callable object.", signal);
|
||||
PyErr_Format(PyExc_RuntimeError, "Failed to connect signal %s, to python callable object.", signal);
|
||||
Py_DECREF(result);
|
||||
result = 0;
|
||||
}
|
||||
|
|
@ -690,10 +692,10 @@ bool connect(PyObject* source, const char* signal, PyObject* callback)
|
|||
|
||||
PySideSignalInstance* newObjectFromMethod(PyObject* source, const QList<QMetaMethod>& methodList)
|
||||
{
|
||||
PySideSignalInstance *root = 0;
|
||||
PySideSignalInstance *previous = 0;
|
||||
PySideSignalInstance* root = 0;
|
||||
PySideSignalInstance* previous = 0;
|
||||
foreach(QMetaMethod m, methodList) {
|
||||
PySideSignalInstance *item = PyObject_New(PySideSignalInstance, &PySideSignalInstanceType);
|
||||
PySideSignalInstance* item = PyObject_New(PySideSignalInstance, &PySideSignalInstanceType);
|
||||
if (!root)
|
||||
root = item;
|
||||
|
||||
|
|
@ -728,7 +730,7 @@ PySideSignal* newObject(const char* name, ...)
|
|||
va_start(listSignatures, name);
|
||||
sig = va_arg(listSignatures, char*);
|
||||
|
||||
while(sig != NULL) {
|
||||
while (sig != NULL) {
|
||||
if (strcmp(sig, "void") == 0)
|
||||
appendSignature(self, strdup(""));
|
||||
else
|
||||
|
|
@ -783,7 +785,7 @@ void registerSignals(SbkObjectType* pyObj, const QMetaObject* metaObject)
|
|||
{
|
||||
typedef QHash<QByteArray, QList<QByteArray> > SignalSigMap;
|
||||
SignalSigMap signalsFound;
|
||||
for(int i = metaObject->methodOffset(), max = metaObject->methodCount(); i < max; ++i) {
|
||||
for (int i = metaObject->methodOffset(), max = metaObject->methodCount(); i < max; ++i) {
|
||||
QMetaMethod method = metaObject->method(i);
|
||||
|
||||
if (method.methodType() == QMetaMethod::Signal) {
|
||||
|
|
@ -809,12 +811,12 @@ void registerSignals(SbkObjectType* pyObj, const QMetaObject* metaObject)
|
|||
SignalSigMap::mapped_type::const_iterator endJ = it.value().end();
|
||||
for (; j != endJ; ++j)
|
||||
appendSignature(self, strdup(j->constData()));
|
||||
|
||||
_addSignalToWrapper(pyObj, it.key(), self);
|
||||
Py_DECREF((PyObject*) self);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PyObject* buildQtCompatible(const char* signature)
|
||||
{
|
||||
QByteArray ba;
|
||||
|
|
@ -838,12 +840,11 @@ const char* getSignature(PySideSignalInstance* signal)
|
|||
return signal->d->signature;
|
||||
}
|
||||
|
||||
|
||||
const char** getSignatures(PyObject* signal, int *size)
|
||||
const char** getSignatures(PyObject* signal, int* size)
|
||||
{
|
||||
PySideSignal *self = reinterpret_cast<PySideSignal*>(signal);
|
||||
PySideSignal* self = reinterpret_cast<PySideSignal*>(signal);
|
||||
*size = self->signaturesSize;
|
||||
return (const char**) self->signatures;
|
||||
return const_cast<const char**>(self->signatures);
|
||||
}
|
||||
|
||||
QStringList getArgsFromSignature(const char* signature, bool* isShortCircuit)
|
||||
|
|
@ -888,10 +889,10 @@ QString getCallbackSignature(const char* signal, QObject* receiver, PyObject* ca
|
|||
|
||||
if (receiver) {
|
||||
//Search for signature on metaobject
|
||||
const QMetaObject *mo = receiver->metaObject();
|
||||
const QMetaObject* mo = receiver->metaObject();
|
||||
QByteArray prefix(functionName);
|
||||
prefix += '(';
|
||||
for(int i=0; i < mo->methodCount(); i++) {
|
||||
for (int i = 0; i < mo->methodCount(); i++) {
|
||||
QMetaMethod me = mo->method(i);
|
||||
if ((strncmp(me.signature(), prefix, prefix.size()) == 0) &&
|
||||
QMetaObject::checkConnectArgs(signal, me.signature())) {
|
||||
|
|
@ -908,7 +909,7 @@ QString getCallbackSignature(const char* signal, QObject* receiver, PyObject* ca
|
|||
numArgs = 0;
|
||||
}
|
||||
} else if (PyCallable_Check(callback)) {
|
||||
functionName = "__callback"+QByteArray::number((qlonglong)callback);
|
||||
functionName = "__callback" + QByteArray::number((qlonglong)callback);
|
||||
}
|
||||
|
||||
Q_ASSERT(!functionName.isEmpty());
|
||||
|
|
@ -949,14 +950,15 @@ bool checkQtSignal(const char* signal)
|
|||
return true;
|
||||
}
|
||||
|
||||
QString codeCallbackName(PyObject* callback, const QString& funcName)
|
||||
QString codeCallbackName(PyObject* callback, const QString& funcName)
|
||||
{
|
||||
if (PyMethod_Check(callback)) {
|
||||
PyObject *self = PyMethod_GET_SELF(callback);
|
||||
PyObject *func = PyMethod_GET_FUNCTION(callback);
|
||||
PyObject* self = PyMethod_GET_SELF(callback);
|
||||
PyObject* func = PyMethod_GET_FUNCTION(callback);
|
||||
return funcName + QString::number(quint64(self), 16) + QString::number(quint64(func), 16);
|
||||
} else
|
||||
} else {
|
||||
return funcName + QString::number(quint64(callback), 16);
|
||||
}
|
||||
}
|
||||
|
||||
} //namespace Signal
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ extern "C"
|
|||
extern PYSIDE_API PyTypeObject PySideSignalType;
|
||||
extern PYSIDE_API PyTypeObject PySideSignalInstanceType;
|
||||
|
||||
//Internal object
|
||||
// Internal object
|
||||
struct PYSIDE_API PySideSignal;
|
||||
|
||||
struct PySideSignalInstancePrivate;
|
||||
|
|
@ -45,14 +45,15 @@ extern "C"
|
|||
PyObject_HEAD
|
||||
PySideSignalInstancePrivate* d;
|
||||
};
|
||||
}; //extern "C"
|
||||
}; // extern "C"
|
||||
|
||||
namespace PySide { namespace Signal {
|
||||
namespace PySide {
|
||||
namespace Signal {
|
||||
|
||||
PYSIDE_API bool checkType(PyObject* type);
|
||||
|
||||
/**
|
||||
* This function creates a Signal object which stay attached to QObject class
|
||||
* This function creates a Signal object which stays attached to QObject class
|
||||
*
|
||||
* @param name of the Signal to be registered on meta object
|
||||
* @param signatures a list of signatures supported by this signal, ended with a NULL pointer
|
||||
|
|
@ -67,7 +68,7 @@ PYSIDE_DEPRECATED(PYSIDE_API PySideSignal* newObject(const char* name, ...));
|
|||
PYSIDE_API void registerSignals(SbkObjectType* pyObj, const QMetaObject* metaObject);
|
||||
|
||||
/**
|
||||
* This function creates a Signal object which stay attached to QObject class based on a list of QMetaMethod
|
||||
* This function creates a Signal object which stays attached to QObject class based on a list of QMetaMethods
|
||||
*
|
||||
* @param source of the Signal to be registered on meta object
|
||||
* @param methods a list of QMetaMethod wich contains the supported signature
|
||||
|
|
@ -76,20 +77,20 @@ PYSIDE_API void registerSignals(SbkObjectType* pyObj, const QMetaObject* metaObj
|
|||
PYSIDE_API PySideSignalInstance* newObjectFromMethod(PyObject* source, const QList<QMetaMethod>& methods);
|
||||
|
||||
/**
|
||||
* This function initializes the Signal object creating a PySideSignalInstance
|
||||
* This function initializes the Signal object by creating a PySideSignalInstance
|
||||
*
|
||||
* @param self a Signal object used as base to PySideSignalInstance
|
||||
* @param name the name to be used on PySideSignalInstance
|
||||
* @param object the PyObject where the signal will be attached
|
||||
* @return Return a new reference to PySideSignalInstance
|
||||
**/
|
||||
PYSIDE_API PySideSignalInstance* initialize(PySideSignal* signal, PyObject* name, PyObject *object);
|
||||
PYSIDE_API PySideSignalInstance* initialize(PySideSignal* signal, PyObject* name, PyObject* object);
|
||||
|
||||
/**
|
||||
* This function is used to retrieve the object in which the sigal is attached
|
||||
* This function is used to retrieve the object in which the signal is attached
|
||||
*
|
||||
* @param self The Signal object
|
||||
* @return Return the internal reference to parent object of the signal
|
||||
* @return Return the internal reference to the parent object of the signal
|
||||
**/
|
||||
PYSIDE_API PyObject* getObject(PySideSignalInstance* signal);
|
||||
|
||||
|
|
@ -115,39 +116,41 @@ PYSIDE_API void updateSourceObject(PyObject* source);
|
|||
PYSIDE_DEPRECATED(PYSIDE_API void addSignalToWrapper(SbkObjectType* wrapperType, const char* signalName, PySideSignal* signal));
|
||||
|
||||
/**
|
||||
* This function verify if the signature is a QtSignal base on SIGNAL flag
|
||||
* This function verifies if the signature is a QtSignal base on SIGNAL flag
|
||||
* @param signature The signal signature
|
||||
* @return Return true if this is a Qt Signal of false if not
|
||||
* @return Return true if this is a Qt Signal, otherwise return false
|
||||
**/
|
||||
PYSIDE_API bool isQtSignal(const char* signature);
|
||||
|
||||
/**
|
||||
* This function is similar as isQtSignal but this reaise a Python error if this faisl
|
||||
* This function is similar to isQtSignal, however if it fails, it'll raise a Python error instead.
|
||||
*
|
||||
* @param signature The signal signature
|
||||
* @return Return true if this is a Qt Signal of false if not
|
||||
* @return Return true if this is a Qt Signal, otherwise return false
|
||||
**/
|
||||
PYSIDE_API bool checkQtSignal(const char* signature);
|
||||
|
||||
/**
|
||||
* This function is used to retrieve the signature base on Signal and receiver callback
|
||||
* @param signature The signal signature
|
||||
* @param receiver The QObject which will receiver the signal
|
||||
* @param callback Callback function which will connect with signal
|
||||
* @param receiver The QObject which will receive the signal
|
||||
* @param callback Callback function which will connect to the signal
|
||||
* @param encodeName Used to specify if the returned signature will be encoded with Qt signal/slot style
|
||||
* @return Return the callback signature
|
||||
**/
|
||||
PYSIDE_API QString getCallbackSignature(const char* signal, QObject* receiver, PyObject* callback, bool encodeName);
|
||||
|
||||
/**
|
||||
* Function to parese the signature and return a list of argument types
|
||||
* This function parses the signature and then returns a list of argument types.
|
||||
*
|
||||
* @param signature The signal signature
|
||||
* @param isShortCircuit If this is a shortCircuit(python<->python) signal
|
||||
* @return Return true if this is a Qt Signal of false if not
|
||||
* @todo replace return type to QList<QByteArray>
|
||||
* @return Return true if this is a Qt Signal, otherwise return false
|
||||
* @todo replace return type by QList<QByteArray>
|
||||
**/
|
||||
QStringList getArgsFromSignature(const char* signature, bool* isShortCircuit = 0);
|
||||
|
||||
} //namespace Signal
|
||||
} //namespace PySide
|
||||
} // namespace Signal
|
||||
} // namespace PySide
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "pysideproperty_p.h"
|
||||
#include "pyside.h"
|
||||
#include "dynamicqmetaobject.h"
|
||||
#include "pysidemetafunction_p.h"
|
||||
|
||||
#include <QHash>
|
||||
#include <QStringList>
|
||||
|
|
@ -34,8 +35,10 @@
|
|||
#include <gilstate.h>
|
||||
#include <QDebug>
|
||||
#include <limits>
|
||||
#include <algorithm>
|
||||
#include <typeresolver.h>
|
||||
#include <basewrapper.h>
|
||||
#include <sbkconverter.h>
|
||||
#include <conversions.h>
|
||||
|
||||
#if QSLOT_CODE != 1 || QSIGNAL_CODE != 2
|
||||
|
|
@ -52,9 +55,8 @@ namespace {
|
|||
static PyObject *metaObjectAttr = 0;
|
||||
|
||||
static int callMethod(QObject* object, int id, void** args);
|
||||
static PyObject* parseArguments(QList<QByteArray> paramTypese, void** args);
|
||||
static PyObject* parseArguments(const QList< QByteArray >& paramTypes, void** args);
|
||||
static bool emitShortCircuitSignal(QObject* source, int signalIndex, PyObject* args);
|
||||
static bool emitNormalSignal(QObject* source, int signalIndex, const char* signal, PyObject* args, const QStringList& argTypes);
|
||||
|
||||
#ifdef IS_PY3K
|
||||
static void destroyMetaObject(PyObject* obj)
|
||||
|
|
@ -224,6 +226,22 @@ static void clearSignalManager()
|
|||
PySide::SignalManager::instance().clear();
|
||||
}
|
||||
|
||||
static void PyObject_PythonToCpp_PyObject_PTR(PyObject* pyIn, void* cppOut)
|
||||
{
|
||||
*((PyObject**)cppOut) = pyIn;
|
||||
}
|
||||
static PythonToCppFunc is_PyObject_PythonToCpp_PyObject_PTR_Convertible(PyObject* pyIn)
|
||||
{
|
||||
return PyObject_PythonToCpp_PyObject_PTR;
|
||||
}
|
||||
static PyObject* PyObject_PTR_CppToPython_PyObject(const void* cppIn)
|
||||
{
|
||||
PyObject* pyOut = (PyObject*)cppIn;
|
||||
if (pyOut)
|
||||
Py_INCREF(pyOut);
|
||||
return pyOut;
|
||||
}
|
||||
|
||||
SignalManager::SignalManager() : m_d(new SignalManagerPrivate)
|
||||
{
|
||||
// Register Qt primitive typedefs used on signals.
|
||||
|
|
@ -232,10 +250,17 @@ SignalManager::SignalManager() : m_d(new SignalManagerPrivate)
|
|||
// Register PyObject type to use in queued signal and slot connections
|
||||
qRegisterMetaType<PyObjectWrapper>(PYTHON_TYPE);
|
||||
qRegisterMetaTypeStreamOperators<PyObjectWrapper>(PYTHON_TYPE);
|
||||
qRegisterMetaTypeStreamOperators<PyObjectWrapper>("PyObjectWrapper");
|
||||
qRegisterMetaTypeStreamOperators<PyObjectWrapper>("PySide::PyObjectWrapper");
|
||||
|
||||
SbkConverter* converter = Shiboken::Conversions::createConverter(&PyBaseObject_Type, 0);
|
||||
Shiboken::Conversions::setCppPointerToPythonFunction(converter, PyObject_PTR_CppToPython_PyObject);
|
||||
Shiboken::Conversions::setPythonToCppPointerFunctions(converter, PyObject_PythonToCpp_PyObject_PTR, is_PyObject_PythonToCpp_PyObject_PTR_Convertible);
|
||||
Shiboken::Conversions::registerConverterName(converter, PYTHON_TYPE);
|
||||
Shiboken::Conversions::registerConverterName(converter, "object");
|
||||
Shiboken::Conversions::registerConverterName(converter, "PyObjectWrapper");
|
||||
Shiboken::Conversions::registerConverterName(converter, "PySide::PyObjectWrapper");
|
||||
|
||||
TypeResolver::createValueTypeResolver<PyObjectWrapper>(PYTHON_TYPE);
|
||||
TypeResolver::createValueTypeResolver<PyObjectWrapper>("object");
|
||||
TypeResolver::createValueTypeResolver<PyObjectWrapper>("PySide::PyObjectWrapper");
|
||||
PySide::registerCleanupFunction(clearSignalManager);
|
||||
|
||||
if (!metaObjectAttr)
|
||||
|
|
@ -338,13 +363,14 @@ bool SignalManager::emitSignal(QObject* source, const char* signal, PyObject* ar
|
|||
|
||||
int signalIndex = source->metaObject()->indexOfSignal(signal);
|
||||
if (signalIndex != -1) {
|
||||
bool isShortCircuit;
|
||||
QStringList argTypes = Signal::getArgsFromSignature(signal, &isShortCircuit);
|
||||
|
||||
// cryptic but works!
|
||||
// if the signature doesn't have a '(' it's a shor circuited signal, i.e. std::find
|
||||
// returned the string null terminator.
|
||||
bool isShortCircuit = !*std::find(signal, signal + std::strlen(signal), '(');
|
||||
if (isShortCircuit)
|
||||
return emitShortCircuitSignal(source, signalIndex, args);
|
||||
else
|
||||
return emitNormalSignal(source, signalIndex, signal, args, argTypes);
|
||||
return MetaFunction::call(source, signalIndex, args);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -418,28 +444,35 @@ int SignalManager::callPythonMetaMethod(const QMetaMethod& method, void** args,
|
|||
Q_ASSERT(pyMethod);
|
||||
|
||||
Shiboken::GilState gil;
|
||||
PyObject* pyArguments = NULL;
|
||||
PyObject* pyArguments = 0;
|
||||
|
||||
if (isShortCuit)
|
||||
pyArguments = reinterpret_cast<PyObject*>(args[1]);
|
||||
else
|
||||
pyArguments = parseArguments(method.parameterTypes(), args);
|
||||
|
||||
//keep the returnType this call be destroyed after method call
|
||||
QByteArray returnType = method.typeName();
|
||||
if (pyArguments) {
|
||||
Shiboken::AutoDecRef retval(PyObject_CallObject(pyMethod, pyArguments));
|
||||
|
||||
Shiboken::AutoDecRef retval(PyObject_CallObject(pyMethod, pyArguments));
|
||||
if (!isShortCuit && pyArguments)
|
||||
Py_DECREF(pyArguments);
|
||||
|
||||
if (!isShortCuit)
|
||||
Py_XDECREF(pyArguments);
|
||||
if (!retval.isNull() && retval != Py_None && !PyErr_Occurred()) {
|
||||
const char* returnType = method.typeName();
|
||||
if (returnType && std::strcmp("", returnType)) {
|
||||
Shiboken::Conversions::SpecificConverter converter(returnType);
|
||||
if (converter)
|
||||
converter.toCpp(retval, args[0]);
|
||||
else
|
||||
PyErr_Format(PyExc_RuntimeError, "Can't find converter for '%s' to call Python meta method.", returnType);
|
||||
|
||||
if (retval.isNull()) {
|
||||
PyErr_Print();
|
||||
} else {
|
||||
if (returnType.size() > 0)
|
||||
Shiboken::TypeResolver::get(returnType)->toCpp(retval, &args[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (PyErr_Occurred())
|
||||
PyErr_Print();
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -469,9 +502,9 @@ int SignalManager::registerMetaMethodGetIndex(QObject* source, const char* signa
|
|||
if (!dict || !PyDict_Contains(dict, metaObjectAttr)) {
|
||||
dmo = new DynamicQMetaObject(pySelf->ob_type, metaObject);
|
||||
#ifdef IS_PY3K
|
||||
PyObject *pyDmo = PyCapsule_New(dmo, 0, destroyMetaObject);
|
||||
PyObject* pyDmo = PyCapsule_New(dmo, 0, destroyMetaObject);
|
||||
#else
|
||||
PyObject *pyDmo = PyCObject_FromVoidPtr(dmo, destroyMetaObject);
|
||||
PyObject* pyDmo = PyCObject_FromVoidPtr(dmo, destroyMetaObject);
|
||||
#endif
|
||||
|
||||
PyObject_SetAttr(pySelf, metaObjectAttr, pyDmo);
|
||||
|
|
@ -539,29 +572,23 @@ static int callMethod(QObject* object, int id, void** args)
|
|||
}
|
||||
|
||||
|
||||
static PyObject* parseArguments(QList<QByteArray> paramTypes, void** args)
|
||||
static PyObject* parseArguments(const QList<QByteArray>& paramTypes, void** args)
|
||||
{
|
||||
PyObject* preparedArgs = NULL;
|
||||
Py_ssize_t argsSize = paramTypes.count();
|
||||
int argsSize = paramTypes.count();
|
||||
PyObject* preparedArgs = PyTuple_New(argsSize);
|
||||
|
||||
if (argsSize)
|
||||
preparedArgs = PyTuple_New(argsSize);
|
||||
|
||||
for (int i = 0, max = paramTypes.count(); i < max; ++i) {
|
||||
for (int i = 0, max = argsSize; i < max; ++i) {
|
||||
void* data = args[i+1];
|
||||
const char* dataType = paramTypes[i].constData();
|
||||
|
||||
Shiboken::TypeResolver* tr = Shiboken::TypeResolver::get(dataType);
|
||||
if (tr) {
|
||||
PyObject* arg = tr->toPython(data);
|
||||
PyTuple_SET_ITEM(preparedArgs, i, arg);
|
||||
Shiboken::Conversions::SpecificConverter converter(dataType);
|
||||
if (converter) {
|
||||
PyTuple_SET_ITEM(preparedArgs, i, converter.toPython(data));
|
||||
} else {
|
||||
PyErr_Format(PyExc_TypeError, "Can't call meta function because I have no idea how to handle %s", dataType);
|
||||
Py_DECREF(preparedArgs);
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return preparedArgs;
|
||||
}
|
||||
|
||||
|
|
@ -572,49 +599,4 @@ static bool emitShortCircuitSignal(QObject* source, int signalIndex, PyObject* a
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool emitNormalSignal(QObject* source, int signalIndex, const char* signal, PyObject* args, const QStringList& argTypes)
|
||||
{
|
||||
Shiboken::AutoDecRef sequence(PySequence_Fast(args, 0));
|
||||
int argsGiven = PySequence_Fast_GET_SIZE(sequence.object());
|
||||
|
||||
if (argsGiven != argTypes.count()) {
|
||||
PyErr_Format(PyExc_TypeError, "%s only accepts %d arguments, %d given!", signal, argTypes.count(), argsGiven);
|
||||
return false;
|
||||
}
|
||||
|
||||
QVariant* signalValues = new QVariant[argsGiven];
|
||||
void** signalArgs = new void*[argsGiven + 1];
|
||||
signalArgs[0] = 0;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < argsGiven; ++i) {
|
||||
QByteArray typeName = argTypes[i].toAscii();
|
||||
Shiboken::TypeResolver* typeResolver = Shiboken::TypeResolver::get(typeName);
|
||||
if (typeResolver) {
|
||||
if (Shiboken::TypeResolver::getType(typeName) == Shiboken::TypeResolver::ValueType) {
|
||||
int typeId = QMetaType::type(typeName);
|
||||
if (!typeId) {
|
||||
PyErr_Format(PyExc_TypeError, "Value type used on signal needs to be registered on meta type: %s", typeName.data());
|
||||
break;
|
||||
}
|
||||
signalValues[i] = QVariant(typeId, (void*) 0);
|
||||
}
|
||||
signalArgs[i+1] = signalValues[i].data();
|
||||
typeResolver->toCpp(PySequence_Fast_GET_ITEM(sequence.object(), i), &signalArgs[i+1]);
|
||||
} else {
|
||||
PyErr_Format(PyExc_TypeError, "Unknown type used to emit a signal: %s", qPrintable(argTypes[i]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool ok = i == argsGiven;
|
||||
if (ok)
|
||||
source->qt_metacall(QMetaObject::InvokeMetaMethod, signalIndex, signalArgs);
|
||||
|
||||
delete[] signalArgs;
|
||||
delete[] signalValues;
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
} //namespace
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ set(ui_plugin_src
|
|||
customwidget.cpp
|
||||
)
|
||||
|
||||
set (ui_plugin_moc
|
||||
set(ui_plugin_moc
|
||||
customwidget.h
|
||||
customwidgets.h
|
||||
)
|
||||
|
|
|
|||
|
|
@ -95,11 +95,12 @@ QWidget* PyCustomWidget::createWidget(QWidget* parent)
|
|||
bool unkowParent = false;
|
||||
if (parent) {
|
||||
pyParent = reinterpret_cast<PyObject*>(Shiboken::BindingManager::instance().retrieveWrapper(parent));
|
||||
if (!pyParent) {
|
||||
pyParent = Shiboken::Converter<QWidget*>::toPython(parent);
|
||||
unkowParent = true;
|
||||
} else {
|
||||
if (pyParent) {
|
||||
Py_INCREF(pyParent);
|
||||
} else {
|
||||
static Shiboken::Conversions::SpecificConverter converter("QWidget*");
|
||||
pyParent = converter.toPython(&parent);
|
||||
unkowParent = true;
|
||||
}
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
|
|
@ -129,4 +130,3 @@ void PyCustomWidget::initialize(QDesignerFormEditorInterface* core)
|
|||
{
|
||||
m_data->initialized = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ PYSIDE_TEST(bug_953.py)
|
|||
PYSIDE_TEST(bug_987.py)
|
||||
PYSIDE_TEST(bug_994.py)
|
||||
PYSIDE_TEST(bug_1019.py)
|
||||
PYSIDE_TEST(bug_1031.py)
|
||||
PYSIDE_TEST(bug_1063.py)
|
||||
PYSIDE_TEST(bug_1069.py)
|
||||
PYSIDE_TEST(blocking_signals_test.py)
|
||||
PYSIDE_TEST(classinfo_test.py)
|
||||
PYSIDE_TEST(child_event_test.py)
|
||||
|
|
|
|||
5
tests/QtCore/bug_1031.py
Normal file
5
tests/QtCore/bug_1031.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
from PySide.QtCore import QStateMachine, QState
|
||||
|
||||
mach = QStateMachine()
|
||||
state = QState(mach)
|
||||
print(state.machine())
|
||||
30
tests/QtCore/bug_1063.py
Normal file
30
tests/QtCore/bug_1063.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
''' unit test for BUG #1063 '''
|
||||
|
||||
import unittest
|
||||
import tempfile
|
||||
from PySide import QtCore
|
||||
import os
|
||||
import py3kcompat as py3k
|
||||
|
||||
class QTextStreamTestCase(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.temp_file = tempfile.NamedTemporaryFile(delete=False)
|
||||
self.temp_file.close()
|
||||
self.f = QtCore.QFile(self.temp_file.name)
|
||||
self.f.open(QtCore.QIODevice.WriteOnly)
|
||||
self.strings = (py3k.unicode_('foo'), py3k.unicode_('bar'))
|
||||
self.stream = QtCore.QTextStream(self.f)
|
||||
|
||||
def testIt(self):
|
||||
for s in self.strings:
|
||||
self.stream << s
|
||||
|
||||
self.f.close()
|
||||
|
||||
# make sure we didn't get an empty file
|
||||
self.assertNotEqual(QtCore.QFile(self.temp_file.name).size(), 0)
|
||||
|
||||
os.unlink(self.temp_file.name)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
22
tests/QtCore/bug_1069.py
Normal file
22
tests/QtCore/bug_1069.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
''' unit test for BUG #1069 '''
|
||||
|
||||
from PySide import QtCore
|
||||
import unittest
|
||||
|
||||
class QDataStreamOpOverloadTestCase(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.ba = QtCore.QByteArray()
|
||||
self.stream = QtCore.QDataStream(self.ba, QtCore.QIODevice.WriteOnly)
|
||||
|
||||
def testIt(self):
|
||||
self.stream << "hello"
|
||||
ok = False
|
||||
for c in self.ba:
|
||||
if c != b'\x00':
|
||||
ok = True
|
||||
break
|
||||
|
||||
self.assertEqual(ok, True)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
@ -3,12 +3,11 @@
|
|||
|
||||
import unittest
|
||||
from PySide.QtCore import QSettings
|
||||
from helper import adjust_filename
|
||||
import tempfile
|
||||
|
||||
class QVariantConversions(unittest.TestCase):
|
||||
def testDictionary(self):
|
||||
confFile = tempfile.NamedTemporaryFile()
|
||||
confFile = tempfile.NamedTemporaryFile(delete=False)
|
||||
s = QSettings(confFile.name, QSettings.IniFormat)
|
||||
# Save value
|
||||
s.setValue('x', {1: 'a'})
|
||||
|
|
|
|||
|
|
@ -43,5 +43,22 @@ class TestDateTimeConversions (unittest.TestCase):
|
|||
|
||||
self.assertEqual(dateTime, other.toPython())
|
||||
|
||||
def testQDateTime6arg(self):
|
||||
dateTime = datetime.datetime(2010, 4, 23, 11, 14, 7)
|
||||
other = QDateTime(dateTime)
|
||||
|
||||
otherDate = other.date()
|
||||
self.assertEqual(dateTime.year, otherDate.year())
|
||||
self.assertEqual(dateTime.month, otherDate.month())
|
||||
self.assertEqual(dateTime.day, otherDate.day())
|
||||
|
||||
otherTime = other.time()
|
||||
self.assertEqual(dateTime.hour, otherTime.hour())
|
||||
self.assertEqual(dateTime.minute, otherTime.minute())
|
||||
self.assertEqual(dateTime.second, otherTime.second())
|
||||
self.assertEqual(dateTime.microsecond/1000, otherTime.msec())
|
||||
|
||||
self.assertEqual(dateTime, other.toPython())
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue