Compare commits

...

107 commits

Author SHA1 Message Date
Juhapekka Piiroinen
f011ce2cb9 Bug fix for PYSIDE-7
This should resolve the issue in PYSIDE-7 "QDateTime does not support the 6-argument format".
Added function signature for 6-argument version and a testcase.

Change-Id: I617eefab6a41939c37e2f1bf800857bc2d74b6ee
Reviewed-by: Hugo Parente Lima <hugo.lima@openbossa.org>
2012-03-13 18:43:04 +01:00
Juhapekka Piiroinen
fe8dc36f90 Fix bug PYSIDE-6
This should resolve the issue in PYSIDE-6 "Fix phonon VideoCaptureDevice detection to properly use phonon_ namespace".
Changed if check in PySideModules.cmake.

Change-Id: Ie30d6858a0fc6073560ec4cd09508504cbeb667d
Reviewed-by: Hugo Parente Lima <hugo.lima@openbossa.org>
2012-03-13 18:41:53 +01:00
Hugo Parente Lima
db6f1e3306 Fix PySide compilation.
Change-Id: Ie7a30961232526af59cbc21dbf1b58ab9a4e3e7b
Reviewed-by: Hugo Parente Lima <hugo.lima@openbossa.org>
2012-03-13 18:29:52 +01:00
Marcelo Lira
d30a8672c3 Version bump to 1.1.1. 2012-03-08 16:56:23 -03:00
Marcelo Lira
afc9a7e10b Version bump to 1.1.0. 2012-03-08 16:56:23 -03:00
Marcelo Lira
a8a07b77f8 Declares Python types using the new "<custom-type>" tag.
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
Reviewed by Paulo Alcantara <pcacjr@gmail.com>
2012-03-08 16:56:23 -03:00
Paulo Alcantara
98be0df6a5 Fix BUG #1060 - "Subclassing of QUiLoader leads to "Internal C++ object
already deleted" exception"

See http://bugs.pyside.org/show_bug.cgi?id=1060.

Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
Reviewed-by: Marcelo Lira <marcelo.lira@openbossa.org>
2012-03-08 16:56:23 -03:00
Paulo Alcantara
b2b14fe9b7 Fix BUG #1091 - "PixmapFragment and drawPixmapFragments are not bound"
See http://bugs.pyside.org/show_bug.cgi?id=1091.

Also minor coding style fixes in QtGui's typesystem.

Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
Reviewed-by: Marcelo Lira <marcelo.lira@openbossa.org>
2012-03-08 16:56:23 -03:00
Paulo Alcantara
481ba5aa3e Fix BUG #1084 - "Crash (segfault) when writing unicode string on socket"
See http://bugs.pyside.org/show_bug.cgi?id=1084.

Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
Reviewed-by: Trust me
2012-03-08 16:56:23 -03:00
Marcelo Lira
8ddbd3167b The temporary file used in the test for bug #829 must not be deleted by the test.
This fixes the test in win32 platforms.
2012-03-08 16:56:23 -03:00
Marcelo Lira
65d8f9fcef Fixes the QSettings related QVariant's save/load bug. 2012-03-08 16:56:23 -03:00
Hugo Parente Lima
7b8d2925dd Small code style changes. 2012-03-08 16:56:22 -03:00
Hugo Parente Lima
c78b4686a1 Add GC support to PySide Property type.
This fixes GC errors when running PySide on a Python debug env.

Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
2012-03-08 16:56:22 -03:00
Marcelo Lira
e76b2b76f5 Added type system entries to the primitive types used by QtOpenGL. 2012-03-08 16:56:22 -03:00
Marcelo Lira
2a634aea05 Updated the custom widget plugin to use the new converters. 2012-03-08 16:56:21 -03:00
Marcelo Lira
7bfbbf3cb7 No more training wheels. The last occurrences of the old template Converter where removed.
Also related fixes here and there.
2012-03-08 16:56:21 -03:00
Marcelo Lira
aec20b21a5 Added a type system file for Maemo's QtCore. 2012-03-08 16:56:21 -03:00
Marcelo Lira
ebeae9d084 Fixes custom code for QtCore's HWND on win32. 2012-03-08 16:56:21 -03:00
Marcelo Lira
31804c2adc Qt::HANDLE is declared only in QtCore, and its specifics depend on the architecture. 2012-03-08 16:56:21 -03:00
Marcelo Lira
c31c14cdfb Fixed QtCore's HWND converter for win32. 2012-03-08 16:56:21 -03:00
Marcelo Lira
879e4bb14d Removed the QAbstractVideoBuffer::map method. 2012-03-08 16:56:21 -03:00
Marcelo Lira
6575ac8d39 Fixed converter for win32's WId type. 2012-03-08 16:56:20 -03:00
Hugo Parente Lima
1af53541bf Fix compilation of conversion branch against Python3k.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
2012-03-08 16:56:20 -03:00
Marcelo Lira
2a87b74bfe Replaced TypeResolver by SbkConverter and SpecificConverter.
Also updated QtGui's WId conversion to Python 3.
2012-03-08 16:56:20 -03:00
Marcelo Lira
792504f978 Removed the remaining occurrences of Shiboken::makeTuple. 2012-03-08 16:56:20 -03:00
Marcelo Lira
7b04273736 Fixed code for QUdpSocket.readDatagram method to remove usage of Shiboken::makeTuple. 2012-03-08 16:56:20 -03:00
Marcelo Lira
30118e265d Fixed code for setting QtCore.__version_info__ to not use Shiboken::makeTuple. 2012-03-08 16:56:20 -03:00
Marcelo Lira
770c8bda73 Fixed custom code for QScriptValueIterator.__next__ function.
It must not use the convenience method Shiboken::makeTuple, for it makes
use of the old template based converters.
2012-03-08 16:56:20 -03:00
Marcelo Lira
16f4378fed Fixes type converter for Win32's HWND. 2012-03-08 16:56:20 -03:00
Marcelo Lira
80c02f16e5 Fixes the test for a QFlag value returned in a QVariant. 2012-03-08 16:56:20 -03:00
Marcelo Lira
b643a3f8ab Modified PySideQFlags based on Hugo's design. 2012-03-08 16:56:19 -03:00
Marcelo Lira
8145f2a7e2 Added converter for primitive type QModelIndexList. 2012-03-08 16:56:19 -03:00
Marcelo Lira
25638d3f80 Fixes conversion rule for QGraphicsView::drawItems array argument. 2012-03-08 16:56:19 -03:00
Marcelo Lira
3318a40ab1 Some method signatures were removed.
They were removed because used pointers to primitive types without
proper user defined handling. Future assessment must be done to tell if
removal is enough, or other changes are needed.
2012-03-08 16:56:19 -03:00
Marcelo Lira
ba062e1b89 Updated various function removals and modifications. 2012-03-08 16:56:19 -03:00
Marcelo Lira
3ee5bec244 New containers for container types. 2012-03-08 16:56:19 -03:00
Marcelo Lira
ae0f62ed80 New converters for primitive types. 2012-03-08 16:56:19 -03:00
Marcelo Lira
64bec138e1 Added new style conversions for QDate, QTime and QDateTime objects. 2012-03-08 16:56:19 -03:00
Marcelo Lira
1105a5be3a Added default constructor to QTextStreamManipulator. 2012-03-08 16:56:18 -03:00
Marcelo Lira
815fae961f Turned QStyleOptionViewItem into value type, for it has a public copy constructor.
It is passed around by value in many places, like the return value of
QAbstractItemView::viewOptions(). I did the same to the variations:
QStyleOptionViewItemV2, QStyleOptionViewItemV3, etc.
2012-03-08 16:56:18 -03:00
Marcelo Lira
8c1fbc3751 Signature of various added and modified functions modified to use non-const references.
The API Extractor signature normalizer removes const& from argument
types, but it leaves non-const references unchanged.
2012-03-08 16:56:18 -03:00
Paulo Alcantara
ad8992e9e0 pysidesignal: more trivial fixes
Fix typos and coding style.

Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
Reviewed-by: Marcelo Lira <marcelo.lira@openbossa.org>
2012-03-08 16:56:18 -03:00
Marcelo Lira
41f1c30372 Makes test for QtCore's bug #1063 compliant with Python 3. 2012-03-08 16:56:18 -03:00
Hugo Parente Lima
720a6f4cad Don't double decref variable causing an assertion error on debug builds.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
2012-03-08 16:56:18 -03:00
Paulo Alcantara
48669462d0 pysidesignal: don't use C's cast
Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
Reviewed-by: Luciano Wolf <luciano.wolf@openbossa.org>
Reviewed-by: Hugo Parente Lima <hugo.pl@gmail.com>
2012-03-08 16:56:18 -03:00
Paulo Alcantara
66f4ccbe5d pysidesignal: trivial fixes
Fix typos and coding style

Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
Reviewed-by: Luciano Wolf <luciano.wolf@openbossa.org>
Reviewed-by: Hugo Parente Lima <hugo.pl@gmail.com>
2012-03-08 16:56:18 -03:00
Paulo Alcantara
508e59c091 Fix BUG #1063
Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
Reviewed-by: Willer Moreira <willer.moreira@openbossa.org>
Reviewed-by: Luciano Wolf <luciano.wolf@openbossa.org>
2012-03-08 16:56:18 -03:00
Hugo Parente Lima
93bb5d777e Fix bug 1083 - "winId returns a PyCObject making it impossible to compare two winIds" 2012-03-08 16:56:17 -03:00
Hugo Parente Lima
e3814f27dd Replace private.py file by an inject code. 2012-03-08 16:56:17 -03:00
Paulo Alcantara
2f70b10471 Fix BUG #1077 - "Application exit crash when call QSyntaxHighlighter.document()"
Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
          Hugo Parente Lima <hugo.pl@gmail.com>
2012-03-08 16:56:17 -03:00
Paulo Alcantara
e2524f6abb Fix BUG #1034 - "Error compiling PySide with Python 3.2.2 32bit on Windows"
Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
          Luciano Wolf <luciano.wolf@openbossa.org>
2012-03-08 16:56:17 -03:00
Paulo Alcantara
4985f114a3 Fix BUG #1069 - "QtCore.QDataStream silently fails on writing Python string"
Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
Reviewer: Willer Moreira <willer.moreira@openbossa.org>
          Marcelo Lira <marcelo.lira@openbossa.org>
2012-03-08 16:56:17 -03:00
Luciano Wolf
791f70629c Bumping to revision 1.0.9 2012-03-08 16:56:17 -03:00
Paulo Alcantara
8160e529e2 Fix BUG #1048
Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
Reviewer: Willer Moreira <willer.moreira@openbossa.org>
          Hugo Parente Lima <hugo.lima@openbossa.org>
2012-03-08 16:56:17 -03:00
Paulo Alcantara
45ad11e5be Fix BUG #1058 - "Strange code in PySide/QtUiTools/glue/plugins.h"
Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
          Bruno Araújo <bruno.araujo@openbossa.org>
2012-03-08 16:56:17 -03:00
Paulo Alcantara
e031567fac Fix BUG #1052
Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
          Lauro Moura <lauro.neto@openbossa.org>
2012-03-08 16:56:17 -03:00
Lauro Neto
e29d2e460b Fix PYSIDE_LIBRARY in CMake export.
Was hardcoded with Cygwin library name format.

Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
2012-03-08 16:56:16 -03:00
Hugo Parente Lima
fbf3a8b07a Remove unused code in bug 844 unit test.
Reviewer: Lauro Moura <lauro.neto@openbossa.org>
          Luciano Wolf <luciano.wolf@openbossa.org>
2012-03-08 16:56:16 -03:00
Hugo Parente Lima
dde75099f2 Fix bug 1029 - "qmlRegisterType Fails to Increase the Ref Count" 2012-03-08 16:56:16 -03:00
Paulo Alcantara
64ffc4f61b Fix BUG #1031
Signed-off-by: Paulo Alcantara <paulo.alcantara@openbossa.org>
Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>
          Marcelo Lira <marcelo.lira@openbossa.org>
2012-03-08 16:56:16 -03:00
Jerzy Kozera
50bf9a570b Fixed compilation error for gcc versions < 4
Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>
          Marcelo Lira <marcelo.lira@openbossa.org>
2012-03-08 16:56:16 -03:00
Hugo Parente Lima
b30e998e65 Fix phonon unit test when there are device aliases reported by phonon. 2012-03-08 16:56:16 -03:00
Hugo Parente Lima
c230fad427 Strip the text received from message handler.
This was needed because now qWarning, etc, are using stream operators
for security reasons, and those operators add spaces at end.
2012-03-08 16:56:15 -03:00
Hugo Parente Lima
6fe19dbb88 Fix bug 1012 - "FTBFS with hardening flags enabled"
Reviewer: Lauro Moura <lauro.neto@openbossa.org>
          Marcelo Lira <marcelo.lira@openbossa.org>
2012-03-08 16:56:15 -03:00
Hugo Parente Lima
8060e3ee87 Fix bug 1036 - "Qt.KeyboardModifiers always evaluates to zero"
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
          Marcelo Lira <marcelo.lira@openbossa.org>
2012-03-08 16:56:15 -03:00
Hugo Parente Lima
b50186e9f3 Creates QFlags types at runtime. 2012-03-08 16:56:15 -03:00
Hugo Parente Lima
4ba7cd90d6 Fix bug 1013 - "connect to QSqlTableModel.primeInsert() causes crash" 2012-03-08 16:56:15 -03:00
Hugo Parente Lima
f57d4d4dbc Fix bug 1011 - "PySide cygwin patch"
Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>
          Marcelo Lira <marcelo.lira@openbossa.org>
2012-03-08 16:56:15 -03:00
Hugo Parente Lima
5c076e1c53 Reduce the memory used by PySideMetaFunction instances. 2012-03-08 16:56:15 -03:00
Hugo Parente Lima
67d6455fa5 Unify the code used to do QObject meta calls. 2012-03-08 16:56:15 -03:00
Hugo Parente Lima
15ceed791f Fix bug 1016 - "Calling of Q_INVOKABLE method returning not QVariant is impossible..." 2012-03-08 16:56:15 -03:00
Hugo Parente Lima
f55d088d44 Optimize PySide::getMetaDataFromQObject function avoiding some str copies. 2012-03-08 16:56:14 -03:00
Hugo Parente Lima
07d0879700 Fix code style and add license headers. 2012-03-08 16:56:14 -03:00
Hugo Parente Lima
2e1ff21938 Fix unit test of bug 829. 2012-03-08 16:56:14 -03:00
Hugo Parente Lima
0971ac7c4f Version bump to 1.0.8. 2012-03-08 16:56:14 -03:00
Hugo Parente Lima
0e8b50c9b0 Fix bug 1019 - "Overriding QWidget.show or QWidget.hide do not work"
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
          Marcelo Lira <marcelo.lira@openbossa.org>
2012-03-08 16:56:14 -03:00
Paulo Alcantara
b7f593d99e Fix bug 1022 - "RuntimeError: maximum recursion depth exceeded while getting the str of an object"
Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>
          Marcelo Lira <marcelo.lira@openbossa.org>
          Luciano Wolf <luciano.wolf@openbossa.org>

Signed-off-by: Paulo Alcantara <paulo.alcantara@openbossa.org>
2012-03-08 16:56:14 -03:00
Hugo Parente Lima
6acb5f9bc7 Only removes actions bounded to PyObjects on QMenu::clear.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
          Luciano Wolf <luciano.wolf@openbossa.org>
2012-03-08 16:56:14 -03:00
Renato Filho
9f05c7dad5 Initial update typesystem for support Qt 4.8 (beta).
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
          Luciano Wolf <luciano.wolf@openbossa.org>
2012-03-08 16:56:14 -03:00
Lauro Neto
6c47624e92 Fix getTypeName check order.
Was segfaulting for signals with None as an explicit
argument (returning NULL to a strdup).

Reviewer: Hugo Lima <hugo.lima@openbossa.org>
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
2012-03-08 16:56:14 -03:00
Marcelo Lira
2683577b7a Fixes win32's HWND converter.
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
2012-03-08 16:56:13 -03:00
Hugo Parente Lima
ed94eda798 Use sbkpython.h instead of Python.h to avoid problems with Python2.5.
Reviewer: Lauro Moura <lauro.neto@openbossa.org>
          Marcelo Lira <marcelo.lira@openbossa.org>
2012-03-08 16:56:13 -03:00
Hugo Parente Lima
620b46650a Avoid using uninitialized variable. 2012-03-08 16:56:13 -03:00
Hugo Parente Lima
7202e2b8df Fix qglbuffer test on Python3. 2012-03-08 16:56:13 -03:00
Renato Filho
1cefc09118 Fixed unittest to work with python3. 2012-03-08 16:56:13 -03:00
Hugo Parente Lima
b841afdb5c Change String::convertible to String::isConvertible. 2012-03-08 16:56:13 -03:00
Renato Filho
401651e26c Fixed unittest to work with python3. 2012-03-08 16:56:13 -03:00
Renato Filho
66d96ef4b6 Updated Cmake files. 2012-03-08 16:56:13 -03:00
Renato Filho
c33a78cdd4 Slplited python compat file for python 2.x and 3.x 2012-03-08 16:56:12 -03:00
Renato Filho
18383549d6 Updated __init__.py file to works with python 2.x and 3.x 2012-03-08 16:56:12 -03:00
Renato Filho
6869a49bc3 Updated pyside and signals tests to works with python 2.x and 3.x 2012-03-08 16:56:12 -03:00
Renato Filho
1874425448 Updated phonon modue to works with python 2.x and 3.x 2012-03-08 16:56:11 -03:00
Renato Filho
de291d1d0f Updated QtWebKit modue to works with python 2.x and 3.x 2012-03-08 16:56:11 -03:00
Renato Filho
e90255bf7e Updated QtUiTools modue to works with python 2.x and 3.x 2012-03-08 16:56:11 -03:00
Renato Filho
676b2b579d Updated QtSql modue to works with python 2.x and 3.x 2012-03-08 16:56:11 -03:00
Renato Filho
f6c818b21d Updated QtOpenGL modue to works with python 2.x and 3.x 2012-03-08 16:56:11 -03:00
Renato Filho
66a0bbf578 Updated QtNetwork modue to works with python 2.x and 3.x 2012-03-08 16:56:11 -03:00
Renato Filho
1f1fbfbfa8 Updated QtScript modue to works with python 2.x and 3.x 2012-03-08 16:56:11 -03:00
Renato Filho
d9dd319232 Updated QtGui modue to works with python 2.x and 3.x 2012-03-08 16:56:11 -03:00
Renato Filho
edaefbce48 Updated QtCore modue to works with python 2.x and 3.x 2012-03-08 16:56:11 -03:00
Renato Filho
75843bf45a Updated QtDeclarative modue to works with python 2.x and 3.x 2012-03-08 16:56:10 -03:00
Renato Filho
1e29ab6592 Initia QtCore port to python3. 2012-03-08 16:56:08 -03:00
Renato Filho
a2cb6fe025 Created pyside QFlags compat class. 2012-03-08 16:54:53 -03:00
Renato Filho
2e69baa4f5 Fixed compilation with python3. 2012-03-08 16:54:53 -03:00
Marcelo Lira
009aef9f1b Fixes argument and return type of a couple of QtDeclarative methods.
The methods are:

* QDeclarativeEngine::importPlugin(QString,QString,QString*)
* QDeclarativeExpression::evaluate(bool*)

Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
Reviewed by Renato Araújo <renato.filho@openbossa.org>
2012-03-08 16:54:52 -03:00
Marcelo Lira
9e8916e111 Fixes argument and return type for method "QScriptString::toArrayIndex(bool*)const". 2012-03-08 16:54:52 -03:00
Marcelo Lira
b94ad1e4de QHostAddress::setAddress(quint8*) signature was removed. 2012-03-08 16:54:52 -03:00
209 changed files with 3352 additions and 2081 deletions

View file

@ -5,8 +5,7 @@ project(pysidebindings)
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.6)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Macros/ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Macros/
${CMAKE_MODULE_PATH}) ${CMAKE_MODULE_PATH})
find_package(GeneratorRunner 0.6.13 REQUIRED) find_package(Shiboken 1.1.1 REQUIRED)
find_package(Shiboken 1.0.7 REQUIRED)
find_package(Qt4 4.5.0 REQUIRED) find_package(Qt4 4.5.0 REQUIRED)
find_file(GL_H "gl.h" PATH_SUFFIXES "GL") find_file(GL_H "gl.h" PATH_SUFFIXES "GL")
include(FindQt4Extra) include(FindQt4Extra)
@ -32,7 +31,7 @@ endif()
if(MSVC) if(MSVC)
set(CMAKE_CXX_FLAGS "/Zc:wchar_t- /GR /EHsc /DNOCOLOR /DWIN32 /D_WINDOWS /D_SCL_SECURE_NO_WARNINGS") set(CMAKE_CXX_FLAGS "/Zc:wchar_t- /GR /EHsc /DNOCOLOR /DWIN32 /D_WINDOWS /D_SCL_SECURE_NO_WARNINGS")
else() 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") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fvisibility=hidden -Wno-strict-aliasing")
endif() endif()
set(CMAKE_CXX_FLAGS_DEBUG "-g") set(CMAKE_CXX_FLAGS_DEBUG "-g")
@ -62,8 +61,8 @@ endif()
set(BINDING_NAME PySide) set(BINDING_NAME PySide)
set(BINDING_API_MAJOR_VERSION "1") set(BINDING_API_MAJOR_VERSION "1")
set(BINDING_API_MINOR_VERSION "0") set(BINDING_API_MINOR_VERSION "1")
set(BINDING_API_MICRO_VERSION "7") set(BINDING_API_MICRO_VERSION "1")
set(BINDING_API_RELEASE_LEVEL "final") # alpha, beta, rc, or final 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_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) set(BINDING_API_VERSION "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}.${BINDING_API_MICRO_VERSION}" CACHE STRING "PySide version" FORCE)
@ -142,7 +141,7 @@ add_custom_target(dist
if (NOT SITE_PACKAGE) if (NOT SITE_PACKAGE)
execute_process( execute_process(
COMMAND ${SHIBOKEN_PYTHON_INTERPRETER} -c "from distutils import sysconfig; \\ COMMAND ${SHIBOKEN_PYTHON_INTERPRETER} -c "from distutils import sysconfig; \\
print sysconfig.get_python_lib(1,0,prefix='${CMAKE_INSTALL_PREFIX}')" print(sysconfig.get_python_lib(1,0,prefix='${CMAKE_INSTALL_PREFIX}'))"
OUTPUT_VARIABLE SITE_PACKAGE OUTPUT_VARIABLE SITE_PACKAGE
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
if (NOT SITE_PACKAGE) if (NOT SITE_PACKAGE)

View file

@ -9,9 +9,6 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/global.h.in"
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.in" configure_file("${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.in"
"${CMAKE_CURRENT_BINARY_DIR}/__init__.py" @ONLY) "${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_QTCORE_FOUND QtCore)
HAS_QT_MODULE(QT_QTGUI_FOUND QtGui) HAS_QT_MODULE(QT_QTGUI_FOUND QtGui)
HAS_QT_MODULE(QT_QTNETWORK_FOUND QtNetwork) 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) HAS_QT_MODULE(QT_QTDECLARATIVE_FOUND QtDeclarative)
# install # 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}") DESTINATION "${SITE_PACKAGE}/${BINDING_NAME}${pyside_SUFFIX}")
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_templates.xml install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_templates.xml
DESTINATION share/PySide${pyside_SUFFIX}/typesystems) DESTINATION share/PySide${pyside_SUFFIX}/typesystems)

View file

@ -37,14 +37,12 @@ else()
endif() endif()
if(ENABLE_WIN) if(ENABLE_WIN)
set(QtCore_typesystem "typesystem_core_win.xml") set(SPECIFIC_OS_FILES
set(QtCore_extra_SRC
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/msg_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/msg_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/point_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/point_wrapper.cpp
) )
else() else()
set(QtCore_typesystem "typesystem_core.xml") set(SPECIFIC_OS_FILES "")
set(QtCore_extra_SRC "")
endif() endif()
set(QtCore_SRC 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 ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/qxmlstreamwriter_wrapper.cpp
${QtCore_46_SRC} ${QtCore_46_SRC}
${QtCore_47_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} set(QtCore_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/${BINDING_NAME}/QtCore/ ${CMAKE_CURRENT_BINARY_DIR}/${BINDING_NAME}/QtCore/
${QT_INCLUDE_DIR} ${QT_INCLUDE_DIR}
@ -168,4 +170,4 @@ create_pyside_module(QtCore
QtCore_typesystem_path QtCore_typesystem_path
QtCore_SRC QtCore_SRC
QtCore_gluecode QtCore_gluecode
${CMAKE_CURRENT_SOURCE_DIR}/${QtCore_typesystem}) ${CMAKE_CURRENT_BINARY_DIR}/typesystem_core.xml)

View file

@ -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));
}
};
}

View file

@ -18,7 +18,7 @@ static Py_ssize_t SbkQByteArray_readbufferproc(PyObject* self, Py_ssize_t segmen
if (segment || !Shiboken::Object::isValid(self)) if (segment || !Shiboken::Object::isValid(self))
return -1; return -1;
QByteArray* cppSelf = Shiboken::Converter<QByteArray*>::toCpp(self); QByteArray* cppSelf = %CONVERTTOCPP[QByteArray*](self);
*ptrptr = reinterpret_cast<void*>(cppSelf->data()); *ptrptr = reinterpret_cast<void*>(cppSelf->data());
return cppSelf->size(); return cppSelf->size();
} }

View file

@ -93,7 +93,7 @@ qreal PySideEasingCurveFunctor::operator()(qreal progress)
PyObject* result = PyObject_CallObject(m_func, args); PyObject* result = PyObject_CallObject(m_func, args);
qreal cppResult = 0.0; qreal cppResult = 0.0;
if (result) { if (result) {
cppResult = Shiboken::Converter<qreal>::toCpp(result); Shiboken::Conversions::pythonToCppCopy(Shiboken::Conversions::PrimitiveTypeConverter<qreal>(), result, &cppResult);
Py_DECREF(result); Py_DECREF(result);
} }
Py_DECREF(args); Py_DECREF(args);

View file

@ -8,18 +8,18 @@ static bool isDecorator(PyObject* method, PyObject* self)
reinterpret_cast<PyMethodObject*>(method)->im_func; reinterpret_cast<PyMethodObject*>(method)->im_func;
} }
static bool getReceiver(QObject *source, PyObject* callback, QObject** receiver, PyObject** self) static bool getReceiver(QObject *source, const char* signal, PyObject* callback, QObject** receiver, PyObject** self, QByteArray* callbackSig)
{ {
bool forceGlobalReceiver = false; bool forceGlobalReceiver = false;
if (PyMethod_Check(callback)) { if (PyMethod_Check(callback)) {
*self = PyMethod_GET_SELF(callback); *self = PyMethod_GET_SELF(callback);
if (Shiboken::Converter<QObject*>::checkType(*self)) if (%CHECKTYPE[QObject*](*self))
*receiver = Shiboken::Converter<QObject*>::toCpp(*self); *receiver = %CONVERTTOCPP[QObject*](*self);
forceGlobalReceiver = isDecorator(callback, *self); forceGlobalReceiver = isDecorator(callback, *self);
} else if (PyCFunction_Check(callback)) { } else if (PyCFunction_Check(callback)) {
*self = PyCFunction_GET_SELF(callback); *self = PyCFunction_GET_SELF(callback);
if (*self && Shiboken::Converter<QObject*>::checkType(*self)) if (*self && %CHECKTYPE[QObject*](*self))
*receiver = Shiboken::Converter<QObject*>::toCpp(*self); *receiver = %CONVERTTOCPP[QObject*](*self);
} else if (PyCallable_Check(callback)) { } else if (PyCallable_Check(callback)) {
// Ok, just a callable object // Ok, just a callable object
*receiver = 0; *receiver = 0;
@ -27,9 +27,20 @@ static bool getReceiver(QObject *source, PyObject* callback, QObject** receiver,
} }
bool usingGlobalReceiver = !*receiver || forceGlobalReceiver; bool usingGlobalReceiver = !*receiver || forceGlobalReceiver;
// Check if this callback is a overwrite of a non-virtual Qt slot.
if (!usingGlobalReceiver && receiver && self) {
*callbackSig = PySide::Signal::getCallbackSignature(signal, *receiver, callback, usingGlobalReceiver).toAscii();
const QMetaObject* metaObject = (*receiver)->metaObject();
int slotIndex = metaObject->indexOfSlot(callbackSig->constData());
if (slotIndex != -1 && slotIndex < metaObject->methodOffset() && PyMethod_Check(callback))
usingGlobalReceiver = true;
}
if (usingGlobalReceiver) { if (usingGlobalReceiver) {
PySide::SignalManager& signalManager = PySide::SignalManager::instance(); PySide::SignalManager& signalManager = PySide::SignalManager::instance();
*receiver = signalManager.globalReceiver(source, callback); *receiver = signalManager.globalReceiver(source, callback);
*callbackSig = PySide::Signal::getCallbackSignature(signal, *receiver, callback, usingGlobalReceiver).toAscii();
} }
return usingGlobalReceiver; return usingGlobalReceiver;
@ -68,14 +79,15 @@ static bool qobjectConnectCallback(QObject* source, const char* signal, PyObject
// Extract receiver from callback // Extract receiver from callback
QObject* receiver = 0; QObject* receiver = 0;
PyObject* self = 0; PyObject* self = 0;
bool usingGlobalReceiver = getReceiver(source, callback, &receiver, &self); QByteArray callbackSig;
bool usingGlobalReceiver = getReceiver(source, signal, callback, &receiver, &self, &callbackSig);
if (receiver == 0 && self == 0) if (receiver == 0 && self == 0)
return false; return false;
const QMetaObject* metaObject = receiver->metaObject(); const QMetaObject* metaObject = receiver->metaObject();
const QByteArray callbackSig = PySide::Signal::getCallbackSignature(signal, receiver, callback, usingGlobalReceiver).toAscii();
const char* slot = callbackSig.constData(); const char* slot = callbackSig.constData();
int slotIndex = metaObject->indexOfSlot(slot); int slotIndex = metaObject->indexOfSlot(slot);
if (slotIndex == -1) { if (slotIndex == -1) {
if (!usingGlobalReceiver && self && !Shiboken::Object::hasCppWrapper((SbkObject*)self)) { if (!usingGlobalReceiver && self && !Shiboken::Object::hasCppWrapper((SbkObject*)self)) {
qWarning() << "You can't add dynamic slots on an object originated from C++."; qWarning() << "You can't add dynamic slots on an object originated from C++.";
@ -128,7 +140,8 @@ static bool qobjectDisconnectCallback(QObject* source, const char* signal, PyObj
// Extract receiver from callback // Extract receiver from callback
QObject* receiver = 0; QObject* receiver = 0;
PyObject* self = 0; PyObject* self = 0;
bool usingGlobalReceiver = getReceiver(NULL, callback, &receiver, &self); QByteArray callbackSig;
bool usingGlobalReceiver = getReceiver(NULL, signal, callback, &receiver, &self, &callbackSig);
if (receiver == 0 && self == 0) if (receiver == 0 && self == 0)
return false; return false;
@ -136,21 +149,18 @@ static bool qobjectDisconnectCallback(QObject* source, const char* signal, PyObj
int signalIndex = source->metaObject()->indexOfSignal(++signal); int signalIndex = source->metaObject()->indexOfSignal(++signal);
int slotIndex = -1; int slotIndex = -1;
const QByteArray callbackSig = PySide::Signal::getCallbackSignature(signal, receiver, callback, usingGlobalReceiver).toAscii(); slotIndex = metaObject->indexOfSlot(callbackSig);
QByteArray qtSlotName(callbackSig);
slotIndex = metaObject->indexOfSlot(qtSlotName);
if (QMetaObject::disconnectOne(source, signalIndex, receiver, slotIndex)) { if (QMetaObject::disconnectOne(source, signalIndex, receiver, slotIndex)) {
if (usingGlobalReceiver) if (usingGlobalReceiver)
signalManager.releaseGlobalReceiver(source, receiver); signalManager.releaseGlobalReceiver(source, receiver);
#ifndef AVOID_PROTECTED_HACK #ifndef AVOID_PROTECTED_HACK
source->disconnectNotify(qtSlotName); source->disconnectNotify(callbackSig);
#else #else
// Need to cast to QObjectWrapper* and call the public version of // Need to cast to QObjectWrapper* and call the public version of
// connectNotify when avoiding the protected hack. // connectNotify when avoiding the protected hack.
reinterpret_cast<QObjectWrapper*>(source)->disconnectNotify(qtSlotName); reinterpret_cast<QObjectWrapper*>(source)->disconnectNotify(callbackSig);
#endif #endif
return true; return true;
} }

View file

@ -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);

View file

@ -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);
}
};
}

View file

@ -1,34 +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)
|| (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 (PyString_Check(pyObj))
return QByteArray(PyString_AS_STRING(pyObj), PyString_GET_SIZE(pyObj));
else
return ValueTypeConverter<QByteArray>::toCpp(pyObj);
}
inline PyObject* Converter<QByteArray>::toPython(const ::QByteArray& cppObj)
{
return ValueTypeConverter<QByteArray>::toPython(cppObj);
}
}

View file

@ -1,35 +0,0 @@
namespace Shiboken {
template<>
struct Converter<QChar>
{
static bool checkType(PyObject* pyObj)
{
return PyString_Check(pyObj) && (PyString_Size(pyObj) == 1);
}
static bool isConvertible(PyObject* pyObj)
{
return (PyString_Check(pyObj) && (PyString_Size(pyObj) == 1))
|| pyObj == Py_None
|| PyInt_Check(pyObj);
}
static QChar toCpp(PyObject* pyObj)
{
if (PyString_Check(pyObj) && PyString_Size(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;
}
};
}

View file

@ -1,49 +0,0 @@
#define PySideDateTime_IMPORT \
PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_Import((char*)"datetime", \
(char*)"datetime_CAPI")
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);
}
}
}

View file

@ -1,52 +0,0 @@
#define PySideDateTime_IMPORT \
PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_Import((char*)"datetime", \
(char*)"datetime_CAPI")
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);
}
}
}

View file

@ -1,4 +0,0 @@
namespace Shiboken {
template<typename KT, typename VT>
struct Converter<QHash<KT, VT> > : QtDictConverter<QHash<KT, VT> > {};
}

View file

@ -1,4 +0,0 @@
namespace Shiboken {
template<typename T>
struct Converter<QList<T> > : StdListConverter<QList<T> > {};
}

View file

@ -1,5 +0,0 @@
namespace Shiboken {
template<typename KT, typename VT>
struct Converter<QMap<KT, VT> > : QtDictConverter<QMap<KT, VT> > {
};
}

View file

@ -1,5 +0,0 @@
namespace Shiboken {
template<typename KT, typename VT>
struct Converter<QMultiMap<KT, VT> > : QtMultiMapConverter<QMap<KT, VT> > {
};
}

View file

@ -1,4 +0,0 @@
namespace Shiboken {
template<typename FT, typename ST>
struct Converter<QPair<FT, ST> > : StdPairConverter<QPair<FT, ST> > {};
}

View file

@ -1,4 +0,0 @@
namespace Shiboken {
template<typename T>
struct Converter<QSet<T> > : QSequenceConverter<QSet<T> > {};
}

View file

@ -1,4 +0,0 @@
namespace Shiboken {
template<typename T>
struct Converter<QStack<T> > : StdListConverter<QStack<T> > {};
}

View file

@ -1,51 +0,0 @@
namespace Shiboken {
template<>
inline PyTypeObject* SbkType<QString>()
{
return &PyUnicode_Type;
}
template<>
struct Converter<QString>
{
static bool checkType(PyObject* pyObj)
{
return PyString_Check(pyObj) || PyUnicode_Check(pyObj);
}
static bool isConvertible(PyObject* pyObj)
{
return PyString_Check(pyObj)
|| PyUnicode_Check(pyObj)
|| pyObj == Py_None;
}
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 (PyString_Check(pyObj)) {
return QString(Converter<const char * >::toCpp(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;
}
};
}

View file

@ -1,5 +0,0 @@
namespace Shiboken
{
template<>
struct Converter<QStringList> : StdListConverter<QStringList> {};
}

View file

@ -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();
}
};
}

View file

@ -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);
}
}
}

View file

@ -1,216 +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 (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);
}
};
}

View file

@ -1,87 +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 (pyObj == reinterpret_cast<PyObject*>(&PyString_Type) || pyObj == reinterpret_cast<PyObject*>(&PyUnicode_Type))
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 (PyString_Check(pyObj))
typeName = PyString_AS_STRING(pyObj);
else if (PyUnicode_Check(pyObj))
typeName = PyString_AsString(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);
}
};
}

View file

@ -1,4 +0,0 @@
namespace Shiboken {
template<typename T>
struct Converter<QVector<T> > : StdListConverter<QVector<T> > {};
}

View 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>

View 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>

View 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>

View file

@ -19,9 +19,33 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
--> -->
<typesystem package="PySide.QtCore"> <typesystem package="PySide.QtCore">
<primitive-type name="HWND__"> <primitive-type name="Qt::HANDLE" target-lang-api-name="PyObject" />
<conversion-rule file="glue/hwnd_conversions.h"/> <primitive-type name="HWND">
<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> </primitive-type>
<inject-code class="native" position="beginning">
<insert-template name="checkPyCapsuleOrPyCObject_func"/>
</inject-code>
<value-type name="POINT"> <value-type name="POINT">
<include file-name="wtypes.h" location="global"/> <include file-name="wtypes.h" location="global"/>
</value-type> </value-type>
@ -30,6 +54,4 @@
</value-type> </value-type>
<suppress-warning text="class 'MSG' inherits from unknown base class 'tagMSG'"/> <suppress-warning text="class 'MSG' inherits from unknown base class 'tagMSG'"/>
<suppress-warning text="class not found for setup inheritance 'tagMSG'"/> <suppress-warning text="class not found for setup inheritance 'tagMSG'"/>
<load-typesystem name="typesystem_core.xml" generate="yes"/>
</typesystem> </typesystem>

View 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>

View file

@ -23,7 +23,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtDeclarative/qdeclarativeview_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtDeclarative/qtdeclarative_module_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} set(QtDeclarative_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
${QT_QTCORE_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR}

View file

@ -93,8 +93,8 @@ int PySide::qmlRegisterType(PyObject* pyObj, const char* uri, int versionMajor,
{ {
using namespace Shiboken; using namespace Shiboken;
static PyTypeObject* qobjectType = TypeResolver::get("QObject*")->pythonType(); static PyTypeObject* qobjectType = Shiboken::Conversions::getPythonTypeObject("QObject*");
static PyTypeObject* qdeclarativeType = TypeResolver::get("QDeclarativeItem*")->pythonType(); static PyTypeObject* qdeclarativeType = Shiboken::Conversions::getPythonTypeObject("QDeclarativeItem*");
assert(qobjectType); assert(qobjectType);
static int nextType = 0; 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))); QMetaObject* metaObject = reinterpret_cast<QMetaObject*>(ObjectType::getTypeUserData(reinterpret_cast<SbkObjectType*>(pyObj)));
Q_ASSERT(metaObject); 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... :-) // All ready... now the ugly code begins... :-)
pyTypes[nextType] = pyObj; pyTypes[nextType] = pyObj;
@ -197,12 +200,11 @@ void propListTpFree(void* self)
PySideProperty* pySelf = reinterpret_cast<PySideProperty*>(self); PySideProperty* pySelf = reinterpret_cast<PySideProperty*>(self);
delete reinterpret_cast<DeclarativeListProperty*>(PySide::Property::userData(pySelf)); delete reinterpret_cast<DeclarativeListProperty*>(PySide::Property::userData(pySelf));
// calls base type constructor // calls base type constructor
pySelf->ob_type->tp_base->tp_free(self); Py_TYPE(pySelf)->tp_base->tp_free(self);
} }
PyTypeObject PropertyListType = { PyTypeObject PropertyListType = {
PyObject_HEAD_INIT(0) PyVarObject_HEAD_INIT(0, 0)
0, /*ob_size*/
"ListProperty", /*tp_name*/ "ListProperty", /*tp_name*/
sizeof(PySideProperty), /*tp_basicsize*/ sizeof(PySideProperty), /*tp_basicsize*/
0, /*tp_itemsize*/ 0, /*tp_itemsize*/
@ -256,7 +258,10 @@ PyTypeObject PropertyListType = {
void propListAppender(QDeclarativeListProperty<QDeclarativeItem>* propList, QDeclarativeItem* item) void propListAppender(QDeclarativeListProperty<QDeclarativeItem>* propList, QDeclarativeItem* item)
{ {
Shiboken::GilState state; 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); DeclarativeListProperty* data = reinterpret_cast<DeclarativeListProperty*>(propList->data);
Shiboken::AutoDecRef retVal(PyObject_CallObject(data->append, args)); Shiboken::AutoDecRef retVal(PyObject_CallObject(data->append, args));
@ -269,42 +274,50 @@ void propListAppender(QDeclarativeListProperty<QDeclarativeItem>* propList, QDec
int propListCount(QDeclarativeListProperty<QDeclarativeItem>* propList) int propListCount(QDeclarativeListProperty<QDeclarativeItem>* propList)
{ {
Shiboken::GilState state; 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); DeclarativeListProperty* data = reinterpret_cast<DeclarativeListProperty*>(propList->data);
Shiboken::AutoDecRef retVal(PyObject_CallObject(data->count, args)); Shiboken::AutoDecRef retVal(PyObject_CallObject(data->count, args));
// Check return type // Check return type
int cppResult = 0;
PythonToCppFunc pythonToCpp;
if (PyErr_Occurred()) if (PyErr_Occurred())
PyErr_Print(); PyErr_Print();
else if (Shiboken::Converter<int>::isConvertible(retVal)) else if ((pythonToCpp = Shiboken::Conversions::isPythonToCppConvertible(Shiboken::Conversions::PrimitiveTypeConverter<int>(), retVal)))
return Shiboken::Converter<int>::toCpp(retVal); pythonToCpp(retVal, &cppResult);
return cppResult;
return 0;
} }
// Implementation of QDeclarativeListProperty<T>::AtFunction callback // Implementation of QDeclarativeListProperty<T>::AtFunction callback
QDeclarativeItem* propListAt(QDeclarativeListProperty<QDeclarativeItem>* propList, int index) QDeclarativeItem* propListAt(QDeclarativeListProperty<QDeclarativeItem>* propList, int index)
{ {
Shiboken::GilState state; 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); DeclarativeListProperty* data = reinterpret_cast<DeclarativeListProperty*>(propList->data);
Shiboken::AutoDecRef retVal(PyObject_CallObject(data->at, args)); Shiboken::AutoDecRef retVal(PyObject_CallObject(data->at, args));
QDeclarativeItem* result = 0;
if (PyErr_Occurred()) if (PyErr_Occurred())
PyErr_Print(); PyErr_Print();
else if (PyType_IsSubtype(Py_TYPE(retVal), data->type)) else if (PyType_IsSubtype(Py_TYPE(retVal), data->type))
return Shiboken::Converter<QDeclarativeItem*>::toCpp(retVal); Shiboken::Conversions::pythonToCppPointer((SbkObjectType*)SbkPySide_QtCoreTypes[SBK_QDECLARATIVEITEM_IDX], retVal, &result);
return result;
return 0;
} }
// Implementation of QDeclarativeListProperty<T>::ClearFunction callback // Implementation of QDeclarativeListProperty<T>::ClearFunction callback
void propListClear(QDeclarativeListProperty<QDeclarativeItem>* propList) void propListClear(QDeclarativeListProperty<QDeclarativeItem>* propList)
{ {
Shiboken::GilState state; 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); DeclarativeListProperty* data = reinterpret_cast<DeclarativeListProperty*>(propList->data);
Shiboken::AutoDecRef retVal(PyObject_CallObject(data->clear, args)); Shiboken::AutoDecRef retVal(PyObject_CallObject(data->clear, args));
@ -320,7 +333,9 @@ static void propListMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::Ca
return; return;
DeclarativeListProperty* data = reinterpret_cast<DeclarativeListProperty*>(PySide::Property::userData(pp)); 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) if (data->count)
declProp.count = &propListCount; declProp.count = &propListCount;

View file

@ -60,8 +60,7 @@
</enum-type> </enum-type>
<inject-code class="target" position="end"> <inject-code class="target" position="end">
Shiboken::TypeResolver::createValueTypeResolver&lt; QList&lt;QObject*&gt; &gt;("QList&lt;QObject*&gt;"); PySide::initQmlSupport(module);
PySide::initQmlSupport(module);
</inject-code> </inject-code>
<object-type name="QDeclarativeExtensionInterface"/> <object-type name="QDeclarativeExtensionInterface"/>
@ -92,9 +91,35 @@
<parent index="this" action="add" /> <parent index="this" action="add" />
</modify-argument> </modify-argument>
</modify-function> </modify-function>
<modify-function signature="importPlugin(QString,QString,QString*)">
<modify-argument index="3">
<remove-argument/>
</modify-argument>
<modify-argument index="return">
<replace-type modified-type="(ok, errorString)" />
</modify-argument>
<inject-code class="target" position="beginning">
QString errorString;
%BEGIN_ALLOW_THREADS
%RETURN_TYPE ok_ = %CPPSELF.%FUNCTION_NAME(%1, %2, &amp;errorString);
%END_ALLOW_THREADS
%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> </object-type>
<value-type name="QDeclarativeError" /> <value-type name="QDeclarativeError" />
<object-type name="QDeclarativeExpression" /> <object-type name="QDeclarativeExpression">
<modify-function signature="evaluate(bool*)">
<modify-argument index="1">
<remove-argument/>
</modify-argument>
<inject-code class="target" position="beginning">
<insert-template name="fix_bool*"/>
</inject-code>
</modify-function>
</object-type>
<object-type name="QDeclarativeExtensionPlugin" /> <object-type name="QDeclarativeExtensionPlugin" />
<object-type name="QDeclarativeImageProvider"> <object-type name="QDeclarativeImageProvider">
<enum-type name="ImageType" /> <enum-type name="ImageType" />

View file

@ -15,7 +15,6 @@ if(ENABLE_X11)
endif() endif()
endif() endif()
if (${QT_VERSION_MAJOR} EQUAL 4 AND ${QT_VERSION_MINOR} LESS 6) if (${QT_VERSION_MAJOR} EQUAL 4 AND ${QT_VERSION_MINOR} LESS 6)
set(QtGui_46_SRC "") set(QtGui_46_SRC "")
else() else()
@ -60,6 +59,14 @@ else()
) )
endif () 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_OPTIONAL_SRC )
set(QtGui_DROPPED_ENTRIES ) set(QtGui_DROPPED_ENTRIES )
check_qt_class(QtGui QAbstractPageSetupDialog QtGui_OPTIONAL_SRC 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} ${SPECIFIC_OS_FILES}
${QPYTEXTOBJECT_MOC} ${QPYTEXTOBJECT_MOC}
${QtGui_46_SRC} ${QtGui_46_SRC}
${QtGui_47_SRC}
${QtGui_OPTIONAL_SRC} ${QtGui_OPTIONAL_SRC}
) )
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/typesystem_gui.xml.in" configure_file("${CMAKE_CURRENT_SOURCE_DIR}/typesystem_gui.xml.in"
"${CMAKE_CURRENT_BINARY_DIR}/typesystem_gui.xml" @ONLY) "${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} set(QtGui_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/
${pyside_SOURCE_DIR} ${pyside_SOURCE_DIR}

View file

@ -1,13 +1,10 @@
#ifndef QLAYOUT_HELP_FUNCTIONS
#define QLAYOUT_HELP_FUNCTIONS
void addLayoutOwnership(QLayout* layout, QLayoutItem* item); void addLayoutOwnership(QLayout* layout, QLayoutItem* item);
void removeLayoutOwnership(QLayout* layout, QWidget* widget); void removeLayoutOwnership(QLayout* layout, QWidget* widget);
inline QByteArray retrieveObjectName(PyObject* obj) inline QByteArray retrieveObjectName(PyObject* obj)
{ {
Shiboken::AutoDecRef objName(PyObject_Str(obj)); Shiboken::AutoDecRef objName(PyObject_Str(obj));
return PyString_AsString(objName); return Shiboken::String::toCString(objName);
} }
inline void addLayoutOwnership(QLayout* layout, QWidget* widget) inline void addLayoutOwnership(QLayout* layout, QWidget* widget)
@ -16,21 +13,20 @@ inline void addLayoutOwnership(QLayout* layout, QWidget* widget)
QWidget *lw = layout->parentWidget(); QWidget *lw = layout->parentWidget();
QWidget *pw = widget->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) if (pw && lw && pw != lw)
Shiboken::Object::setParent(0, pyChild); Shiboken::Object::setParent(0, pyChild);
if (!lw && !pw) { if (!lw && !pw) {
//keep the reference while the layout is orphan //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); Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true);
} else { } else {
if (!lw) if (!lw)
lw = pw; lw = pw;
Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](lw));
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(lw));
Shiboken::Object::setParent(pyParent, pyChild); Shiboken::Object::setParent(pyParent, pyChild);
} }
} }
@ -41,8 +37,8 @@ inline void addLayoutOwnership(QLayout* layout, QLayout* other)
QWidget* parent = layout->parentWidget(); QWidget* parent = layout->parentWidget();
if (!parent) { if (!parent) {
//keep the reference while the layout is orphan //keep the reference while the layout is orphan
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QLayout*>::toPython(layout)); Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QLayout*](layout));
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayout*>::toPython(other)); Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayout*](other));
Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true); Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true);
return; return;
} }
@ -51,18 +47,19 @@ inline void addLayoutOwnership(QLayout* layout, QLayout* other)
QLayoutItem* item = other->itemAt(i); QLayoutItem* item = other->itemAt(i);
if (PyErr_Occurred() || !item) if (PyErr_Occurred() || !item)
return; return;
addLayoutOwnership(layout, item); addLayoutOwnership(layout, item);
} }
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QLayout*>::toPython(layout)); Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QLayout*](layout));
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayout*>::toPython(other)); Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayout*](other));
Shiboken::Object::setParent(pyParent, pyChild); Shiboken::Object::setParent(pyParent, pyChild);
} }
inline void addLayoutOwnership(QLayout* layout, QLayoutItem* item) inline void addLayoutOwnership(QLayout* layout, QLayoutItem* item)
{ {
if (!item)
return;
QWidget* w = item->widget(); QWidget* w = item->widget();
if (w) if (w)
addLayoutOwnership(layout, w); addLayoutOwnership(layout, w);
@ -72,8 +69,8 @@ inline void addLayoutOwnership(QLayout* layout, QLayoutItem* item)
addLayoutOwnership(layout, l); addLayoutOwnership(layout, l);
} }
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QLayout*>::toPython(layout)); Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QLayout*](layout));
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayoutItem*>::toPython(item)); Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayoutItem*](item));
Shiboken::Object::setParent(pyParent, pyChild); Shiboken::Object::setParent(pyParent, pyChild);
} }
@ -83,13 +80,13 @@ static void removeWidgetFromLayout(QLayout* layout, QWidget* widget)
if (!parent) { if (!parent) {
//remove reference on layout //remove reference on layout
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(layout)); Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](layout));
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QWidget*>::toPython(widget)); Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget*](widget));
Shiboken::Object::removeReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild); Shiboken::Object::removeReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild);
} else { } else {
//give the ownership to parent //give the ownership to parent
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(parent)); Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](parent));
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QWidget*>::toPython(widget)); Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget*](widget));
Shiboken::Object::setParent(pyParent, pyChild); Shiboken::Object::setParent(pyParent, pyChild);
} }
} }
@ -105,7 +102,7 @@ inline void removeLayoutOwnership(QLayout* layout, QLayoutItem* item)
removeLayoutOwnership(layout, l); removeLayoutOwnership(layout, l);
} }
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayoutItem*>::toPython(item)); Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayoutItem*](item));
Shiboken::Object::invalidate(pyChild); Shiboken::Object::invalidate(pyChild);
Shiboken::Object::setParent(0, pyChild); Shiboken::Object::setParent(0, pyChild);
} }
@ -123,5 +120,3 @@ inline void removeLayoutOwnership(QLayout* layout, QWidget* widget)
removeLayoutOwnership(layout, item); removeLayoutOwnership(layout, item);
} }
} }
#endif

View file

@ -1,4 +1,3 @@
inline PyObject* addActionWithPyObject(QMenu* self, const QIcon& icon, const QString& text, PyObject* callback, const QKeySequence& shortcut) inline PyObject* addActionWithPyObject(QMenu* self, const QIcon& icon, const QString& text, PyObject* callback, const QKeySequence& shortcut)
{ {
QAction* act = new QAction(text, self); QAction* act = new QAction(text, self);
@ -11,7 +10,7 @@ inline PyObject* addActionWithPyObject(QMenu* self, const QIcon& icon, const QSt
self->addAction(act); 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)); Shiboken::AutoDecRef result(PyObject_CallMethod(pyAct, "connect", "OsO", pyAct, SIGNAL(triggered()), callback));
if (result.isNull()) { if (result.isNull()) {
Py_DECREF(pyAct); Py_DECREF(pyAct);

View file

@ -5,7 +5,7 @@ addActionWithPyObject(QMenuBar* self, const QString& text, PyObject* callback)
self->addAction(act); self->addAction(act);
PyObject* pyAct = Shiboken::Converter<QAction*>::toPython(act); PyObject* pyAct = %CONVERTTOPYTHON[QAction*](act);
PyObject* result = PyObject_CallMethod(pyAct, "connect", "OsO", pyAct, PyObject* result = PyObject_CallMethod(pyAct, "connect", "OsO", pyAct,
SIGNAL(triggered(bool)), callback); SIGNAL(triggered(bool)), callback);

View file

@ -1,6 +1,6 @@
// Init qApp macro to None. // Init qApp macro to None.
if (qApp) { if (qApp) {
PyObject* pyApp = Shiboken::Converter<QApplication*>::toPython(qApp); PyObject* pyApp = %CONVERTTOPYTHON[QApplication*](qApp);
Py_INCREF(pyApp); Py_INCREF(pyApp);
PyModule_AddObject(module, "qApp", pyApp); PyModule_AddObject(module, "qApp", pyApp);
} else { } else {

View file

@ -1,7 +1,7 @@
static QString retrieveObjectName(PyObject *obj) static QString retrieveObjectName(PyObject *obj)
{ {
Shiboken::AutoDecRef objName(PyObject_Str(obj)); Shiboken::AutoDecRef objName(PyObject_Str(obj));
return QString(PyString_AsString(objName)); return QString(Shiboken::String::toCString(objName));
} }
@ -10,7 +10,7 @@ static QString retrieveObjectName(PyObject *obj)
**/ **/
static inline void qwidgetReparentLayout(QWidget *parent, QLayout *layout) 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++) { for (int i=0; i < layout->count(); i++) {
QLayoutItem* item = layout->itemAt(i); QLayoutItem* item = layout->itemAt(i);
@ -21,7 +21,7 @@ static inline void qwidgetReparentLayout(QWidget *parent, QLayout *layout)
if (w) { if (w) {
QWidget* pw = w->parentWidget(); QWidget* pw = w->parentWidget();
if (pw != parent) { if (pw != parent) {
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QWidget*>::toPython(w)); Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget*](w));
Shiboken::Object::setParent(pyParent, pyChild); Shiboken::Object::setParent(pyParent, pyChild);
} }
} else { } 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); Shiboken::Object::setParent(pyParent, pyChild);
//remove previous references //remove previous references
Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(pyChild.object()), qPrintable(retrieveObjectName(pyChild)), Py_None); 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 && oldParent != self) {
if (oldParent->isWidgetType()) { if (oldParent->isWidgetType()) {
// remove old parent policy // remove old parent policy
Shiboken::AutoDecRef pyLayout(Shiboken::Converter<QLayout*>::toPython(layout)); Shiboken::AutoDecRef pyLayout(%CONVERTTOPYTHON[QLayout*](layout));
Shiboken::Object::setParent(Py_None, pyLayout); Shiboken::Object::setParent(Py_None, pyLayout);
} else { } else {
PyErr_Format(PyExc_RuntimeError, "QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", when the QLayout already has a parent", PyErr_Format(PyExc_RuntimeError, "QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", when the QLayout already has a parent",

View file

@ -1,32 +0,0 @@
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);
}
};
}

View file

@ -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);
}
}

File diff suppressed because it is too large Load diff

View file

@ -19,9 +19,31 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
--> -->
<typesystem package="PySide.QtGui"> <typesystem package="PySide.QtGui">
<primitive-type name="Qt::HANDLE" target-lang-api-name="PyObject" />
<primitive-type name="WId" 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> </primitive-type>
<inject-code class="native" position="beginning">
<insert-template name="checkPyCapsuleOrPyCObject_func"/>
</inject-code>
<enum-type name="QPixmap::HBitmapFormat" /> <enum-type name="QPixmap::HBitmapFormat" />
</typesystem> </typesystem>

View file

@ -15,7 +15,7 @@ set(QtHelp_SRC
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtHelp/qthelp_module_wrapper.cpp ${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} set(QtHelp_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
${QT_QTCORE_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR}
${QT_QTGUI_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR}

View file

@ -11,7 +11,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/${BINDING_NAME}/QtMaemo5/qmaemo5valuebutton_wrapper.
${CMAKE_CURRENT_BINARY_DIR}/${BINDING_NAME}/QtMaemo5/qtmaemo5_module_wrapper.cpp ${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 # QT_QTMAEMO5_* variables are not defined by CMake
if(NOT QT_QTMAEMO5_INCLUDE_DIR) if(NOT QT_QTMAEMO5_INCLUDE_DIR)

View file

@ -17,7 +17,7 @@ set(QtMultimedia_SRC
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtMultimedia/qvideoframe_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtMultimedia/qvideoframe_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtMultimedia/qtmultimedia_module_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} set(QtMultimedia_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtMultimedia/ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtMultimedia/

View file

@ -37,6 +37,8 @@
<object-type name="QAbstractVideoBuffer"> <object-type name="QAbstractVideoBuffer">
<enum-type name="HandleType"/> <enum-type name="HandleType"/>
<enum-type name="MapMode"/> <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-function signature="map(QAbstractVideoBuffer::MapMode, int*, int*)">
<modify-argument index="0"> <modify-argument index="0">
<replace-type modified-type="PyObject"/> <replace-type modified-type="PyObject"/>
@ -51,6 +53,7 @@
<insert-template name="fix_arg,int*,int*"/> <insert-template name="fix_arg,int*,int*"/>
</inject-code> </inject-code>
</modify-function> </modify-function>
-->
</object-type> </object-type>
<object-type name="QAbstractVideoSurface"> <object-type name="QAbstractVideoSurface">
<enum-type name="Error"/> <enum-type name="Error"/>

View file

@ -56,7 +56,7 @@ ${QtNetwork_47_SRC}
${QtNetwork_OPTIONAL_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} set(QtNetwork_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/
${QT_INCLUDE_DIR} ${QT_INCLUDE_DIR}

View file

@ -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);

View file

@ -136,7 +136,19 @@
<modify-argument index="return"> <modify-argument index="return">
<replace-type modified-type="(data, address, port)"/> <replace-type modified-type="(data, address, port)"/>
</modify-argument> </modify-argument>
<inject-code class="target" position="beginning" file="glue/qudpsocket_read_datagram_glue.cpp"/> <inject-code class="target" position="beginning">
Shiboken::AutoArrayPointer&lt;char&gt; data(%ARGUMENT_NAMES);
QHostAddress ha;
quint16 port;
%BEGIN_ALLOW_THREADS
%RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(data, %ARGUMENT_NAMES, &amp;ha, &amp;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>
<modify-function signature="writeDatagram(const QByteArray&amp;, const QHostAddress&amp;, quint16)" allow-thread="yes"/> <modify-function signature="writeDatagram(const QByteArray&amp;, const QHostAddress&amp;, quint16)" allow-thread="yes"/>
<!-- ### writeDatagram(QByteArray, ...) does the trick --> <!-- ### writeDatagram(QByteArray, ...) does the trick -->
@ -199,6 +211,7 @@
<!-- ### QHostAddress(QIPv6Address) does this --> <!-- ### QHostAddress(QIPv6Address) does this -->
<modify-function signature="QHostAddress(quint8*)" remove="all" /> <modify-function signature="QHostAddress(quint8*)" remove="all" />
<!-- ### --> <!-- ### -->
<modify-function signature="setAddress(quint8*)" remove="all" />
</value-type> </value-type>
<value-type name="QHostInfo"> <value-type name="QHostInfo">

View file

@ -32,7 +32,7 @@ set(QtOpenGL_SRC
${QtOpenGL_47_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} set(QtOpenGL_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
${QT_QTCORE_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR}
${QT_QTGUI_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR}

View file

@ -21,6 +21,21 @@
<typesystem package="PySide.QtOpenGL"> <typesystem package="PySide.QtOpenGL">
<load-typesystem name="typesystem_gui.xml" generate="no" /> <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="QGLColormap::QGLColormapData"/>
<rejection class="QGLContext" field-name="currentCtx"/> <rejection class="QGLContext" field-name="currentCtx"/>
@ -190,9 +205,8 @@
</inject-code> </inject-code>
</modify-function> </modify-function>
<!-- setUniformValueArray --> <!-- 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" > <modify-argument index="2" >
<replace-type modified-type="PySequence" /> <replace-type modified-type="PySequence" />
</modify-argument> </modify-argument>
@ -208,7 +222,7 @@
</inject-code> </inject-code>
</modify-function> </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" > <modify-argument index="2" >
<replace-type modified-type="PySequence" /> <replace-type modified-type="PySequence" />
</modify-argument> </modify-argument>
@ -416,7 +430,7 @@
</inject-code> </inject-code>
</modify-function> </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" > <modify-argument index="2" >
<replace-type modified-type="PySequence" /> <replace-type modified-type="PySequence" />
</modify-argument> </modify-argument>
@ -432,7 +446,7 @@
</inject-code> </inject-code>
</modify-function> </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" > <modify-argument index="2" >
<replace-type modified-type="PySequence" /> <replace-type modified-type="PySequence" />
</modify-argument> </modify-argument>
@ -640,13 +654,20 @@
</inject-code> </inject-code>
</modify-function> </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 --> <!-- ### Use QMatrixZxY overloads -->
<modify-function signature="setUniformValue(int,Array)" remove="all" /> <modify-function signature="setUniformValue(int,Array)" remove="all" />
<modify-function signature="setUniformValue(const char*,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(int,const GLfloat*,int,int)" remove="all" />
<modify-function signature="setAttributeValue(const char*,const float*,int,int)" remove="all" /> <modify-function signature="setAttributeValue(const char*,const GLfloat*,int,int)" remove="all" />
<modify-function signature="setAttributeArray(int, uint, const void*, int, int)" remove="all" since="4.7" /> <modify-function signature="setAttributeArray(int, GLenum, 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="setAttributeArray(const char*, GLenum, const void*, int, int)" remove="all" since="4.7" />
<!-- ### --> <!-- ### -->
</object-type> </object-type>
@ -657,15 +678,13 @@
<enum-type name="UsagePattern" since="4.7"/> <enum-type name="UsagePattern" since="4.7"/>
<modify-function signature="allocate(const void*, int)"> <modify-function signature="allocate(const void*, int)">
<modify-argument index="1"> <modify-argument index="1">
<replace-type modified-type="const QByteArray&amp;"/> <replace-type modified-type="QByteArray&amp;"/>
</modify-argument> </modify-argument>
<modify-argument index="2"> <modify-argument index="2">
<replace-default-expression with="-1"/> <replace-default-expression with="-1"/>
</modify-argument> </modify-argument>
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
int size = %2; int size = (%2 &lt; 0) ? %1.size() : %2;
if (size &lt; 0)
size = %1.size();
%CPPSELF.allocate((const void*) %1.data(), size); %CPPSELF.allocate((const void*) %1.data(), size);
</inject-code> </inject-code>
</modify-function> </modify-function>
@ -697,21 +716,21 @@
QByteArray ret; QByteArray ret;
if (result) if (result)
ret.append((const char*)data, %3); 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; delete[] data;
</inject-code> </inject-code>
</modify-function> </modify-function>
<modify-function signature="write(int, const void*, int)"> <modify-function signature="write(int, const void*, int)">
<modify-argument index="2"> <modify-argument index="2">
<replace-type modified-type="const QByteArray&amp;"/> <replace-type modified-type="QByteArray&amp;"/>
</modify-argument> </modify-argument>
<modify-argument index="3"> <modify-argument index="3">
<replace-default-expression with="-1"/> <replace-default-expression with="-1"/>
</modify-argument> </modify-argument>
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
int size = %3; int size = (%3 &lt; 0) ? %2.size() : %3;
if (size &lt; 0)
size = %2.size();
%CPPSELF.write(%1, (const void*) %2.data(), size); %CPPSELF.write(%1, (const void*) %2.data(), size);
</inject-code> </inject-code>
</modify-function> </modify-function>

View file

@ -25,7 +25,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtScript/qscriptvalueiterator_wrapper.cpp
${QtScript_47_SRC} ${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} set(QtScript_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtScript ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtScript
${QT_INCLUDE_DIR} ${QT_INCLUDE_DIR}

View file

@ -40,11 +40,22 @@
<object-type name="QScriptEngine"> <object-type name="QScriptEngine">
<enum-type name="QObjectWrapOption" flags="QObjectWrapOptions"/> <enum-type name="QObjectWrapOption" flags="QObjectWrapOptions"/>
<enum-type name="ValueOwnership"/> <enum-type name="ValueOwnership"/>
<!-- Not supported BUG #957-->
<modify-function signature="scriptValueFromQMetaObject()" remove="all" />
</object-type> </object-type>
<object-type name="QScriptExtensionInterface"/> <object-type name="QScriptExtensionInterface"/>
<object-type name="QScriptExtensionPlugin"/> <object-type name="QScriptExtensionPlugin"/>
<value-type name="QScriptProgram" since="4.7"/> <value-type name="QScriptProgram" since="4.7"/>
<value-type name="QScriptString"/> <value-type name="QScriptString">
<modify-function signature="toArrayIndex(bool*)const">
<modify-argument index="1">
<remove-argument/>
</modify-argument>
<inject-code class="target" position="beginning">
<insert-template name="fix_bool*"/>
</inject-code>
</modify-function>
</value-type>
<value-type name="QScriptValue"> <value-type name="QScriptValue">
<enum-type name="PropertyFlag" flags="PropertyFlags"/> <enum-type name="PropertyFlag" flags="PropertyFlags"/>
<enum-type name="ResolveFlag" flags="ResolveFlags"/> <enum-type name="ResolveFlag" flags="ResolveFlags"/>
@ -53,16 +64,17 @@
<inject-code class="target" position="beginning"> <inject-code class="target" position="beginning">
if (%CPPSELF.isVariant() || %CPPSELF.isString()) { if (%CPPSELF.isVariant() || %CPPSELF.isString()) {
QString format = QString().sprintf("%s(\"%s\")", ((PyObject*)%PYSELF)->ob_type->tp_name, qPrintable(%CPPSELF.toString())); QString format = QString().sprintf("%s(\"%s\")", ((PyObject*)%PYSELF)->ob_type->tp_name, qPrintable(%CPPSELF.toString()));
%PYARG_0 = PyString_FromString(qPrintable(format)); %PYARG_0 = Shiboken::String::fromCString(qPrintable(format));
} else { } else {
%PYARG_0 = PyObject_Str((PyObject*)%PYSELF); %PYARG_0 = Shiboken::String::fromCString(
((PyObject* )%PYSELF)->ob_type->tp_name);
} }
</inject-code> </inject-code>
</add-function> </add-function>
<add-function signature="__mgetitem__"> <add-function signature="__mgetitem__">
<inject-code> <inject-code>
Shiboken::AutoDecRef key(PyObject_Str(_key)); Shiboken::AutoDecRef key(PyObject_Str(_key));
QVariant res = %CPPSELF.property(PyString_AS_STRING(key.object())).toVariant(); QVariant res = %CPPSELF.property(Shiboken::String::toCString(key.object())).toVariant();
if (res.isValid()) { if (res.isValid()) {
return %CONVERTTOPYTHON[QVariant](res); return %CONVERTTOPYTHON[QVariant](res);
} else { } else {
@ -86,12 +98,16 @@
</add-function> </add-function>
<add-function signature="__next__()" return-type="PyObject*"> <add-function signature="__next__()" return-type="PyObject*">
<inject-code> <inject-code>
if (%CPPSELF.hasNext()) { if (%CPPSELF.hasNext()) {
%CPPSELF.next(); %CPPSELF.next();
%PYARG_0 = Shiboken::makeTuple(%CPPSELF.name(), %CPPSELF.value().toVariant()); QString name = %CPPSELF.name();
} else { QVariant value = %CPPSELF.value().toVariant();
PyErr_SetNone(PyExc_StopIteration); %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> </inject-code>
</add-function> </add-function>
</object-type> </object-type>

View file

@ -5,7 +5,7 @@ set(QtScriptTools_SRC
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtScriptTools/qscriptenginedebugger_wrapper.cpp ${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} set(QtScriptTools_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
${QT_QTCORE_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR}

View file

@ -21,7 +21,7 @@ set(QtSql_SRC
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtSql/qtsql_module_wrapper.cpp ${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} set(QtSql_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
${QT_QTCORE_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR}
${QT_QTGUI_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR}

View file

@ -8,7 +8,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtSvg/qsvgwidget_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtSvg/qtsvg_module_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} set(QtSvg_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtSvg/ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtSvg/
${QT_INCLUDE_DIR} ${QT_INCLUDE_DIR}

View file

@ -14,7 +14,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtTest/qttest_module_wrapper.cpp
${QtTest_46_SRC} ${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} set(QtTest_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtTest/ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtTest/
${QT_INCLUDE_DIR} ${QT_INCLUDE_DIR}

View file

@ -5,7 +5,7 @@ set(QtUiTools_SRC
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtUiTools/quiloader_wrapper.cpp ${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} set(QtUiTools_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
${QT_QTCORE_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR}
${QT_QTGUI_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR}
@ -23,10 +23,10 @@ set(QtUiTools_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
set(QtUiTools_libraries pyside set(QtUiTools_libraries pyside
uiplugin uiplugin
${SHIBOKEN_PYTHON_LIBRARIES} ${SHIBOKEN_PYTHON_LIBRARIES}
${QT_QTCORE_LIBRARY} ${QT_QTUITOOLS_LIBRARY}
${QT_QTGUI_LIBRARY}
${QT_QTDESIGNER_LIBRARY} ${QT_QTDESIGNER_LIBRARY}
${QT_QTUITOOLS_LIBRARY}) ${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY})
set(QtUiTools_deps QtGui QtXml) set(QtUiTools_deps QtGui QtXml)
create_pyside_module(QtUiTools create_pyside_module(QtUiTools
QtUiTools_include_dirs QtUiTools_include_dirs

View file

@ -33,13 +33,13 @@ inline void registerCustomWidget(PyObject* obj)
if (plugin == 0) { if (plugin == 0) {
foreach(QObject* o, QPluginLoader::staticInstances()) { foreach(QObject* o, QPluginLoader::staticInstances()) {
plugin = qobject_cast<PyCustomWidgets*>(o); plugin = qobject_cast<PyCustomWidgets*>(o);
if (o) if (plugin)
break; break;
} }
} }
if (!plugin) if (!plugin)
qDebug() << "Fail to load uiloader plugin"; qDebug() << "Failed to load uiloader plugin.";
else else
plugin->registerWidgetType(obj); plugin->registerWidgetType(obj);
} }

View file

@ -17,7 +17,7 @@ static void createChildrenNameAttributes(PyObject* root, QObject* object)
if (!name.isEmpty() && !name.startsWith("_") && !name.startsWith("qt_")) { if (!name.isEmpty() && !name.startsWith("_") && !name.startsWith("qt_")) {
bool hasAttr = PyObject_HasAttrString(root, name.constData()); bool hasAttr = PyObject_HasAttrString(root, name.constData());
if (!hasAttr) { if (!hasAttr) {
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QObject*>::toPython(child)); Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QObject*](child));
PyObject_SetAttrString(root, name.constData(), pyChild); PyObject_SetAttrString(root, name.constData(), pyChild);
} }
createChildrenNameAttributes(root, child); createChildrenNameAttributes(root, child);
@ -31,14 +31,12 @@ static PyObject* QUiLoadedLoadUiFromDevice(QUiLoader* self, QIODevice* dev, QWid
QWidget* wdg = self->load(dev, parent); QWidget* wdg = self->load(dev, parent);
if (wdg) { if (wdg) {
PyObject* pyWdg = Shiboken::Converter<QWidget*>::toPython(wdg); PyObject* pyWdg = %CONVERTTOPYTHON[QWidget*](wdg);
createChildrenNameAttributes(pyWdg, wdg); createChildrenNameAttributes(pyWdg, wdg);
if (parent) { if (parent) {
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(parent)); Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](parent));
Shiboken::Object::setParent(pyParent, pyWdg); Shiboken::Object::setParent(pyParent, pyWdg);
} }
return pyWdg; return pyWdg;
} }

View file

@ -26,6 +26,7 @@
<extra-includes> <extra-includes>
<include file-name="glue/plugins.h" location="local"/> <include file-name="glue/plugins.h" location="local"/>
</extra-includes> </extra-includes>
<inject-code class="native" position="beginning" file="glue/uitools_loadui.cpp"/>
<inject-code> <inject-code>
Q_IMPORT_PLUGIN(uiplugin); Q_IMPORT_PLUGIN(uiplugin);
</inject-code> </inject-code>
@ -69,34 +70,32 @@
%CPPSELF.addPluginPath(""); // force reload widgets %CPPSELF.addPluginPath(""); // force reload widgets
</inject-code> </inject-code>
</add-function> </add-function>
<modify-function signature="createAction(QObject *, const QString&amp;)"> <modify-function signature="createAction(QObject*, const QString&amp;)">
<modify-argument index="return"> <modify-argument index="return">
<parent index="1" action="add"/> <parent index="1" action="add"/>
</modify-argument> </modify-argument>
</modify-function> </modify-function>
<modify-function signature="createActionGroup(QObject *, const QString&amp;)"> <modify-function signature="createActionGroup(QObject*, const QString&amp;)">
<modify-argument index="return"> <modify-argument index="return">
<parent index="1" action="add"/> <parent index="1" action="add"/>
</modify-argument> </modify-argument>
</modify-function> </modify-function>
<modify-function signature="createLayout(const QString&amp;,QObject *, const QString&amp;)"> <modify-function signature="createLayout(const QString&amp;, QObject*, const QString&amp;)">
<modify-argument index="return"> <modify-argument index="return">
<parent index="2" action="add"/> <parent index="2" action="add"/>
</modify-argument> </modify-argument>
</modify-function> </modify-function>
<modify-function signature="createWidget(const QString&amp;,QWidget*, const QString&amp;)"> <modify-function signature="createWidget(const QString&amp;, QWidget*, const QString&amp;)">
<modify-argument index="return"> <modify-argument index="return">
<parent index="2" action="add"/> <parent index="2" action="add"/>
<define-ownership class="target" owner="default"/>
</modify-argument> </modify-argument>
</modify-function> </modify-function>
<modify-function signature="load(QIODevice*, QWidget*)"> <modify-function signature="load(QIODevice*, QWidget*)">
<extra-includes>
<include file-name="glue/uitools_loadui.h" location="local"/>
</extra-includes>
<modify-argument index="2"> <modify-argument index="2">
<replace-default-expression with="0" /> <replace-default-expression with="0" />
<rename to="parentWidget" /> <rename to="parentWidget" />
@ -112,9 +111,6 @@
<!-- Syntax sugar --> <!-- Syntax sugar -->
<add-function signature="load(QString, QWidget*)" return-type="QWidget*"> <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"> <modify-argument index="2">
<replace-default-expression with="0" /> <replace-default-expression with="0" />
<rename to="parentWidget" /> <rename to="parentWidget" />

View file

@ -37,7 +37,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebKit/webcore_wrapper.cpp
${QtWebKit_46_SRC} ${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} set(QtWebkit_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebkit/ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebkit/
${QT_INCLUDE_DIR} ${QT_INCLUDE_DIR}

View file

@ -81,6 +81,9 @@
<!-- Qt 4.6 --> <!-- Qt 4.6 -->
<enum-type name="ErrorDomain" since="4.6"/> <enum-type name="ErrorDomain" since="4.6"/>
<enum-type name="Extension"/> <enum-type name="Extension"/>
<!-- Qt 4.8 -->
<enum-type name="Feature" since="4.8" revision="4800" />
<enum-type name="PermissionPolicy" since="4.8" revision="4800" />
<value-type name="ChooseMultipleFilesExtensionOption" /> <value-type name="ChooseMultipleFilesExtensionOption" />
<value-type name="ChooseMultipleFilesExtensionReturn" /> <value-type name="ChooseMultipleFilesExtensionReturn" />
@ -95,11 +98,11 @@
// Cast the parameters according to the extension type // Cast the parameters according to the extension type
if (extension == QWebPage::ChooseMultipleFilesExtension) { if (extension == QWebPage::ChooseMultipleFilesExtension) {
const ChooseMultipleFilesExtension$TYPE_SUFFIX* _in = reinterpret_cast&lt;const ChooseMultipleFilesExtension$TYPE_SUFFIX*>(%in); const ChooseMultipleFilesExtension$TYPE_SUFFIX* _in = reinterpret_cast&lt;const ChooseMultipleFilesExtension$TYPE_SUFFIX*>(%in);
%out = %CONVERTTOPYTHON[const ChooseMultipleFilesExtension$TYPE_SUFFIX*](_in); %out = %CONVERTTOPYTHON[const QWebPage::ChooseMultipleFilesExtension$TYPE_SUFFIX*](_in);
#if QT_VERSION >= 0x040600 #if QT_VERSION >= 0x040600
} else if (extension == QWebPage::ErrorPageExtension) { } else if (extension == QWebPage::ErrorPageExtension) {
const ErrorPageExtension$TYPE_SUFFIX* _in = reinterpret_cast&lt;const ErrorPageExtension$TYPE_SUFFIX*>(%in); const ErrorPageExtension$TYPE_SUFFIX* _in = reinterpret_cast&lt;const ErrorPageExtension$TYPE_SUFFIX*>(%in);
%out = %CONVERTTOPYTHON[const ErrorPageExtension$TYPE_SUFFIX*](_in); %out = %CONVERTTOPYTHON[const QWebPage::ErrorPageExtension$TYPE_SUFFIX*](_in);
#endif #endif
} }
</template> </template>

View file

@ -35,7 +35,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtXml/qxmlreader_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtXml/qxmlsimplereader_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} set(QtXml_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtXml ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtXml
${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}

View file

@ -33,14 +33,17 @@
<value-type name="QDomComment" /> <value-type name="QDomComment" />
<template name="qdomdocument_setcontent"> <template name="qdomdocument_setcontent">
QString _errorMsg_; QString _errorMsg_;
int _errorLine_ = 0; int _errorLine_ = 0;
int _errorColumn_ = 0; int _errorColumn_ = 0;
%BEGIN_ALLOW_THREADS
%BEGIN_ALLOW_THREADS bool _ret_ = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &amp;_errorMsg_, &amp;_errorLine_, &amp;_errorColumn_);
bool _ret_ = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &amp;_errorMsg_, &amp;_errorLine_, &amp;_errorColumn_); %END_ALLOW_THREADS
%END_ALLOW_THREADS %PYARG_0 = PyTuple_New(4);
%PYARG_0 = Shiboken::makeTuple(_ret_, _errorMsg_, _errorLine_, _errorColumn_); 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> </template>
<value-type name="QDomDocument"> <value-type name="QDomDocument">
@ -269,13 +272,13 @@
</conversion-rule> </conversion-rule>
</modify-argument> </modify-argument>
<inject-code class="target" position="end"> <inject-code class="target" position="end">
QXmlInputSource* _qxmlinputsource_arg_ = 0; QXmlInputSource* _qxmlinputsource_arg_ = 0;
%BEGIN_ALLOW_THREADS
%BEGIN_ALLOW_THREADS %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(%1, %2, _qxmlinputsource_arg_);
%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(%1, %2, _qxmlinputsource_arg_); %END_ALLOW_THREADS
%END_ALLOW_THREADS %PYARG_0 = PyTuple_New(2);
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](%0));
%PYARG_0 = Shiboken::makeTuple(%0, _qxmlinputsource_arg_); PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QXmlInputSource*](_qxmlinputsource_arg_));
</inject-code> </inject-code>
</modify-function> </modify-function>
</object-type> </object-type>
@ -296,11 +299,13 @@
</conversion-rule> </conversion-rule>
</modify-argument> </modify-argument>
<inject-code class="target" position="end"> <inject-code class="target" position="end">
QXmlInputSource* _qxmlinputsource_arg_ = 0; QXmlInputSource* _qxmlinputsource_arg_ = 0;
%BEGIN_ALLOW_THREADS %BEGIN_ALLOW_THREADS
%RETURN_TYPE %0 = %CPPSELF.%TYPE::%FUNCTION_NAME(%1, %2, _qxmlinputsource_arg_); %RETURN_TYPE %0 = %CPPSELF.%TYPE::%FUNCTION_NAME(%1, %2, _qxmlinputsource_arg_);
%END_ALLOW_THREADS %END_ALLOW_THREADS
%PYARG_0 = Shiboken::makeTuple(%0, _qxmlinputsource_arg_); %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> </inject-code>
</modify-function> </modify-function>
</object-type> </object-type>

View file

@ -26,7 +26,7 @@ set(QtXmlPatterns_SRC
${CMAKE_CURRENT_BINARY_DIR}/PySide/QtXmlPatterns/qxmlserializer_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtXmlPatterns/qxmlserializer_wrapper.cpp
${QtXmlPatterns_46_SRC} ${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} set(QtXmlPatterns_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
${QT_QTCORE_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR}
${QT_QTXMLPATTERNS_INCLUDE_DIR} ${QT_QTXMLPATTERNS_INCLUDE_DIR}

View file

@ -87,7 +87,11 @@
</value-type> </value-type>
<value-type name="QXmlQuery"> <value-type name="QXmlQuery">
<!-- ### TODO: must evaluate if anything other than removal is needed. -->
<enum-type name="QueryLanguage" /> <enum-type name="QueryLanguage" />
<modify-function signature="evaluateTo(QStringList*)const" remove="all" />
<modify-function signature="evaluateTo(QString*)const" remove="all" />
<!-- ### -->
</value-type> </value-type>
<object-type name="QXmlResultItems" /> <object-type name="QXmlResultItems" />
<object-type name="QXmlSerializer" /> <object-type name="QXmlSerializer" />

View file

@ -1,5 +1,3 @@
__all__ = ['QtCore', 'QtGui', 'QtNetwork', 'QtOpenGL', 'QtSql', 'QtSvg', 'QtTest', 'QtWebKit', 'QtScript'] __all__ = ['QtCore', 'QtGui', 'QtNetwork', 'QtOpenGL', 'QtSql', 'QtSvg', 'QtTest', 'QtWebKit', 'QtScript']
import private
__version__ = "@BINDING_API_VERSION_FULL@" __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@) __version_info__ = (@BINDING_API_MAJOR_VERSION@, @BINDING_API_MINOR_VERSION@, @BINDING_API_MICRO_VERSION@, "@BINDING_API_RELEASE_LEVEL@", @BINDING_API_SERIAL@)

View file

@ -49,7 +49,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/phonon/phonon_backendcapabilities_notifierwra
${phonon_OPTIONAL_SRC} ${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} set(phonon_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}
${QT_QTCORE_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR}
${QT_QTGUI_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR}

View file

@ -1,4 +0,0 @@
import atexit
from QtCore import __moduleShutdown
atexit.register(__moduleShutdown)

View file

@ -30,68 +30,80 @@
</template> </template>
<!-- Templates to fix bool* parameters --> <!-- 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*"> <template name="fix_bool*">
bool ok_; bool ok_;
%BEGIN_ALLOW_THREADS %BEGIN_ALLOW_THREADS
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&amp;ok_); %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&amp;ok_);
%END_ALLOW_THREADS %END_ALLOW_THREADS
%PYARG_0 = Shiboken::makeTuple(retval_, ok_); <insert-template name="tuple_retval_ok"/>
</template> </template>
<template name="fix_args,bool*"> <template name="fix_args,bool*">
bool ok_; bool ok_;
%BEGIN_ALLOW_THREADS %BEGIN_ALLOW_THREADS
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &amp;ok_); %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &amp;ok_);
%END_ALLOW_THREADS %END_ALLOW_THREADS
%PYARG_0 = Shiboken::makeTuple(retval_, ok_); <insert-template name="tuple_retval_ok"/>
</template> </template>
<template name="fix_arg,bool*,arg"> <template name="fix_arg,bool*,arg">
bool ok_; bool ok_;
%BEGIN_ALLOW_THREADS %BEGIN_ALLOW_THREADS
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, &amp;ok_, %3); %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, &amp;ok_, %3);
%END_ALLOW_THREADS %END_ALLOW_THREADS
%PYARG_0 = Shiboken::makeTuple(retval_, ok_); <insert-template name="tuple_retval_ok"/>
</template> </template>
<template name="fix_bool*,arg"> <template name="fix_bool*,arg">
bool ok_; bool ok_;
%BEGIN_ALLOW_THREADS %BEGIN_ALLOW_THREADS
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&amp;ok_, %2); %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&amp;ok_, %2);
%END_ALLOW_THREADS %END_ALLOW_THREADS
%PYARG_0 = Shiboken::makeTuple(retval_, ok_); <insert-template name="tuple_retval_ok"/>
</template> </template>
<template name="fix_bool*,arg,arg"> <template name="fix_bool*,arg,arg">
bool ok_; bool ok_;
%BEGIN_ALLOW_THREADS %BEGIN_ALLOW_THREADS
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&amp;ok_, %2, %3); %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&amp;ok_, %2, %3);
%END_ALLOW_THREADS %END_ALLOW_THREADS
%PYARG_0 = Shiboken::makeTuple(retval_, ok_); <insert-template name="tuple_retval_ok"/>
</template> </template>
<template name="fix_bool*,arg,arg,arg"> <template name="fix_bool*,arg,arg,arg">
bool ok_; bool ok_;
%BEGIN_ALLOW_THREADS %BEGIN_ALLOW_THREADS
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&amp;ok_, %2, %3, %4); %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&amp;ok_, %2, %3, %4);
%END_ALLOW_THREADS %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(&amp;ok_, %2, %3, %4, %5);
%END_ALLOW_THREADS
<insert-template name="tuple_retval_ok"/>
</template> </template>
<template name="fix_arg,arg,arg,arg,arg,arg,arg,bool*,arg"> <template name="fix_arg,arg,arg,arg,arg,arg,arg,bool*,arg">
bool ok_; bool ok_;
%BEGIN_ALLOW_THREADS %BEGIN_ALLOW_THREADS
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, %7, &amp;ok_, %9); %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, %7, &amp;ok_, %9);
%END_ALLOW_THREADS %END_ALLOW_THREADS
%PYARG_0 = Shiboken::makeTuple(retval_, ok_); <insert-template name="tuple_retval_ok"/>
</template> </template>
<template name="fix_arg,arg,arg,arg,arg,arg,bool*,arg"> <template name="fix_arg,arg,arg,arg,arg,arg,bool*,arg">
bool ok_; bool ok_;
%BEGIN_ALLOW_THREADS %BEGIN_ALLOW_THREADS
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, &amp;ok_, %8); %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, &amp;ok_, %8);
%END_ALLOW_THREADS %END_ALLOW_THREADS
%PYARG_0 = Shiboken::makeTuple(retval_, ok_); <insert-template name="tuple_retval_ok"/>
</template> </template>
<template name="fix_arg,arg,arg,arg,arg,bool*,arg"> <template name="fix_arg,arg,arg,arg,arg,bool*,arg">
bool ok_; bool ok_;
%BEGIN_ALLOW_THREADS %BEGIN_ALLOW_THREADS
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, &amp;ok_, %7); %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, &amp;ok_, %7);
%END_ALLOW_THREADS %END_ALLOW_THREADS
%PYARG_0 = Shiboken::makeTuple(retval_, ok_); <insert-template name="tuple_retval_ok"/>
</template> </template>
<template name="get_slice"> <template name="get_slice">
%TYPE* sequence; %TYPE* sequence;
@ -136,27 +148,35 @@
</template> </template>
<template name="fix_char*"> <template name="fix_char*">
char val_; char val_;
%BEGIN_ALLOW_THREADS %BEGIN_ALLOW_THREADS
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&amp;val_); %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&amp;val_);
%END_ALLOW_THREADS %END_ALLOW_THREADS
%PYARG_0 = Shiboken::makeTuple(retval_, val_); %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>
<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*"> <template name="fix_number*,number*,number*,number*">
$TYPE a, b, c, d; $TYPE a, b, c, d;
%BEGIN_ALLOW_THREADS %BEGIN_ALLOW_THREADS
%CPPSELF->::%TYPE::%FUNCTION_NAME(&amp;a, &amp;b, &amp;c, &amp;d); %CPPSELF->::%TYPE::%FUNCTION_NAME(&amp;a, &amp;b, &amp;c, &amp;d);
%END_ALLOW_THREADS %END_ALLOW_THREADS
%PYARG_0 = Shiboken::makeTuple(a, b, c, d); <insert-template name="tuple_abcd_same_type"/>
</template> </template>
<template name="fix_number*,number*,number*,number*,args"> <template name="fix_number*,number*,number*,number*,args">
$TYPE a, b, c, d; $TYPE a, b, c, d;
%BEGIN_ALLOW_THREADS %BEGIN_ALLOW_THREADS
%CPPSELF->::%TYPE::%FUNCTION_NAME(&amp;a, &amp;b, &amp;c, &amp;d, %ARGUMENT_NAMES); %CPPSELF->::%TYPE::%FUNCTION_NAME(&amp;a, &amp;b, &amp;c, &amp;d, %ARGUMENT_NAMES);
%END_ALLOW_THREADS %END_ALLOW_THREADS
%PYARG_0 = Shiboken::makeTuple(a, b, c, d); <insert-template name="tuple_abcd_same_type"/>
</template> </template>
<template name="fix_native_return_number*,number*,number*,number*"> <template name="fix_native_return_number*,number*,number*,number*">
@ -176,18 +196,19 @@
} }
</template> </template>
<template name="fix_int*,int*,int*,int*,int*"> <template name="fix_number*,number*,number*,number*,number*">
int a, b, c, d, e; $TYPE a, b, c, d, e;
%BEGIN_ALLOW_THREADS %BEGIN_ALLOW_THREADS
%CPPSELF.%FUNCTION_NAME(&amp;a, &amp;b, &amp;c, &amp;d, &amp;e); %CPPSELF.%FUNCTION_NAME(&amp;a, &amp;b, &amp;c, &amp;d, &amp;e);
%END_ALLOW_THREADS %END_ALLOW_THREADS
%PYARG_0 = Shiboken::makeTuple(a, b, c, d, e); %PYARG_0 = PyTuple_New(5);
</template> PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[$TYPE](a));
<template name="fix_qreal*,qreal*,qreal*,qreal*,qreal*"> PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[$TYPE](b));
qreal a, b, c, d, e; PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[$TYPE](c));
%CPPSELF.%FUNCTION_NAME(&amp;a, &amp;b, &amp;c, &amp;d, &amp;e); PyTuple_SET_ITEM(%PYARG_0, 3, %CONVERTTOPYTHON[$TYPE](d));
%PYARG_0 = Shiboken::makeTuple(a, b, c, d, e); PyTuple_SET_ITEM(%PYARG_0, 4, %CONVERTTOPYTHON[$TYPE](e));
</template> </template>
<template name="read_wrapper"> <template name="read_wrapper">
Shiboken::AutoArrayPointer&lt;char&gt; _data(%2); Shiboken::AutoArrayPointer&lt;char&gt; _data(%2);
qint64 _size = %CPPSELF.%FUNCTION_NAME(_data, %2); qint64 _size = %CPPSELF.%FUNCTION_NAME(_data, %2);
@ -196,21 +217,15 @@
ba = QByteArray(_data, _size); ba = QByteArray(_data, _size);
%PYARG_0 = %CONVERTTOPYTHON[QByteArray](ba); %PYARG_0 = %CONVERTTOPYTHON[QByteArray](ba);
</template> </template>
<template name="fix_return_args,int*">
RETURNTYPE _ret;
int _arg;
%BEGIN_ALLOW_THREADS
_ret = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &amp;_arg);
%END_ALLOW_THREADS
%PYARG_0 = Shiboken::makeTuple(_ret, _arg);
</template>
<template name="fix_args,number*,number*"> <template name="fix_args,number*,number*">
$TYPE a, b; $TYPE a, b;
%BEGIN_ALLOW_THREADS %BEGIN_ALLOW_THREADS
%CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &amp;a, &amp;b); %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &amp;a, &amp;b);
%END_ALLOW_THREADS %END_ALLOW_THREADS
%PYARG_0 = Shiboken::makeTuple(a, b); %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>
<template name="fix_virtual_method_return_value_and_bool*"> <template name="fix_virtual_method_return_value_and_bool*">
@ -221,12 +236,15 @@
</template> </template>
<template name="fix_arg,int*,int*"> <template name="fix_arg,int*,int*">
%RETURN_TYPE _ret; %RETURN_TYPE _ret;
int a, b; int a, b;
%BEGIN_ALLOW_THREADS %BEGIN_ALLOW_THREADS
_ret = %CPPSELF.%FUNCTION_NAME(%1, &amp;a, &amp;b); _ret = %CPPSELF.%FUNCTION_NAME(%1, &amp;a, &amp;b);
%END_ALLOW_THREADS %END_ALLOW_THREADS
%PYARG_0 = Shiboken::makeTuple(_ret, a, b); %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>
<template name="return_QString"> <template name="return_QString">
@ -234,17 +252,22 @@
</template> </template>
<template name="return_tuple_QValidator_QString_int"> <template name="return_tuple_QValidator_QString_int">
%BEGIN_ALLOW_THREADS %BEGIN_ALLOW_THREADS
%RETURN_TYPE retval_ = %RETURN_TYPE(%CPPSELF.%FUNCTION_NAME(%1, %2)); %RETURN_TYPE retval_ = %RETURN_TYPE(%CPPSELF.%FUNCTION_NAME(%1, %2));
%END_ALLOW_THREADS %END_ALLOW_THREADS
%PYARG_0 = Shiboken::makeTuple(retval_, %1, %2); %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>
<template name="return_for_QFileDialog"> <template name="return_for_QFileDialog">
%BEGIN_ALLOW_THREADS %BEGIN_ALLOW_THREADS
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, &amp;%5, %6); %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, &amp;%5, %6);
%END_ALLOW_THREADS %END_ALLOW_THREADS
%PYARG_0 = Shiboken::makeTuple(retval_, %5); %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>
<template name="set_qapp_parent_for_orphan"> <template name="set_qapp_parent_for_orphan">
if (%PYARG_0 &amp;&amp; (%PYARG_0 != Py_None)) { if (%PYARG_0 &amp;&amp; (%PYARG_0 != Py_None)) {
@ -256,7 +279,7 @@
<!-- templates for __repr__ --> <!-- templates for __repr__ -->
<template name="repr_code"> <template name="repr_code">
QString format = QString().sprintf("%s(%REPR_FORMAT)", ((PyObject*)%PYSELF)->ob_type->tp_name, %REPR_ARGS); QString format = QString().sprintf("%s(%REPR_FORMAT)", ((PyObject*)%PYSELF)->ob_type->tp_name, %REPR_ARGS);
%PYARG_0 = PyString_FromString(qPrintable(format)); %PYARG_0 = Shiboken::String::fromCString(qPrintable(format));
</template> </template>
<template name="repr_code_matrix"> <template name="repr_code_matrix">
QString format= QString("%1((").arg(((PyObject*)%PYSELF)->ob_type->tp_name); QString format= QString("%1((").arg(((PyObject*)%PYSELF)->ob_type->tp_name);
@ -272,7 +295,7 @@
} }
format += "))"; format += "))";
%PYARG_0 = PyString_FromString(qPrintable(format)); %PYARG_0 = Shiboken::String::fromCString(qPrintable(format));
</template> </template>
<template name="return_internal_pointer"> <template name="return_internal_pointer">
@ -374,5 +397,32 @@
%PYARG_0 = Py_BuildValue("%TT_FORMAT", %TT_ARGS); %PYARG_0 = Py_BuildValue("%TT_FORMAT", %TT_ARGS);
</template> </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 &lt; PySequence_Size(%in); i++) {
Shiboken::AutoDecRef pyItem(PySequence_GetItem(%in, i));
%OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem);
%out &lt;&lt; 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>

View file

@ -20,7 +20,7 @@ macro(create_pyside_module module_name module_include_dir module_libraries modul
endif() endif()
add_custom_command(OUTPUT ${${module_sources}} add_custom_command(OUTPUT ${${module_sources}}
COMMAND ${GENERATORRUNNER_BINARY} ${GENERATOR_EXTRA_FLAGS} COMMAND ${SHIBOKEN_BINARY} ${GENERATOR_EXTRA_FLAGS}
${pyside_BINARY_DIR}/pyside_global.h ${pyside_BINARY_DIR}/pyside_global.h
--include-paths=${pyside_SOURCE_DIR}${PATH_SEP}${QT_INCLUDE_DIR} --include-paths=${pyside_SOURCE_DIR}${PATH_SEP}${QT_INCLUDE_DIR}
--typesystem-paths=${pyside_SOURCE_DIR}${PATH_SEP}${${module_typesystem_path}} --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_target_properties(${module_name} PROPERTIES SUFFIX ".pyd")
set(${module_name}_suffix ".pyd") set(${module_name}_suffix ".pyd")
else() else()
set(${module_name}_suffix ".so") set(${module_name}_suffix ${CMAKE_SHARED_MODULE_SUFFIX})
endif() endif()
target_link_libraries(${module_name} ${${module_libraries}}) target_link_libraries(${module_name} ${${module_libraries}})
if(${module_deps}) if(${module_deps})
@ -71,7 +71,7 @@ macro(check_qt_class module class optional_source_files dropped_entries)
endif () endif ()
string(TOLOWER ${class} _class) string(TOLOWER ${class} _class)
string(TOUPPER ${module} _module) string(TOUPPER ${module} _module)
if (${namespace}) if (_namespace)
set(_cppfile ${CMAKE_CURRENT_BINARY_DIR}/PySide/${module}/${_namespace}_${_class}_wrapper.cpp) set(_cppfile ${CMAKE_CURRENT_BINARY_DIR}/PySide/${module}/${_namespace}_${_class}_wrapper.cpp)
else () else ()
set(_cppfile ${CMAKE_CURRENT_BINARY_DIR}/PySide/${module}/${_class}_wrapper.cpp) set(_cppfile ${CMAKE_CURRENT_BINARY_DIR}/PySide/${module}/${_class}_wrapper.cpp)

View file

@ -23,7 +23,7 @@ configure_file("conf.py.in" "rst/conf.py" @ONLY)
configure_file(typesystem_doc.xml.in typesystem_doc.xml @ONLY) configure_file(typesystem_doc.xml.in typesystem_doc.xml @ONLY)
add_custom_target("docrsts" add_custom_target("docrsts"
COMMAND ${GENERATORRUNNER_BINARY} --generator-set=qtdoc COMMAND ${SHIBOKEN_BINARY} --generator-set=qtdoc
${pyside_BINARY_DIR}/pyside_global.h ${pyside_BINARY_DIR}/pyside_global.h
--include-paths="${QT_INCLUDE_DIR}${PATH_SEP}${pyside_SOURCE_DIR}" --include-paths="${QT_INCLUDE_DIR}${PATH_SEP}${pyside_SOURCE_DIR}"
--api-version=${SUPPORTED_QT_VERSION} --api-version=${SUPPORTED_QT_VERSION}

View file

@ -14,6 +14,7 @@ set(libpyside_SRC
pysidesignal.cpp pysidesignal.cpp
pysideslot.cpp pysideslot.cpp
pysideproperty.cpp pysideproperty.cpp
pysideqflags.cpp
pysideweakref.cpp pysideweakref.cpp
pyside.cpp pyside.cpp
${DESTROYLISTENER_MOC} ${DESTROYLISTENER_MOC}
@ -32,7 +33,7 @@ target_link_libraries(pyside
set_target_properties(pyside PROPERTIES set_target_properties(pyside PROPERTIES
VERSION ${BINDING_API_VERSION} VERSION ${BINDING_API_VERSION}
SOVERSION "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}" SOVERSION "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}"
OUTPUT_NAME "pyside${pyside_SUFFIX}-${SHIBOKEN_PYTHON_BASENAME}" OUTPUT_NAME "pyside${pyside_SUFFIX}${SHIBOKEN_PYTHON_SUFFIX}"
DEFINE_SYMBOL PYSIDE_EXPORTS) DEFINE_SYMBOL PYSIDE_EXPORTS)
# #
@ -51,6 +52,7 @@ set(libpyside_HEADERS
pysidemetafunction.h pysidemetafunction.h
pysidesignal.h pysidesignal.h
pysideproperty.h pysideproperty.h
pysideqflags.h
pysideweakref.h pysideweakref.h
) )
@ -65,7 +67,7 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pyside.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/pyside${pyside_SUFFIX}.pc" @ONLY) "${CMAKE_CURRENT_BINARY_DIR}/pyside${pyside_SUFFIX}.pc" @ONLY)
# create cmake-config files # create cmake-config files
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/PySideConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/PySideConfig.cmake" @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/PySideConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/PySideConfig.cmake" @ONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/PySideConfig-spec.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/PySideConfig-${SHIBOKEN_PYTHON_BASENAME}.cmake" @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/PySideConfig-spec.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/PySideConfig${SHIBOKEN_PYTHON_SUFFIX}.cmake" @ONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/PySideConfigVersion.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/PySideConfigVersion.cmake" @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/PySideConfigVersion.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/PySideConfigVersion.cmake" @ONLY)
install(FILES ${libpyside_HEADERS} install(FILES ${libpyside_HEADERS}
@ -77,7 +79,7 @@ install(TARGETS pyside EXPORT pyside
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pyside${pyside_SUFFIX}.pc" DESTINATION "${LIB_INSTALL_DIR}/pkgconfig") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pyside${pyside_SUFFIX}.pc" DESTINATION "${LIB_INSTALL_DIR}/pkgconfig")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/PySideConfig.cmake" install(FILES "${CMAKE_CURRENT_BINARY_DIR}/PySideConfig.cmake"
DESTINATION "${LIB_INSTALL_DIR}/cmake/PySide-${BINDING_API_VERSION}") DESTINATION "${LIB_INSTALL_DIR}/cmake/PySide-${BINDING_API_VERSION}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/PySideConfig-${SHIBOKEN_PYTHON_BASENAME}.cmake" install(FILES "${CMAKE_CURRENT_BINARY_DIR}/PySideConfig${SHIBOKEN_PYTHON_SUFFIX}.cmake"
DESTINATION "${LIB_INSTALL_DIR}/cmake/PySide-${BINDING_API_VERSION}") DESTINATION "${LIB_INSTALL_DIR}/cmake/PySide-${BINDING_API_VERSION}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/PySideConfigVersion.cmake" install(FILES "${CMAKE_CURRENT_BINARY_DIR}/PySideConfigVersion.cmake"
DESTINATION "${LIB_INSTALL_DIR}/cmake/PySide-${BINDING_API_VERSION}") DESTINATION "${LIB_INSTALL_DIR}/cmake/PySide-${BINDING_API_VERSION}")

View file

@ -4,6 +4,15 @@
# PYSIDE_TYPESYSTEMS - Type system files that should be used by other bindings extending PySide # 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_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_BASENAME@@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_PYTHONPATH "@SITE_PACKAGE@")
SET(PYSIDE_TYPESYSTEMS "@CMAKE_INSTALL_PREFIX@/share/PySide@pyside_SUFFIX@/typesystems") SET(PYSIDE_TYPESYSTEMS "@CMAKE_INSTALL_PREFIX@/share/PySide@pyside_SUFFIX@/typesystems")

View file

@ -1,5 +1,5 @@
if (NOT PYTHON_BASENAME) if (NOT PYTHON_BASENAME)
message(STATUS "Using default python: @PYTHON_BASENAME@") message(STATUS "Using default python: @SHIBOKEN_PYTHON_SUFFIX@")
SET(PYTHON_BASENAME @PYTHON_BASENAME@) SET(PYTHON_BASENAME @SHIBOKEN_PYTHON_SUFFIX@)
endif() endif()
include(@LIB_INSTALL_DIR@/cmake/PySide-@BINDING_API_VERSION@/PySideConfig-${PYTHON_BASENAME}.cmake) include(@LIB_INSTALL_DIR@/cmake/PySide-@BINDING_API_VERSION@/PySideConfig${PYTHON_BASENAME}.cmake)

View file

@ -1,4 +1,4 @@
#include <Python.h> #include <sbkpython.h>
#include "destroylistener.h" #include "destroylistener.h"
#include <QObject> #include <QObject>

View file

@ -456,7 +456,7 @@ void DynamicQMetaObject::DynamicQMetaObjectPrivate::writeMethodsData(const QList
(*data)[index++] = m_emptyMethod; // func name (*data)[index++] = m_emptyMethod; // func name
(*data)[index++] = nullIndex; // arguments (*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++] = nullIndex; // tags
(*data)[index++] = flags | (it->methodType() == QMetaMethod::Signal ? MethodSignal : MethodSlot); (*data)[index++] = flags | (it->methodType() == QMetaMethod::Signal ? MethodSignal : MethodSlot);
} }
@ -476,17 +476,17 @@ void DynamicQMetaObject::parsePythonType(PyTypeObject* type)
typedef std::pair<const char*, PyObject*> PropPair; typedef std::pair<const char*, PyObject*> PropPair;
QLinkedList<PropPair> properties; QLinkedList<PropPair> properties;
Shiboken::AutoDecRef slotAttrName(PyString_FromString(PYSIDE_SLOT_LIST_ATTR)); Shiboken::AutoDecRef slotAttrName(Shiboken::String::fromCString(PYSIDE_SLOT_LIST_ATTR));
while (PyDict_Next(attrs, &pos, &key, &value)) { while (PyDict_Next(attrs, &pos, &key, &value)) {
if (Property::checkType(value)) { if (Property::checkType(value)) {
// Leave the properties to be register after signals because they may depend on notify signals // Leave the properties to be register after signals because they may depend on notify signals
int index = d.superdata->indexOfProperty(PyString_AS_STRING(key)); int index = d.superdata->indexOfProperty(Shiboken::String::toCString(key));
if (index == -1) if (index == -1)
properties << PropPair(PyString_AS_STRING(key), value); properties << PropPair(Shiboken::String::toCString(key), value);
} else if (Signal::checkType(value)) { // Register signals } else if (Signal::checkType(value)) { // Register signals
PySideSignal* data = reinterpret_cast<PySideSignal*>(value); PySideSignal* data = reinterpret_cast<PySideSignal*>(value);
const char* signalName = PyString_AS_STRING(key); const char* signalName = Shiboken::String::toCString(key);
data->signalName = strdup(signalName); data->signalName = strdup(signalName);
QByteArray sig; QByteArray sig;
sig.reserve(128); sig.reserve(128);
@ -504,7 +504,7 @@ void DynamicQMetaObject::parsePythonType(PyTypeObject* type)
PyObject* signatureList = PyObject_GetAttr(value, slotAttrName); PyObject* signatureList = PyObject_GetAttr(value, slotAttrName);
for(Py_ssize_t i = 0, i_max = PyList_Size(signatureList); i < i_max; ++i) { for(Py_ssize_t i = 0, i_max = PyList_Size(signatureList); i < i_max; ++i) {
PyObject* signature = PyList_GET_ITEM(signatureList, i); PyObject* signature = PyList_GET_ITEM(signatureList, i);
QByteArray sig(PyString_AS_STRING(signature)); QByteArray sig(Shiboken::String::toCString(signature));
//slot the slot type and signature //slot the slot type and signature
QList<QByteArray> slotInfo = sig.split(' '); QList<QByteArray> slotInfo = sig.split(' ');
int index = d.superdata->indexOfSlot(slotInfo[1]); int index = d.superdata->indexOfSlot(slotInfo[1]);

View file

@ -24,7 +24,7 @@
#define DYNAMICQMETAOBJECT_H #define DYNAMICQMETAOBJECT_H
#include "pysidemacros.h" #include "pysidemacros.h"
#include <Python.h> #include <sbkpython.h>
#include <QMetaObject> #include <QMetaObject>
#include <QMetaMethod> #include <QMetaMethod>

View file

@ -23,7 +23,7 @@
#ifndef DYNAMICMETAPROPERTY_P_H #ifndef DYNAMICMETAPROPERTY_P_H
#define DYNAMICMETAPROPERTY_P_H #define DYNAMICMETAPROPERTY_P_H
#include <Python.h> #include <sbkpython.h>
#include <QByteArray> #include <QByteArray>
#include <QMetaMethod> #include <QMetaMethod>

View file

@ -29,6 +29,7 @@
#include <QEvent> #include <QEvent>
#include <QLinkedList> #include <QLinkedList>
#include <autodecref.h> #include <autodecref.h>
#include <sbkconverter.h>
#include <gilstate.h> #include <gilstate.h>
#include "typeresolver.h" #include "typeresolver.h"
@ -75,7 +76,12 @@ DynamicSlotData::DynamicSlotData(int id, PyObject* callback, GlobalReceiver* par
//Can not store calback pointe because this will be destroyed at the end of the scope //Can not store calback pointe because this will be destroyed at the end of the scope
//To avoid increment intance reference keep the callback information //To avoid increment intance reference keep the callback information
m_callback = PyMethod_GET_FUNCTION(callback); m_callback = PyMethod_GET_FUNCTION(callback);
#ifdef IS_PY3K
m_pyClass = 0;
#else
m_pyClass = PyMethod_GET_CLASS(callback); m_pyClass = PyMethod_GET_CLASS(callback);
#endif
m_pythonSelf = PyMethod_GET_SELF(callback); m_pythonSelf = PyMethod_GET_SELF(callback);
//monitor class from method lifetime //monitor class from method lifetime
@ -92,7 +98,11 @@ PyObject* DynamicSlotData::call(PyObject* args)
//create a callback based on method data //create a callback based on method data
if (m_isMethod) if (m_isMethod)
#ifdef IS_PY3K
callback = PyMethod_New(callback, m_pythonSelf);
#else
callback = PyMethod_New(callback, m_pythonSelf, m_pyClass); callback = PyMethod_New(callback, m_pythonSelf, m_pyClass);
#endif
PyObject* result = PyObject_CallObject(callback, args); PyObject* result = PyObject_CallObject(callback, args);
@ -284,8 +294,9 @@ int GlobalReceiver::qt_metacall(QMetaObject::Call call, int id, void** args)
QList<QByteArray> paramTypes = slot.parameterTypes(); QList<QByteArray> paramTypes = slot.parameterTypes();
Shiboken::AutoDecRef preparedArgs(PyTuple_New(paramTypes.count())); Shiboken::AutoDecRef preparedArgs(PyTuple_New(paramTypes.count()));
for (int i = 0, max = paramTypes.count(); i < max; ++i) { 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 const QByteArray& paramType = paramTypes[i];
PyTuple_SET_ITEM(preparedArgs.object(), i, arg); Shiboken::Conversions::SpecificConverter converter(paramType.constData());
PyTuple_SET_ITEM(preparedArgs.object(), i, converter.toPython(args[i+1]));
} }
retval = data->call(preparedArgs); retval = data->call(preparedArgs);
} }
@ -297,4 +308,3 @@ int GlobalReceiver::qt_metacall(QMetaObject::Call call, int id, void** args)
return -1; return -1;
} }

View file

@ -23,7 +23,7 @@
#ifndef GLOBALRECEIVER_H #ifndef GLOBALRECEIVER_H
#define GLOBALRECEIVER_H #define GLOBALRECEIVER_H
#include <Python.h> #include <sbkpython.h>
#include <QObject> #include <QObject>
#include <QHash> #include <QHash>
#include <QSet> #include <QSet>

View file

@ -83,7 +83,9 @@ DynamicSlotDataV2::DynamicSlotDataV2(PyObject* callback, GlobalReceiverV2* paren
//Can not store calback pointe because this will be destroyed at the end of the scope //Can not store calback pointe because this will be destroyed at the end of the scope
//To avoid increment intance reference keep the callback information //To avoid increment intance reference keep the callback information
m_callback = PyMethod_GET_FUNCTION(callback); m_callback = PyMethod_GET_FUNCTION(callback);
#ifndef IS_PY3K
m_pyClass = PyMethod_GET_CLASS(callback); m_pyClass = PyMethod_GET_CLASS(callback);
#endif
m_pythonSelf = PyMethod_GET_SELF(callback); m_pythonSelf = PyMethod_GET_SELF(callback);
//monitor class from method lifetime //monitor class from method lifetime
@ -109,7 +111,7 @@ QByteArray DynamicSlotDataV2::hash(PyObject* callback)
{ {
Shiboken::GilState gil; Shiboken::GilState gil;
if (PyMethod_Check(callback)) 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))); + QByteArray::number((qlonglong)PyObject_Hash(PyMethod_GET_SELF(callback)));
else else
return QByteArray::number((qlonglong)PyObject_Hash(callback)); return QByteArray::number((qlonglong)PyObject_Hash(callback));
@ -121,7 +123,11 @@ PyObject* DynamicSlotDataV2::callback()
//create a callback based on method data //create a callback based on method data
if (m_isMethod) if (m_isMethod)
#ifdef IS_PY3K
callback = PyMethod_New(m_callback, m_pythonSelf);
#else
callback = PyMethod_New(m_callback, m_pythonSelf, m_pyClass); callback = PyMethod_New(m_callback, m_pythonSelf, m_pyClass);
#endif
else else
Py_INCREF(callback); Py_INCREF(callback);

View file

@ -23,7 +23,7 @@
#ifndef GLOBALRECEIVER_V2_H #ifndef GLOBALRECEIVER_V2_H
#define GLOBALRECEIVER_V2_H #define GLOBALRECEIVER_V2_H
#include <Python.h> #include <sbkpython.h>
#include <QObject> #include <QObject>
#include <QHash> #include <QHash>
#include <QSet> #include <QSet>

View file

@ -35,9 +35,11 @@
#include <basewrapper.h> #include <basewrapper.h>
#include <conversions.h> #include <conversions.h>
#include <sbkconverter.h>
#include <typeresolver.h> #include <typeresolver.h>
#include <bindingmanager.h> #include <bindingmanager.h>
#include <algorithm> #include <algorithm>
#include <cstring>
#include <cctype> #include <cctype>
#include <QStack> #include <QStack>
#include <QCoreApplication> #include <QCoreApplication>
@ -68,8 +70,8 @@ bool fillQtProperties(PyObject* qObj, const QMetaObject* metaObj, PyObject* kwds
Py_ssize_t pos = 0; Py_ssize_t pos = 0;
while (PyDict_Next(kwds, &pos, &key, &value)) { while (PyDict_Next(kwds, &pos, &key, &value)) {
if (!blackListSize || !std::binary_search(blackList, blackList + blackListSize, std::string(PyString_AS_STRING(key)))) { if (!blackListSize || !std::binary_search(blackList, blackList + blackListSize, std::string(Shiboken::String::toCString(key)))) {
QByteArray propName(PyString_AS_STRING(key)); QByteArray propName(Shiboken::String::toCString(key));
if (metaObj->indexOfProperty(propName) != -1) { if (metaObj->indexOfProperty(propName) != -1) {
propName[0] = std::toupper(propName[0]); propName[0] = std::toupper(propName[0]);
propName.prepend("set"); propName.prepend("set");
@ -140,7 +142,7 @@ void destroyQCoreApplication()
Shiboken::BindingManager& bm = Shiboken::BindingManager::instance(); Shiboken::BindingManager& bm = Shiboken::BindingManager::instance();
SbkObject* pyQApp = bm.retrieveWrapper(app); SbkObject* pyQApp = bm.retrieveWrapper(app);
PyTypeObject* pyQObjectType = Shiboken::TypeResolver::get("QObject*")->pythonType(); PyTypeObject* pyQObjectType = Shiboken::Conversions::getPythonTypeObject("QObject*");
assert(pyQObjectType); assert(pyQObjectType);
void* data[2] = {pyQApp, pyQObjectType}; void* data[2] = {pyQApp, pyQObjectType};
@ -173,7 +175,10 @@ void initDynamicMetaObject(SbkObjectType* type, const QMetaObject* base, const s
//initialize staticQMetaObject property //initialize staticQMetaObject property
void* metaObjectPtr = &userData->mo; 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); PyObject_SetAttrString(reinterpret_cast<PyObject*>(type), "staticMetaObject", pyMetaObject);
} }
@ -184,8 +189,8 @@ void initDynamicMetaObject(SbkObjectType* type, const QMetaObject* base)
void initQObjectSubType(SbkObjectType* type, PyObject* args, PyObject* kwds) void initQObjectSubType(SbkObjectType* type, PyObject* args, PyObject* kwds)
{ {
PyTypeObject* qObjType = Shiboken::TypeResolver::get("QObject*")->pythonType(); PyTypeObject* qObjType = Shiboken::Conversions::getPythonTypeObject("QObject*");
QByteArray className(PyString_AS_STRING(PyTuple_GET_ITEM(args, 0))); QByteArray className(Shiboken::String::toCString(PyTuple_GET_ITEM(args, 0)));
PyObject* bases = PyTuple_GET_ITEM(args, 1); PyObject* bases = PyTuple_GET_ITEM(args, 1);
int numBases = PyTuple_GET_SIZE(bases); int numBases = PyTuple_GET_SIZE(bases);
@ -233,30 +238,34 @@ PyObject* getMetaDataFromQObject(QObject* cppSelf, PyObject* self, PyObject* nam
} }
//search on metaobject (avoid internal attributes started with '__') //search on metaobject (avoid internal attributes started with '__')
if (!attr && !QString(PyString_AS_STRING(name)).startsWith("__")) { if (!attr) {
const QMetaObject* metaObject = cppSelf->metaObject(); const char* cname = Shiboken::String::toCString(name);
QByteArray cname(PyString_AS_STRING(name)); uint cnameLen = qstrlen(cname);
cname += '('; if (std::strncmp("__", cname, 2)) {
//signal const QMetaObject* metaObject = cppSelf->metaObject();
QList<QMetaMethod> signalList; //signal
for(int i=0, i_max = metaObject->methodCount(); i < i_max; i++) { QList<QMetaMethod> signalList;
QMetaMethod method = metaObject->method(i); for(int i=0, i_max = metaObject->methodCount(); i < i_max; i++) {
if (QString(method.signature()).startsWith(cname)) { QMetaMethod method = metaObject->method(i);
if (method.methodType() == QMetaMethod::Signal) { const char* methSig = method.signature();
signalList.append(method); bool methMacth = !std::strncmp(cname, methSig, cnameLen) && methSig[cnameLen] == '(';
} else { if (methMacth) {
PySideMetaFunction* func = MetaFunction::newObject(cppSelf, i); if (method.methodType() == QMetaMethod::Signal) {
if (func) { signalList.append(method);
PyObject_SetAttr(self, name, (PyObject*)func); } else {
return (PyObject*)func; PySideMetaFunction* func = MetaFunction::newObject(cppSelf, i);
if (func) {
PyObject_SetAttr(self, name, (PyObject*)func);
return (PyObject*)func;
}
} }
} }
} }
} if (signalList.size() > 0) {
if (signalList.size() > 0) { PyObject* pySignal = reinterpret_cast<PyObject*>(Signal::newObjectFromMethod(self, signalList));
PyObject* pySignal = reinterpret_cast<PyObject*>(Signal::newObjectFromMethod(self, signalList)); PyObject_SetAttr(self, name, pySignal);
PyObject_SetAttr(self, name, pySignal); return pySignal;
return pySignal; }
} }
} }
return attr; return attr;

View file

@ -23,7 +23,7 @@
#ifndef PYSIDE_H #ifndef PYSIDE_H
#define PYSIDE_H #define PYSIDE_H
#include <Python.h> #include <sbkpython.h>
#include <pysidemacros.h> #include <pysidemacros.h>
#include <QMetaType> #include <QMetaType>
#include <QHash> #include <QHash>

View file

@ -8,7 +8,7 @@ pythonpath=@SITE_PACKAGE@
Name: PySide@pyside_SUFFIX@ Name: PySide@pyside_SUFFIX@
Description: Support library for Python bindings of Qt-based libraries. Description: Support library for Python bindings of Qt-based libraries.
Version: @BINDING_API_VERSION_FULL@ Version: @BINDING_API_VERSION_FULL@
Libs: -L${libdir} -lpyside@pyside_SUFFIX@-@SHIBOKEN_PYTHON_BASENAME@@LIBRARY_OUTPUT_SUFFIX@ Libs: -L${libdir} -lpyside@pyside_SUFFIX@@SHIBOKEN_PYTHON_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@
Cflags: -I${includedir} Cflags: -I${includedir}
Requires: shiboken Requires: shiboken

View file

@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <Python.h> #include <sbkpython.h>
#include "pysideclassinfo.h" #include "pysideclassinfo.h"
#include "pysideclassinfo_p.h" #include "pysideclassinfo_p.h"
#include "dynamicqmetaobject.h" #include "dynamicqmetaobject.h"
@ -39,8 +39,7 @@ static void classInfoFree(void*);
static PyObject* classCall(PyObject*, PyObject*, PyObject*); static PyObject* classCall(PyObject*, PyObject*, PyObject*);
PyTypeObject PySideClassInfoType = { PyTypeObject PySideClassInfoType = {
PyObject_HEAD_INIT(0) PyVarObject_HEAD_INIT(0, 0)
0, /*ob_size*/
CLASSINFO_CLASS_NAME, /*tp_name*/ CLASSINFO_CLASS_NAME, /*tp_name*/
sizeof(PySideClassInfo), /*tp_basicsize*/ sizeof(PySideClassInfo), /*tp_basicsize*/
0, /*tp_itemsize*/ 0, /*tp_itemsize*/
@ -119,8 +118,8 @@ int classInfoTpInit(PyObject* self, PyObject* args, PyObject* kwds)
PyObject* value; PyObject* value;
Py_ssize_t pos = 0; Py_ssize_t pos = 0;
while (PyDict_Next(kwds, &pos, &key, &value)) { while (PyDict_Next(kwds, &pos, &key, &value)) {
if (PyString_Check(key) && PyString_Check(value)) if (Shiboken::String::check(key) && Shiboken::String::check(value))
pData->m_data[PyString_AS_STRING(key)] = PyString_AS_STRING(value); pData->m_data[Shiboken::String::toCString(key)] = Shiboken::String::toCString(value);
} }
return PyErr_Occurred() ? -1 : 1; return PyErr_Occurred() ? -1 : 1;

View file

@ -24,7 +24,7 @@
#define PYSIDE_CLASSINFO_H #define PYSIDE_CLASSINFO_H
#include <pysidemacros.h> #include <pysidemacros.h>
#include <Python.h> #include <sbkpython.h>
#include <QMap> #include <QMap>
#include <QByteArray> #include <QByteArray>

View file

@ -23,7 +23,7 @@
#ifndef PYSIDE_CLASSINFO_P_H #ifndef PYSIDE_CLASSINFO_P_H
#define PYSIDE_CLASSINFO_P_H #define PYSIDE_CLASSINFO_P_H
#include <Python.h> #include <sbkpython.h>
#include <QMetaObject> #include <QMetaObject>
#include "pysideclassinfo.h" #include "pysideclassinfo.h"

View file

@ -23,9 +23,10 @@
#ifndef PYSIDECONVERSIONS_H #ifndef PYSIDECONVERSIONS_H
#define PYSIDECONVERSIONS_H #define PYSIDECONVERSIONS_H
#include <Python.h> #include <sbkpython.h>
#include <conversions.h>
#include <QFlag> #include <QFlag>
#include <conversions.h>
#include <pysideqflags.h>
template <typename QtDict> template <typename QtDict>
struct QtDictConverter struct QtDictConverter
@ -211,6 +212,7 @@ struct QSequenceConverter
} }
}; };
template <typename T> template <typename T>
struct QFlagsConverter struct QFlagsConverter
{ {
@ -232,17 +234,23 @@ struct QFlagsConverter
static inline PyObject* toPython(const T& cppObj) static inline PyObject* toPython(const T& cppObj)
{ {
PyObject* qflags = Shiboken::SbkType<T>()->tp_alloc(Shiboken::SbkType<T>(), 0); return reinterpret_cast<PyObject*>(PySide::QFlags::newObject(cppObj, Shiboken::SbkType<T>()));
reinterpret_cast<PyIntObject*>(qflags)->ob_ival = cppObj;
return qflags;
} }
static inline T toCpp(PyObject* pyObj) static inline T toCpp(PyObject* pyObj)
{ {
if (Shiboken::isShibokenEnum(pyObj)) long val = 0;
return T(QFlag(Shiboken::Enum::getValue(pyObj))); if (Shiboken::Enum::check(pyObj)) {
else val = Shiboken::Enum::getValue(pyObj);
return T(QFlag(reinterpret_cast<PyIntObject*>(pyObj)->ob_ival)); } else if (PyObject_TypeCheck(pyObj, Shiboken::SbkType<T>())) {
val = PySide::QFlags::getValue(reinterpret_cast<PySideQFlagsObject*>(pyObj));
} else if (PyNumber_Check(pyObj)) {
Shiboken::AutoDecRef pyLong(PyNumber_Long(pyObj));
val = PyLong_AsLong(pyLong.object());
} else {
PyErr_BadArgument();
}
return T(QFlag(val));
} }
}; };

View file

@ -23,7 +23,7 @@
#ifndef PYSIDEMACROS_H #ifndef PYSIDEMACROS_H
#define PYSIDEMACROS_H #define PYSIDEMACROS_H
#if defined _WIN32 || defined __CYGWIN__ #if defined _WIN32
#if PYSIDE_EXPORTS #if PYSIDE_EXPORTS
#define PYSIDE_API __declspec(dllexport) #define PYSIDE_API __declspec(dllexport)
#else #else
@ -40,7 +40,7 @@
#define PYSIDE_DEPRECATED(func) func __attribute__ ((deprecated)) #define PYSIDE_DEPRECATED(func) func __attribute__ ((deprecated))
#else #else
#define PYSIDE_API #define PYSIDE_API
#define DEPRECATED(func) func #define PYSIDE_DEPRECATED(func) func
#endif #endif
#endif #endif

View file

@ -19,8 +19,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <Python.h> #include <sbkpython.h>
#include "pysidemetafunction.h" #include "pysidemetafunction.h"
#include "pysidemetafunction_p.h"
#include <shiboken.h> #include <shiboken.h>
#include <QObject> #include <QObject>
@ -33,7 +34,7 @@ extern "C"
struct PySideMetaFunctionPrivate struct PySideMetaFunctionPrivate
{ {
QObject* qobject; QObject* qobject;
QMetaMethod method; int methodIndex;
}; };
//methods //methods
@ -41,8 +42,7 @@ static void functionFree(void*);
static PyObject* functionCall(PyObject*, PyObject*, PyObject*); static PyObject* functionCall(PyObject*, PyObject*, PyObject*);
PyTypeObject PySideMetaFunctionType = { PyTypeObject PySideMetaFunctionType = {
PyObject_HEAD_INIT(0) PyVarObject_HEAD_INIT(0, 0)
/*ob_size*/ 0,
/*tp_name*/ "PySide.MetaFunction", /*tp_name*/ "PySide.MetaFunction",
/*tp_basicsize*/ sizeof(PySideMetaFunction), /*tp_basicsize*/ sizeof(PySideMetaFunction),
/*tp_itemsize*/ 0, /*tp_itemsize*/ 0,
@ -98,31 +98,12 @@ void functionFree(void *self)
PyObject* functionCall(PyObject* self, PyObject* args, PyObject* kw) 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); PySideMetaFunction* function = reinterpret_cast<PySideMetaFunction*>(self);
QMetaMethod method = function->d->method;
int argsGiven = method.parameterTypes().size();
for (int i = 0; i < argsGiven; ++i) { PyObject* retVal;
Shiboken::AutoDecRef pyArg(PySequence_GetItem(args, i)); if (!PySide::MetaFunction::call(function->d->qobject, function->d->methodIndex, args, &retVal))
gArgs[i] = Q_ARG(QVariant, vArgs[i]); return 0;
void* v[1] = { &vArgs[i] }; return retVal;
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;
} }
} // extern "C" } // extern "C"
@ -148,12 +129,97 @@ PySideMetaFunction* newObject(QObject* source, int methodIndex)
PySideMetaFunction* function = PyObject_New(PySideMetaFunction, &PySideMetaFunctionType); PySideMetaFunction* function = PyObject_New(PySideMetaFunction, &PySideMetaFunctionType);
function->d = new PySideMetaFunctionPrivate(); function->d = new PySideMetaFunctionPrivate();
function->d->qobject = source; function->d->qobject = source;
function->d->method = method; function->d->methodIndex = methodIndex;
return function; return function;
} }
return 0; 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 MetaFunction
} //namespace PySide } //namespace PySide

View file

@ -28,7 +28,7 @@
#include <QStringList> #include <QStringList>
#include <pysidemacros.h> #include <pysidemacros.h>
#include <Python.h> #include <sbkpython.h>
extern "C" extern "C"
{ {

View file

@ -23,11 +23,19 @@
#ifndef PYSIDE_METAFUNCTION_P_H #ifndef PYSIDE_METAFUNCTION_P_H
#define PYSIDE_METAFUNCTION_P_H #define PYSIDE_METAFUNCTION_P_H
#include <Python.h> #include <sbkpython.h>
#include <QList>
#include <QByteArray>
class QObject;
namespace PySide { namespace MetaFunction { 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 MetaFunction
} //namespace PySide } //namespace PySide

View file

@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <Python.h> #include <sbkpython.h>
#include "pysideproperty.h" #include "pysideproperty.h"
#include "pysideproperty_p.h" #include "pysideproperty_p.h"
#include "dynamicqmetaobject_p.h" #include "dynamicqmetaobject_p.h"
@ -38,12 +38,14 @@ extern "C"
static PyObject* qpropertyTpNew(PyTypeObject* subtype, PyObject* args, PyObject* kwds); static PyObject* qpropertyTpNew(PyTypeObject* subtype, PyObject* args, PyObject* kwds);
static int qpropertyTpInit(PyObject*, PyObject*, PyObject*); static int qpropertyTpInit(PyObject*, PyObject*, PyObject*);
static void qpropertyFree(void*); static void qpropertyDeAlloc(PyObject* self);
//methods //methods
static PyObject* qPropertyCall(PyObject*, PyObject*, PyObject*); static PyObject* qPropertyCall(PyObject*, PyObject*, PyObject*);
static PyObject* qPropertySetter(PyObject*, PyObject*); static PyObject* qPropertySetter(PyObject*, PyObject*);
static PyObject* qPropertyGetter(PyObject*, PyObject*); static PyObject* qPropertyGetter(PyObject*, PyObject*);
static int qpropertyTraverse(PyObject* self, visitproc visit, void* arg);
static int qpropertyClear(PyObject* self);
static PyMethodDef PySidePropertyMethods[] = { static PyMethodDef PySidePropertyMethods[] = {
{"setter", (PyCFunction)qPropertySetter, METH_O}, {"setter", (PyCFunction)qPropertySetter, METH_O},
@ -54,12 +56,11 @@ static PyMethodDef PySidePropertyMethods[] = {
}; };
PyTypeObject PySidePropertyType = { PyTypeObject PySidePropertyType = {
PyObject_HEAD_INIT(0) PyVarObject_HEAD_INIT(0, 0)
0, /*ob_size*/
QPROPERTY_CLASS_NAME, /*tp_name*/ QPROPERTY_CLASS_NAME, /*tp_name*/
sizeof(PySideProperty), /*tp_basicsize*/ sizeof(PySideProperty), /*tp_basicsize*/
0, /*tp_itemsize*/ 0, /*tp_itemsize*/
0, /*tp_dealloc*/ qpropertyDeAlloc, /*tp_dealloc*/
0, /*tp_print*/ 0, /*tp_print*/
0, /*tp_getattr*/ 0, /*tp_getattr*/
0, /*tp_setattr*/ 0, /*tp_setattr*/
@ -74,10 +75,10 @@ PyTypeObject PySidePropertyType = {
0, /*tp_getattro*/ 0, /*tp_getattro*/
0, /*tp_setattro*/ 0, /*tp_setattro*/
0, /*tp_as_buffer*/ 0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc */ 0, /*tp_doc */
0, /*tp_traverse */ qpropertyTraverse, /*tp_traverse */
0, /*tp_clear */ qpropertyClear, /*tp_clear */
0, /*tp_richcompare */ 0, /*tp_richcompare */
0, /*tp_weaklistoffset */ 0, /*tp_weaklistoffset */
0, /*tp_iter */ 0, /*tp_iter */
@ -93,7 +94,7 @@ PyTypeObject PySidePropertyType = {
qpropertyTpInit, /*tp_init */ qpropertyTpInit, /*tp_init */
0, /*tp_alloc */ 0, /*tp_alloc */
qpropertyTpNew, /*tp_new */ qpropertyTpNew, /*tp_new */
qpropertyFree, /*tp_free */ 0, /*tp_free */
0, /*tp_is_gc */ 0, /*tp_is_gc */
0, /*tp_bases */ 0, /*tp_bases */
0, /*tp_mro */ 0, /*tp_mro */
@ -105,8 +106,10 @@ PyTypeObject PySidePropertyType = {
static void qpropertyMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::Call call, void** args) static void qpropertyMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::Call call, void** args)
{ {
Shiboken::TypeResolver* typeResolver = Shiboken::TypeResolver::get(pp->d->typeName); Shiboken::Conversions::SpecificConverter converter(pp->d->typeName);
Q_ASSERT(typeResolver); Q_ASSERT(converter);
QByteArray type(pp->d->typeName);
switch(call) { switch(call) {
case QMetaObject::ReadProperty: case QMetaObject::ReadProperty:
@ -114,7 +117,7 @@ static void qpropertyMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::C
Shiboken::GilState gil; Shiboken::GilState gil;
PyObject* value = PySide::Property::getValue(pp, self); PyObject* value = PySide::Property::getValue(pp, self);
if (value) { if (value) {
typeResolver->toCpp(value, &args[0]); converter.toCpp(value, args[0]);
Py_DECREF(value); Py_DECREF(value);
} else if (PyErr_Occurred()) { } else if (PyErr_Occurred()) {
PyErr_Print(); // Clear any errors but print them to stderr PyErr_Print(); // Clear any errors but print them to stderr
@ -125,7 +128,7 @@ static void qpropertyMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::C
case QMetaObject::WriteProperty: case QMetaObject::WriteProperty:
{ {
Shiboken::GilState gil; Shiboken::GilState gil;
Shiboken::AutoDecRef value(typeResolver->toPython(args[0])); Shiboken::AutoDecRef value(converter.toPython(args[0]));
PySide::Property::setValue(pp, self, value); PySide::Property::setValue(pp, self, value);
break; break;
} }
@ -207,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); qpropertyClear(self);
PySideProperty *data = reinterpret_cast<PySideProperty*>(self); Py_TYPE(self)->tp_free(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);
} }
PyObject* qPropertyCall(PyObject* self, PyObject* args, PyObject* kw) PyObject* qPropertyCall(PyObject* self, PyObject* args, PyObject* kw)
@ -278,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" } // extern "C"
namespace { namespace {
@ -444,7 +469,7 @@ const char* getNotifyName(PySideProperty* self)
{ {
if (!self->d->notifySignature) { if (!self->d->notifySignature) {
PyObject* str = PyObject_Str(self->d->notify); PyObject* str = PyObject_Str(self->d->notify);
self->d->notifySignature = strdup(PyString_AsString(str)); self->d->notifySignature = strdup(Shiboken::String::toCString(str));
Py_DECREF(str); Py_DECREF(str);
} }

Some files were not shown because too many files have changed in this diff Show more