From 2e1ed4a88122b10bffa35043ff1373e8ec476dcd Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Fri, 1 Apr 2011 09:20:05 -0300 Subject: [PATCH 001/455] Fixes bug #489 - PySide.QtGui.QImage with string buffer argument. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit http://bugs.pyside.org/show_bug.cgi?id=489 Also added an unit test. Reviewed by Hugo Parente Reviewed by Renato Araújo --- PySide/QtGui/typesystem_gui_common.xml | 15 +++++++++++++++ tests/QtGui/qimage_test.py | 11 +++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index a0b84fc..70535e6 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -803,6 +803,21 @@ + + + + + + + + + + + + + + + diff --git a/tests/QtGui/qimage_test.py b/tests/QtGui/qimage_test.py index e9af2d7..b1a3026 100644 --- a/tests/QtGui/qimage_test.py +++ b/tests/QtGui/qimage_test.py @@ -2,8 +2,8 @@ '''Test cases for QImage''' import unittest -from PySide.QtGui import * -from helper import * +from PySide.QtGui import QImage +from helper import UsesQApplication, adjust_filename class QImageTest(UsesQApplication): '''Test case for calling setPixel with float as argument''' @@ -27,6 +27,13 @@ class QImageTest(UsesQApplication): self.assertEquals(str(data1), img0.bits()[:img0.bytesPerLine()]) self.assertEquals(str(data2), img0.bits()[:img0.bytesPerLine()]) + def testEmptyBuffer(self): + img = QImage(buffer(''), 100, 100, QImage.Format_ARGB32) + + def testEmptyStringAsBuffer(self): + img = QImage('', 100, 100, QImage.Format_ARGB32) + + if __name__ == '__main__': unittest.main() From 1067faec16032e2f71c72b8415605708a88adb66 Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Mon, 4 Apr 2011 18:06:07 -0300 Subject: [PATCH 002/455] Change the order of function call on destructionVisitor to avoid problems with cyclic dependency. Fixes bug #793. Reviewer: Luciano Wolf Hugo Parente --- libpyside/pyside.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp index ec710a5..a135692 100644 --- a/libpyside/pyside.cpp +++ b/libpyside/pyside.cpp @@ -113,10 +113,11 @@ static void destructionVisitor(SbkObject* pyObj, void* data) if (pyObj != pyQApp && PyObject_TypeCheck(pyObj, pyQObjectType)) { if (Shiboken::Object::hasOwnership(pyObj) && Shiboken::Object::isValid(pyObj, false)) { + Shiboken::Object::setValidCpp(pyObj, false); + Py_BEGIN_ALLOW_THREADS Shiboken::callCppDestructor(Shiboken::Object::cppPointer(pyObj, pyQObjectType)); Py_END_ALLOW_THREADS - Shiboken::Object::setValidCpp(pyObj, false); } } }; From 21786216f2dff1b7065c1f98f09116fe72c993cc Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Mon, 4 Apr 2011 18:07:28 -0300 Subject: [PATCH 003/455] Create unit test for bug #793. Reviewer: Luciano Wolf Hugo Parente --- tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/bug_793.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 tests/QtGui/bug_793.py diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index ef9b9ac..9306efd 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -46,6 +46,7 @@ PYSIDE_TEST(bug_693.py) PYSIDE_TEST(bug_714.py) PYSIDE_TEST(bug_728.py) PYSIDE_TEST(bug_736.py) +PYSIDE_TEST(bug_793.py) PYSIDE_TEST(customproxywidget_test.py) PYSIDE_TEST(deepcopy_test.py) PYSIDE_TEST(float_to_int_implicit_conversion_test.py) diff --git a/tests/QtGui/bug_793.py b/tests/QtGui/bug_793.py new file mode 100644 index 0000000..4fea833 --- /dev/null +++ b/tests/QtGui/bug_793.py @@ -0,0 +1,30 @@ +import unittest +import sys +from PySide.QtCore import QTimer +from PySide.QtGui import QWidget, QApplication + +class TestW1(QWidget): + def __init__(self, parent = None): + super(TestW1, self).__init__(parent) + TestW2(parent, self) + +class TestW2(QWidget): + def __init__(self, ancestor, parent = None): + super(TestW2, self).__init__(parent) + self.ancestor_ref = ancestor + +class Test(QWidget): + def __init__(self): + super(Test, self).__init__() + TestW1(self) + +class TestQApplicationDestrcutor(unittest.TestCase): + def testDestructor(self): + w = Test() + w.show() + QTimer.singleShot(0, w.close) + +if __name__ == '__main__': + app = QApplication(sys.argv) + unittest.main() + sys.exit(app.exec_()) From 4b1986f9179293103d14edcefec80571f92db227 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 6 Apr 2011 16:01:55 -0300 Subject: [PATCH 004/455] Version bump to 1.0.2 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b38bccb..22e6b32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,7 @@ endif() set(BINDING_NAME PySide) set(BINDING_API_MAJOR_VERSION "1") set(BINDING_API_MINOR_VERSION "0") -set(BINDING_API_MICRO_VERSION "1") +set(BINDING_API_MICRO_VERSION "2") set(BINDING_API_RELEASE_LEVEL "final") # alpha, beta, rc, or final set(BINDING_API_SERIAL 1) # leave as 0 when release level is final set(BINDING_API_VERSION "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}.${BINDING_API_MICRO_VERSION}" CACHE STRING "PySide version" FORCE) From 00f0ea88cfd1020ff3765597ca9525eb73a783b2 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Wed, 6 Apr 2011 19:49:37 -0300 Subject: [PATCH 005/455] Merged fix_int*... and fix_qreal*... type system templates. Also modified the method call to be friendlier with virtual methods. --- PySide/QtGui/typesystem_gui_common.xml | 36 +++++++++++++++++++------- PySide/typesystem_templates.xml | 14 +++------- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 70535e6..fa819f5 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -1029,7 +1029,9 @@ - + + + @@ -1050,7 +1052,9 @@ - + + + @@ -1071,7 +1075,9 @@ - + + + @@ -1092,7 +1098,9 @@ - + + + @@ -1113,7 +1121,9 @@ - + + + @@ -1134,7 +1144,9 @@ - + + + @@ -4531,7 +4543,9 @@ - + + + @@ -5203,7 +5217,9 @@ - + + + @@ -5224,7 +5240,9 @@ - + + + diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml index 9ef317d..e42193e 100644 --- a/PySide/typesystem_templates.xml +++ b/PySide/typesystem_templates.xml @@ -142,18 +142,10 @@ %PYARG_0 = Shiboken::makeTuple(retval_, val_); - + + + + @@ -271,9 +271,9 @@ QXmlInputSource* _qxmlinputsource_arg_ = 0; - PyThreadState* _save = PyEval_SaveThread(); // Py_BEGIN_ALLOW_THREADS + %BEGIN_ALLOW_THREADS %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(%1, %2, _qxmlinputsource_arg_); - PyEval_RestoreThread(_save); // Py_END_ALLOW_THREADS + %END_ALLOW_THREADS %PYARG_0 = Shiboken::makeTuple(%0, _qxmlinputsource_arg_); @@ -297,9 +297,9 @@ QXmlInputSource* _qxmlinputsource_arg_ = 0; - PyThreadState* _save = PyEval_SaveThread(); // Py_BEGIN_ALLOW_THREADS + %BEGIN_ALLOW_THREADS %RETURN_TYPE %0 = %CPPSELF.%TYPE::%FUNCTION_NAME(%1, %2, _qxmlinputsource_arg_); - PyEval_RestoreThread(_save); // Py_END_ALLOW_THREADS + %END_ALLOW_THREADS %PYARG_0 = Shiboken::makeTuple(%0, _qxmlinputsource_arg_); diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml index ed0d6bd..24c531e 100644 --- a/PySide/typesystem_templates.xml +++ b/PySide/typesystem_templates.xml @@ -31,65 +31,65 @@ + + + + From 98a0d2ba6f3e02c3f3e4aa88e52d0aa9b4273446 Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Mon, 18 Apr 2011 14:50:29 -0300 Subject: [PATCH 047/455] Created unit test for ObjectDescription.fromIndex. Reviewer: Luciano Wolf Marcelo Lira --- tests/phonon/CMakeLists.txt | 1 + tests/phonon/qobjectdescription_test.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 tests/phonon/qobjectdescription_test.py diff --git a/tests/phonon/CMakeLists.txt b/tests/phonon/CMakeLists.txt index ee94c0b..8567515 100644 --- a/tests/phonon/CMakeLists.txt +++ b/tests/phonon/CMakeLists.txt @@ -5,3 +5,4 @@ if (NOT WIN32 OR NOT ${QTVERSION} VERSION_EQUAL 4.7.1) endif() PYSIDE_TEST(bug_328.py) PYSIDE_TEST(capabilities_test.py) +PYSIDE_TEST(qobjectdescription_test.py) diff --git a/tests/phonon/qobjectdescription_test.py b/tests/phonon/qobjectdescription_test.py new file mode 100644 index 0000000..7312ee3 --- /dev/null +++ b/tests/phonon/qobjectdescription_test.py @@ -0,0 +1,18 @@ +import unittest + +from PySide.QtCore import * +from PySide import phonon + +from helper import UsesQCoreApplication + +class CapabilitiesTest(UsesQCoreApplication): + def testFromIndex(self): + devices = phonon.Phonon.BackendCapabilities.availableAudioOutputDevices() + for device in devices: + self.assert_(isinstance(device, phonon.Phonon.AudioOutputDevice)) + other = phonon.Phonon.AudioOutputDevice.fromIndex(device.index()) + self.assertEqual(device.name(), other.name()) + self.assertEqual(device.index(), other.index()) + +if __name__ == '__main__': + unittest.main() From 2b0c31fb027bada0f641a320add7009d0ee61f0a Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Mon, 18 Apr 2011 14:51:16 -0300 Subject: [PATCH 048/455] Exported missing enums on phonon. Reviewer: Luciano Wolf Marcelo Lira --- PySide/phonon/typesystem_phonon.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PySide/phonon/typesystem_phonon.xml b/PySide/phonon/typesystem_phonon.xml index 3636e96..a76b003 100644 --- a/PySide/phonon/typesystem_phonon.xml +++ b/PySide/phonon/typesystem_phonon.xml @@ -104,6 +104,7 @@ + @@ -249,6 +250,7 @@ + From 26be28d120aba5401e8e4ed0509557070729cb82 Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Mon, 18 Apr 2011 15:00:01 -0300 Subject: [PATCH 049/455] Fixed test to avoid problems with float numbers in different archs. Reviewer: Luciano Wolf Marcelo Lira --- tests/QtGui/returnquadruplesofnumbers_test.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/QtGui/returnquadruplesofnumbers_test.py b/tests/QtGui/returnquadruplesofnumbers_test.py index a5fd9b3..a1b446e 100644 --- a/tests/QtGui/returnquadruplesofnumbers_test.py +++ b/tests/QtGui/returnquadruplesofnumbers_test.py @@ -16,28 +16,33 @@ class GraphicsLayoutItem(QGraphicsLayoutItem): QGraphicsLayoutItem.__init__(self) class ReturnsQuadruplesOfNumbers(UsesQApplication): + def compareTuples(self, ta, tb): + for va,vb in zip(ta, tb): + if round(va) != round(vb): + return False + return True def testQGraphicsLayoutGetContentsMargins(self): obj = GraphicsLayout() values = (10.0, 20.0, 30.0, 40.0) obj.setContentsMargins(*values) - self.assertEquals(round(obj.getContentsMargins()), values) + self.assert_(self.compareTuples(obj.getContentsMargins(), values)) def testQGraphicsLayoutItemGetContentsMargins(self): obj = GraphicsLayoutItem() - self.assertEquals(round(obj.getContentsMargins()), (0.0, 0.0, 0.0, 0.0)) + self.assert_(self.compareTuples(obj.getContentsMargins(), (0.0, 0.0, 0.0, 0.0))) def testQWidgetGetContentsMargins(self): obj = QWidget() values = (10, 20, 30, 40) obj.setContentsMargins(*values) - self.assertEquals(round(obj.getContentsMargins()), values) + self.assert_(self.compareTuples(obj.getContentsMargins(), values)) def testQLayoutGetContentsMargins(self): obj = Layout() values = (10, 20, 30, 40) obj.setContentsMargins(*values) - self.assertEquals(round(obj.getContentsMargins()), values) + self.assert_(self.compareTuples(obj.getContentsMargins(), values)) def testQTextCursorSelectedTableCells(self): obj = QTextCursor() @@ -48,7 +53,7 @@ class ReturnsQuadruplesOfNumbers(UsesQApplication): obj = QPrinter() values = (10.0, 20.0, 30.0, 40.0, QPrinter.Point) obj.setPageMargins(*values) - self.assertEquals(round(obj.getPageMargins(QPrinter.Point)), values[:-1]) + self.assert_(self.compareTuples(obj.getPageMargins(QPrinter.Point), values[:-1])) if __name__ == "__main__": unittest.main() From 055e5e97b6873228c64c5ab4a84b71ce8a2012c4 Mon Sep 17 00:00:00 2001 From: Lauro Neto Date: Tue, 19 Apr 2011 16:37:22 -0300 Subject: [PATCH 050/455] Fix bug 814 test. Using the modelData property name was causing problems with a debug-build Qt. Reviewer: Renato Araujo Reviewer: Hugo Lima --- tests/QtDeclarative/bug_814.py | 2 +- tests/QtDeclarative/bug_814.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/QtDeclarative/bug_814.py b/tests/QtDeclarative/bug_814.py index 43fcc5f..e2bfc36 100644 --- a/tests/QtDeclarative/bug_814.py +++ b/tests/QtDeclarative/bug_814.py @@ -15,7 +15,7 @@ import unittest class ListModel(QAbstractListModel): def __init__(self): QAbstractListModel.__init__(self) - self.setRoleNames({0: 'modelData'}) + self.setRoleNames({0: 'pysideModelData'}) def rowCount(self, parent=QModelIndex()): return 3 diff --git a/tests/QtDeclarative/bug_814.qml b/tests/QtDeclarative/bug_814.qml index f772c3a..3296c07 100644 --- a/tests/QtDeclarative/bug_814.qml +++ b/tests/QtDeclarative/bug_814.qml @@ -3,7 +3,7 @@ import Qt 4.7 ListView { width: 300; height: 300 - delegate: Text { text: modelData } + delegate: Text { text: pysideModelData } model: 3 } From 6ad57fe3f465ee4d878425d9147270ee36a75b52 Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Tue, 19 Apr 2011 13:38:01 -0300 Subject: [PATCH 051/455] fix QTextBlock.setUserData reference leak. Fixes bug #811. Reviewer: Luciano Wolf Marcelo Lira --- PySide/QtGui/typesystem_gui_common.xml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index ab34ba0..5eaedc8 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -550,9 +550,25 @@ - - + + const QTextDocument* doc = %CPPSELF.document(); + if (doc) { + Shiboken::AutoDecRef pyDocument(%CONVERTTOPYTHON[QTextDocument*](doc)); + Shiboken::Object::setParent(pyDocument, %PYARG_1); + } + + + + + + + const QTextDocument* doc = %CPPSELF.document(); + if (doc) { + Shiboken::AutoDecRef pyDocument(%CONVERTTOPYTHON[QTextDocument*](doc)); + Shiboken::Object::setParent(pyDocument, %PYARG_0); + } + From ef05a106c3733a7546dc918eaa9884e1e229f80a Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Tue, 19 Apr 2011 13:39:04 -0300 Subject: [PATCH 052/455] Created unit test for bug #811. Reviewer: Luciano Wolf Marcelo Lira --- tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/bug_811.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 tests/QtGui/bug_811.py diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 0c5b31e..1dd2a23 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -52,6 +52,7 @@ PYSIDE_TEST(bug_740.py) PYSIDE_TEST(bug_743.py) PYSIDE_TEST(bug_750.py) PYSIDE_TEST(bug_793.py) +PYSIDE_TEST(bug_811.py) PYSIDE_TEST(customproxywidget_test.py) PYSIDE_TEST(deepcopy_test.py) PYSIDE_TEST(float_to_int_implicit_conversion_test.py) diff --git a/tests/QtGui/bug_811.py b/tests/QtGui/bug_811.py new file mode 100644 index 0000000..af693bd --- /dev/null +++ b/tests/QtGui/bug_811.py @@ -0,0 +1,32 @@ +import unittest +import sys +import weakref + +from helper import UsesQApplication + +from PySide.QtGui import QTextBlockUserData, QTextEdit, QTextCursor + +class TestUserData(QTextBlockUserData): + def __init__(self, data): + super(TestUserData, self).__init__() + self.data = data + +class TestUserDataRefCount(UsesQApplication): + def testRefcount(self): + textedit = QTextEdit() + textedit.setReadOnly(True) + doc = textedit.document() + cursor = QTextCursor(doc) + cursor.insertText("PySide Rocks") + ud = TestUserData({"Life": 42}) + self.assertEqual(sys.getrefcount(ud), 2) + cursor.block().setUserData(ud) + self.assertEqual(sys.getrefcount(ud), 3) + ud2 = cursor.block().userData() + self.assertEqual(sys.getrefcount(ud), 4) + self.udata = weakref.ref(ud, None) + del ud, ud2 + self.assertEqual(sys.getrefcount(self.udata()), 2) + +if __name__ == '__main__': + unittest.main() From 3bc3257c8ba8b0381cb7765fbd847925e83aec79 Mon Sep 17 00:00:00 2001 From: Lauro Neto Date: Tue, 19 Apr 2011 17:09:00 -0300 Subject: [PATCH 053/455] Set WA_InputMethodEnabled in test. If WA_InputMethodMethod is not set, setFocusWidget will fail in a ASSERT in a debug-compiled Qt. Reviewer: Hugo Lima Reviewer: Marcelo Lira --- tests/QtGui/qinputcontext_test.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/QtGui/qinputcontext_test.py b/tests/QtGui/qinputcontext_test.py index da7ff50..c29d446 100644 --- a/tests/QtGui/qinputcontext_test.py +++ b/tests/QtGui/qinputcontext_test.py @@ -1,6 +1,7 @@ import unittest +from PySide.QtCore import Qt from PySide.QtGui import QPushButton from helper import UsesQApplication @@ -10,6 +11,9 @@ class QInputContextTest(UsesQApplication): widget = QPushButton() widget.show() + if not widget.testAttribute(Qt.WA_InputMethodEnabled): + widget.setAttribute(Qt.WA_InputMethodEnabled) + context = self.app.inputContext() self.assertEqual(context.focusWidget(), None) From 0512a3f98f1bc449214b29c307f40bb03a19ae26 Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Wed, 20 Apr 2011 10:35:24 -0300 Subject: [PATCH 054/455] Fixed reference leak on PySideSignal for QTimer.SingleShot Fixes bug #815. Reviewer: Marcelo Lira Hugo Parente Lima --- PySide/QtCore/typesystem_core.xml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 4817df3..5395446 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -2100,7 +2100,8 @@ %PYARG_2, %3) ); - Shiboken::Object::invalidate((SbkObject*)pyTimer); + Shiboken::Object::releaseOwnership((SbkObject*)pyTimer); + Py_XDECREF(pyTimer); timer->setSingleShot(true); timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater())); timer->start(%1); @@ -2114,7 +2115,6 @@ Shiboken::SbkType<QTimer>()->tp_init(pyTimer, emptyTuple, 0); QTimer* timer = %CONVERTTOCPP[QTimer*](pyTimer); timer->setSingleShot(true); - timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater())); if (PyObject_TypeCheck(%2, &PySideSignalInstanceType)) { PySideSignalInstance* signalInstance = reinterpret_cast<PySideSignalInstance*>(%2); @@ -2138,7 +2138,10 @@ pyargs[1]) ); } - Shiboken::Object::invalidate((SbkObject*)pyTimer); + + timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater()), Qt::DirectConnection); + Shiboken::Object::releaseOwnership((SbkObject*)pyTimer); + Py_XDECREF(pyTimer); timer->start(%1); From fc47ed069ee60fff932e2b6e06c4f8acd7faa0fb Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Wed, 20 Apr 2011 18:43:02 -0300 Subject: [PATCH 055/455] Implemented necessary convertions rules for function QPicture.setData. Fixes bug #759 Reviewer: Lauro Moura Hugo Parente Lima --- PySide/QtGui/typesystem_gui_common.xml | 28 +++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 5eaedc8..01cd45d 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -504,7 +504,33 @@ - + + + + + + %PYARG_0 = PyBuffer_FromMemory(const_cast<char*>(%CPPSELF.data()), %CPPSELF.size()); + + + + + + + PyObject *%out = PyBuffer_FromMemory(const_cast<char*>(%in), size); + + + const char *%out; + Py_ssize_t buffer_len; + PyObject_AsCharBuffer(arg, &%out, &buffer_len); + + + + + + uint %out = buffer_len; + + + From c9a260df4b5d9b07e398c0dc1a3168371e71ccfb Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Wed, 20 Apr 2011 18:43:51 -0300 Subject: [PATCH 056/455] Created unit test for function QPicture.setData Reviewer: Lauro Moura Hugo Parente Lima --- tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/qpicture_test.py | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 tests/QtGui/qpicture_test.py diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 1dd2a23..f4a646d 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -97,6 +97,7 @@ PYSIDE_TEST(qmenu_test.py) PYSIDE_TEST(qobject_mi_test.py) PYSIDE_TEST(qpainter_test.py) PYSIDE_TEST(qpen_test.py) +PYSIDE_TEST(qpicture_test.py) PYSIDE_TEST(qpixmap_test.py) PYSIDE_TEST(qpixmap_constructor.py) PYSIDE_TEST(qpolygonf_test.py) diff --git a/tests/QtGui/qpicture_test.py b/tests/QtGui/qpicture_test.py new file mode 100644 index 0000000..2aa82c9 --- /dev/null +++ b/tests/QtGui/qpicture_test.py @@ -0,0 +1,35 @@ +import unittest + +import os +from helper import UsesQApplication +from PySide.QtGui import QPicture, QPainter, QWidget + +class MyWidget(QWidget): + def paintEvent(self, e): + p = QPainter(self) + p.drawPicture(0, 0, self._picture) + self._app.quit() + +class QPictureTest(UsesQApplication): + def testFromData(self): + picture = QPicture() + painter = QPainter() + painter.begin(picture) + painter.drawEllipse(10,20, 80,70) + painter.end() + + data = picture.data() + picture2 = QPicture() + picture2.setData(data) + + self.assertEqual(picture2.data(), picture.data()) + + w = MyWidget() + w._picture = picture2 + w._app = self.app + w.show() + self.app.exec_() + +if __name__ == '__main__': + unittest.main() + From 047d42c704cf2bf8aabd61b7d405746506b7e37d Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Mon, 25 Apr 2011 10:10:37 -0300 Subject: [PATCH 057/455] Implemented conversion from QMultiMap to Python dictonary. Fixes bug #773. Reviewer: Lauro Moura Marcelo Lira --- PySide/QtWebKit/typesystem_webkit.xml | 15 +++++++++++++-- PySide/typesystem_templates.xml | 13 +++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/PySide/QtWebKit/typesystem_webkit.xml b/PySide/QtWebKit/typesystem_webkit.xml index eb645c2..5187cea 100644 --- a/PySide/QtWebKit/typesystem_webkit.xml +++ b/PySide/QtWebKit/typesystem_webkit.xml @@ -54,8 +54,19 @@ - - + + + + + + + + + + + + + diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml index 613a2b9..8d5390b 100644 --- a/PySide/typesystem_templates.xml +++ b/PySide/typesystem_templates.xml @@ -346,6 +346,19 @@ + From 9b4a43be493cb38adc5aa3a4b195ab9033ce550e Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Mon, 25 Apr 2011 10:12:24 -0300 Subject: [PATCH 058/455] Implemented test for QWebFrame.metadata function. Reviewer: Lauro Moura Marcelo Lira --- tests/QtWebKit/CMakeLists.txt | 1 + tests/QtWebKit/fox.html | 1 + tests/QtWebKit/webframe_test.py | 34 +++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 tests/QtWebKit/webframe_test.py diff --git a/tests/QtWebKit/CMakeLists.txt b/tests/QtWebKit/CMakeLists.txt index 1902fbf..6834141 100644 --- a/tests/QtWebKit/CMakeLists.txt +++ b/tests/QtWebKit/CMakeLists.txt @@ -2,3 +2,4 @@ PYSIDE_TEST(bug_448.py) PYSIDE_TEST(bug_694.py) PYSIDE_TEST(webpage_test.py) PYSIDE_TEST(webview_test.py) +PYSIDE_TEST(webframe_test.py) diff --git a/tests/QtWebKit/fox.html b/tests/QtWebKit/fox.html index e7691eb..da873b1 100644 --- a/tests/QtWebKit/fox.html +++ b/tests/QtWebKit/fox.html @@ -1,5 +1,6 @@ Title +

The quick brown fox jumps over the lazy dog.

diff --git a/tests/QtWebKit/webframe_test.py b/tests/QtWebKit/webframe_test.py new file mode 100644 index 0000000..596617d --- /dev/null +++ b/tests/QtWebKit/webframe_test.py @@ -0,0 +1,34 @@ +import unittest +import sys + +from PySide.QtCore import QObject, SIGNAL, QUrl +from PySide.QtWebKit import * +from PySide.QtNetwork import QNetworkRequest + +from helper import adjust_filename, UsesQApplication + + + +class TestWebFrame(UsesQApplication): + def load_finished(self, ok): + self.assert_(ok) + page = self.view.page() + self.assert_(page) + frame = page.mainFrame() + self.assert_(frame) + meta = frame.metaData() + self.assertEqual(meta['description'], ['PySide Test METADATA.']) + self.app.quit() + + def testMetaData(self): + self.view = QWebView() + QObject.connect(self.view, SIGNAL('loadFinished(bool)'), + self.load_finished) + url = QUrl.fromLocalFile(adjust_filename('fox.html', __file__)) + self.view.setUrl(url) + self.app.exec_() + + +if __name__ == '__main__': + unittest.main() + From 6ec7cd56a32680a182849817843ef95145986add Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Mon, 25 Apr 2011 10:24:57 -0300 Subject: [PATCH 059/455] Fix unit test bug_750 and qpicture_test to avoid deadlock in some plataforms. Reviewer: Lauro Moura Marcelo Lira --- tests/QtGui/bug_750.py | 3 ++- tests/QtGui/qpicture_test.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/QtGui/bug_750.py b/tests/QtGui/bug_750.py index 9b66df9..902a655 100644 --- a/tests/QtGui/bug_750.py +++ b/tests/QtGui/bug_750.py @@ -2,6 +2,7 @@ import unittest from helper import UsesQApplication +from PySide.QtCore import QTimer from PySide.QtGui import QPainter, QFont, QFontInfo, QWidget, qApp class MyWidget(QWidget): @@ -16,7 +17,7 @@ class TestQPainter(UsesQApplication): w = MyWidget() w._app = self.app w._info = None - w.show() + QTimer.singleShot(300, w.show) self.app.exec_() self.assert_(w._info) diff --git a/tests/QtGui/qpicture_test.py b/tests/QtGui/qpicture_test.py index 2aa82c9..3cc2489 100644 --- a/tests/QtGui/qpicture_test.py +++ b/tests/QtGui/qpicture_test.py @@ -2,6 +2,7 @@ import unittest import os from helper import UsesQApplication +from PySide.QtCore import QTimer from PySide.QtGui import QPicture, QPainter, QWidget class MyWidget(QWidget): @@ -27,7 +28,8 @@ class QPictureTest(UsesQApplication): w = MyWidget() w._picture = picture2 w._app = self.app - w.show() + + QTimer.singleShot(300, w.show) self.app.exec_() if __name__ == '__main__': From c104fa61ad68ece261cc459e7ac31e0a5ac7e3f9 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Tue, 19 Apr 2011 18:09:17 -0300 Subject: [PATCH 060/455] Fix bug 760 - "Method "void QMatrix::map(int x,int y,int* tx,int* ty)const" missing" Fix bug 761 - "Method "void QMatrix::map(qreal x, qreal y, qreal* tx, qreal* ty) const" missing" --- PySide/QtGui/typesystem_gui_common.xml | 31 ++++++++++++++++++++++---- tests/QtGui/qmatrix_test.py | 9 ++++++++ 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 01cd45d..749e66f 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -840,10 +840,33 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/QtGui/qmatrix_test.py b/tests/QtGui/qmatrix_test.py index 7c87e23..d1fa91e 100644 --- a/tests/QtGui/qmatrix_test.py +++ b/tests/QtGui/qmatrix_test.py @@ -44,6 +44,15 @@ class QMatrixTest(unittest.TestCase): d = m.copyDataTo() self.assert_(my_data == list(d)) + def testMatrixMapping(self): + m = QMatrix(1.0, 2.0, 1.0, 3.0, 100.0, 200.0) + res = m.map(5, 5) + self.assertAlmostEqual(res[0], 5 * 1.0 + 5 * 1.0 + 100.0) + self.assertAlmostEqual(res[1], 5 * 2.0 + 5 * 3.0 + 200.0) + res = m.map(5.0, 5.0) + self.assertAlmostEqual(res[0], 5.0 * 1.0 + 5.0 * 1.0 + 100.0) + self.assertAlmostEqual(res[1], 5.0 * 2.0 + 5.0 * 3.0 + 200.0) + if __name__ == '__main__': unittest.main() From d7684d00e3a61c4d457b04521756296dfe56d8a4 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 20 Apr 2011 15:00:02 -0300 Subject: [PATCH 061/455] Fix bug 765 - "Method "QRect QStyle::itemTextRect(const QFontMetrics&,constQRect&,int,bool,const QString&) const" missing" --- PySide/QtGui/typesystem_gui_common.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 749e66f..bbb4b0c 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -2832,8 +2832,6 @@ - -
From 0f0124e54c22d46fa71722b9eff93ebb34816d4c Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 20 Apr 2011 16:36:27 -0300 Subject: [PATCH 062/455] Fix bug 768 - "Method "QGraphicsItemGroup* QGraphicsScene::createItemGroup(const QList& items)" missing" Fix bug 769 - "Method "QGraphicsScene::destroyItemGroup(QGraphicsItemGroup* group)" missing" Reviewer: Marcelo Lira --- PySide/QtGui/typesystem_gui_common.xml | 26 ++++++++++++++++++++++---- tests/QtGui/qgraphicsscene_test.py | 16 ++++++++++++++++ 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index bbb4b0c..da919e8 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -3210,12 +3210,30 @@ - - - - + + + + + + + + + + + + Shiboken::AutoDecRef parent(%CONVERTTOPYTHON[QGraphicsItem*](%1->parentObject())); + foreach (QGraphicsItem* item, %1->children()) + Shiboken::Object::setParent(parent, %CONVERTTOPYTHON[QGraphicsItem*](item)); + %BEGIN_ALLOW_THREADS + %CPPSELF.%FUNCTION_NAME(%1); + %END_ALLOW_THREADS + // the arg was destroyed by Qt. + Shiboken::Object::invalidate(%PYARG_1); + + + diff --git a/tests/QtGui/qgraphicsscene_test.py b/tests/QtGui/qgraphicsscene_test.py index 98177e7..85f5004 100644 --- a/tests/QtGui/qgraphicsscene_test.py +++ b/tests/QtGui/qgraphicsscene_test.py @@ -148,5 +148,21 @@ class ItemRetrieve(UsesQApplication): self.assertEqual(self.scene.itemAt(50, 150), self.bottomleft) self.assertEqual(self.scene.itemAt(150, 150), self.bottomright) +class TestGraphicsGroup(UsesQApplication): + def testIt(self): + scene = QGraphicsScene() + i1 = QGraphicsRectItem() + scene.addItem(i1) + i2 = QGraphicsRectItem(i1) + i3 = QGraphicsRectItem() + i4 = QGraphicsRectItem() + group = scene.createItemGroup((i2, i3, i4)) + scene.removeItem(i1) + del i1 # this shouldn't delete i2 + self.assertEqual(i2.scene(), scene) + scene.destroyItemGroup(group) + self.assertRaises(RuntimeError, group.type) + + if __name__ == '__main__': unittest.main() From 9dd46ce92f2eccd25140d0bc911bae1b96a3f4cb Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Mon, 25 Apr 2011 15:09:21 -0300 Subject: [PATCH 063/455] Fix bugs 771, 772, 779, 780, 781, 782, 783 and 784 Bug 771 - "Constructor "QStandardItem(const QStandardItem&)" missing" Bug 772 - "Method "QPainter::drawConvexPolygon(const QPoint* points, int pointCount)" missing" Bug 779 - "Method "QPainter::drawLines(const QLine* lines, int lineCount)" missing" Bug 780 - "Method "QPainter::drawLines(const QPoint*, int)" missing" Bug 781 - "Method "QPainter::drawPoints(const QPoint*, int)" missing" Bug 782 - "Method "QPainter::drawPolygon(const QPointF*, int, Qt::FillRule)" missing" Bug 783 - "Method "QPainter::drawPolyline(const QPoint*, int)" missing" Bug 784 - "Method "QPainter::drawRects(const QRect*, int)" missing" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Renato Araújo Marcelo Lira --- PySide/QtGui/typesystem_gui_common.xml | 74 ++++++++++++++++++++------ tests/QtGui/qpainter_test.py | 28 +++++++++- 2 files changed, 85 insertions(+), 17 deletions(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index da919e8..67f0ae3 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -2317,8 +2317,6 @@ - - @@ -5046,29 +5044,73 @@ - + + + + + + + + - + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + %BEGIN_ALLOW_THREADS + %CPPSELF.%FUNCTION_NAME(%1.data(), %1.size(), %2); + %END_ALLOW_THREADS + + + + + + %BEGIN_ALLOW_THREADS + %CPPSELF.%FUNCTION_NAME(%1.data(), %1.size(), %2); + %END_ALLOW_THREADS + + + + + + + + + + + + + + diff --git a/tests/QtGui/qpainter_test.py b/tests/QtGui/qpainter_test.py index 5baa822..f86718e 100644 --- a/tests/QtGui/qpainter_test.py +++ b/tests/QtGui/qpainter_test.py @@ -36,13 +36,39 @@ class QPainterDrawText(unittest.TestCase): self.assert_(isinstance(newRect, QRectF)) - def testDrawLinesOverloads(self): + def testDrawOverloads(self): '''Calls QPainter.drawLines overloads, if something is wrong Exception and chaos ensues. Bug #395''' self.painter.drawLines([QLine(QPoint(0,0), QPoint(1,1))]) self.painter.drawLines([QPoint(0,0), QPoint(1,1)]) self.painter.drawLines([QPointF(0,0), QPointF(1,1)]) self.painter.drawLines([QLineF(QPointF(0,0), QPointF(1,1))]) + self.painter.drawPoints([QPoint(0,0), QPoint(1,1)]) + self.painter.drawPoints([QPointF(0,0), QPointF(1,1)]) + self.painter.drawConvexPolygon([QPointF(10.0, 80.0), + QPointF(20.0, 10.0), + QPointF(80.0, 30.0), + QPointF(90.0, 70.0)]) + self.painter.drawConvexPolygon([QPoint(10.0, 80.0), + QPoint(20.0, 10.0), + QPoint(80.0, 30.0), + QPoint(90.0, 70.0)]) + self.painter.drawPolygon([QPointF(10.0, 80.0), + QPointF(20.0, 10.0), + QPointF(80.0, 30.0), + QPointF(90.0, 70.0)]) + self.painter.drawPolygon([QPoint(10.0, 80.0), + QPoint(20.0, 10.0), + QPoint(80.0, 30.0), + QPoint(90.0, 70.0)]) + self.painter.drawPolyline([QPointF(10.0, 80.0), + QPointF(20.0, 10.0), + QPointF(80.0, 30.0), + QPointF(90.0, 70.0)]) + self.painter.drawPolyline([QPoint(10.0, 80.0), + QPoint(20.0, 10.0), + QPoint(80.0, 30.0), + QPoint(90.0, 70.0)]) class SetBrushWithOtherArgs(unittest.TestCase): '''Using qpainter.setBrush with args other than QBrush''' From f94046f4a2e52bea8f96337b6af7cdc373ff3a63 Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Mon, 25 Apr 2011 15:08:10 -0300 Subject: [PATCH 064/455] Implemented support to QKeySequence.operator[]. Fixes bug #774. Reviewer: Marcelo Lira Hugo Parente Lima --- PySide/QtGui/typesystem_gui_common.xml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 67f0ae3..e5d6281 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -462,6 +462,7 @@ + @@ -481,11 +482,19 @@ + + + + if (_i < 0 || _i >= %CPPSELF.count()) { + PyErr_SetString(PyExc_IndexError, "index out of bounds"); + return 0; + } + return %CONVERTTOPYTHON[int]((*%CPPSELF)[_i]); + + + - - - From 94571574b496bbf7b6658b4dc0aae60386a612fa Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Mon, 25 Apr 2011 15:08:50 -0300 Subject: [PATCH 065/455] Created unit test for QKeySequence.operator[]. Reviewer: Marcelo Lira Hugo Parente Lima --- tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/qkeysequence_test.py | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/QtGui/qkeysequence_test.py diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index f4a646d..3695e3d 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -102,6 +102,7 @@ PYSIDE_TEST(qpixmap_test.py) PYSIDE_TEST(qpixmap_constructor.py) PYSIDE_TEST(qpolygonf_test.py) PYSIDE_TEST(qpushbutton_test.py) +PYSIDE_TEST(qkeysequence_test.py) PYSIDE_TEST(qradialgradient_test.py) PYSIDE_TEST(qregion_test.py) PYSIDE_TEST(qshortcut_test.py) diff --git a/tests/QtGui/qkeysequence_test.py b/tests/QtGui/qkeysequence_test.py new file mode 100644 index 0000000..8a5c3a4 --- /dev/null +++ b/tests/QtGui/qkeysequence_test.py @@ -0,0 +1,20 @@ +import unittest + +from PySide.QtCore import Qt +from PySide.QtGui import QKeySequence + +from helper import UsesQApplication + +class QKeySequenceTest(UsesQApplication): + + def testGetItemOperator(self): + # bug #774 + ks = QKeySequence(Qt.SHIFT, Qt.CTRL, Qt.Key_P, Qt.Key_R) + self.assertEqual(ks[0], Qt.SHIFT) + self.assertEqual(ks[1], Qt.CTRL) + self.assertEqual(ks[2], Qt.Key_P) + self.assertEqual(ks[3], Qt.Key_R) + + +if __name__ == '__main__': + unittest.main() From 5d3285e41d53de399da93ecebcef04b3dc3616ee Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Mon, 25 Apr 2011 15:54:00 -0300 Subject: [PATCH 066/455] Fixed QKeySequence convertion to QVariant. Fixes bug #775. Reviewer: Marcelo Lira Hugo Parente Lima --- PySide/QtCore/qvariant_conversions.h | 21 +++++++++++---------- PySide/QtGui/typesystem_gui_common.xml | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/PySide/QtCore/qvariant_conversions.h b/PySide/QtCore/qvariant_conversions.h index 283cf4f..73e2aa4 100644 --- a/PySide/QtCore/qvariant_conversions.h +++ b/PySide/QtCore/qvariant_conversions.h @@ -82,16 +82,10 @@ struct Converter } else if (Shiboken::isShibokenEnum(pyObj)) { // QVariant(enum) return QVariant(Converter::toCpp(pyObj)); - } else if (PyDict_Check(pyObj)) { - return convertToVariantMap(pyObj); - } else if (PySequence_Check(pyObj)) { - return convertToVariantList(pyObj); - } else { + } else if (Shiboken::Object::checkType(pyObj)) { // a class supported by QVariant? - if (Shiboken::Object::checkType(pyObj)) { 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); @@ -99,10 +93,17 @@ struct Converter tr->toCpp(pyObj, args); return var; } - } - // Is a shiboken type not known by Qt - return QVariant::fromValue(pyObj); } + + //sequence and dictornay + if (PyDict_Check(pyObj)) { + return convertToVariantMap(pyObj); + } else if (PySequence_Check(pyObj)) { + return convertToVariantList(pyObj); + } + + // Is a shiboken type not known by Qt + return QVariant::fromValue(pyObj); } static PyObject* toPython(void* cppObj) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index e5d6281..fa484bc 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -493,7 +493,7 @@ - + From 50e6f9690b338a9990eff566c4e49f156e275294 Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Mon, 25 Apr 2011 15:56:01 -0300 Subject: [PATCH 067/455] Created unit test to QKeySequence convertion to QVariant. Reviewer: Marcelo Lira Hugo Parente Lima --- tests/pysidetest/CMakeLists.txt | 1 + tests/pysidetest/qvariant_test.py | 17 +++++++++++++++++ tests/pysidetest/testobject.h | 2 ++ 3 files changed, 20 insertions(+) create mode 100644 tests/pysidetest/qvariant_test.py diff --git a/tests/pysidetest/CMakeLists.txt b/tests/pysidetest/CMakeLists.txt index caa5019..aa24112 100644 --- a/tests/pysidetest/CMakeLists.txt +++ b/tests/pysidetest/CMakeLists.txt @@ -78,6 +78,7 @@ PYSIDE_TEST(delegatecreateseditor_test.py) PYSIDE_TEST(homonymoussignalandmethod_test.py) PYSIDE_TEST(list_signal_test.py) PYSIDE_TEST(modelview_test.py) +PYSIDE_TEST(qvariant_test.py) PYSIDE_TEST(signalandnamespace_test.py) PYSIDE_TEST(signalwithdefaultvalue_test.py) PYSIDE_TEST(signalemissionfrompython_test.py) diff --git a/tests/pysidetest/qvariant_test.py b/tests/pysidetest/qvariant_test.py new file mode 100644 index 0000000..d855e2b --- /dev/null +++ b/tests/pysidetest/qvariant_test.py @@ -0,0 +1,17 @@ +import unittest + +from testbinding import TestObject +from PySide.QtCore import Qt +from PySide.QtGui import QKeySequence + +from helper import UsesQApplication + +class QVariantTest(UsesQApplication): + + def testQKeySequenceQVariantOperator(self): + # bug #775 + ks = QKeySequence(Qt.SHIFT, Qt.CTRL, Qt.Key_P, Qt.Key_R) + self.assertEqual(TestObject.checkType(ks), 76) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/pysidetest/testobject.h b/tests/pysidetest/testobject.h index f2cdd5a..bfb7edd 100644 --- a/tests/pysidetest/testobject.h +++ b/tests/pysidetest/testobject.h @@ -4,6 +4,7 @@ #include #include #include +#include #ifdef pysidetest_EXPORTS #define PYSIDE_EXPORTS 1 #endif @@ -14,6 +15,7 @@ class PYSIDE_API TestObject : public QObject Q_OBJECT public: static void createApp() { int argc=0; new QApplication(argc, 0); }; + static int checkType(const QVariant& var) { return (int)var.type(); } TestObject(int idValue, QObject* parent = 0) : QObject(parent), m_idValue(idValue) {} int idValue() const { return m_idValue; } From 4bfd1759d48c828e3d21d1e7a9636a6ad87f4c92 Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Tue, 26 Apr 2011 15:06:40 -0300 Subject: [PATCH 068/455] Implemented support to iterator on QTreeWidgetItemIterator. Fixes bug #778. Reviewer: Marcelo Lira Lauro Moura --- PySide/QtGui/typesystem_gui_common.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index fa484bc..50da933 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -692,6 +692,19 @@ + + + + + + + + + if (**%CPPSELF) + %PYARG_0 = %CONVERTTOPYTHON[QTreeWidgetItemIterator*](new QTreeWidgetItemIterator((*%CPPSELF)++)); + + + %PYARG_0 = %CONVERTTOPYTHON[QTreeWidgetItem*](%CPPSELF.operator*()); From 862e1a14b2848edd6ce62d00a6547150d95bea5d Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Tue, 26 Apr 2011 15:13:24 -0300 Subject: [PATCH 069/455] Created unit test for bug #778. Reviewer: Marcelo Lira Lauro Moura --- tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/bug_778.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 tests/QtGui/bug_778.py diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 3695e3d..2789016 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -51,6 +51,7 @@ PYSIDE_TEST(bug_736.py) PYSIDE_TEST(bug_740.py) PYSIDE_TEST(bug_743.py) PYSIDE_TEST(bug_750.py) +PYSIDE_TEST(bug_778.py) PYSIDE_TEST(bug_793.py) PYSIDE_TEST(bug_811.py) PYSIDE_TEST(customproxywidget_test.py) diff --git a/tests/QtGui/bug_778.py b/tests/QtGui/bug_778.py new file mode 100644 index 0000000..b42540f --- /dev/null +++ b/tests/QtGui/bug_778.py @@ -0,0 +1,22 @@ +import unittest + +from helper import UsesQApplication + +from PySide.QtGui import QTreeWidget, QTreeWidgetItem, QTreeWidgetItemIterator + +class QTreeWidgetItemIteratorTest(UsesQApplication): + def testWidgetIterator(self): + treeWidget = QTreeWidget() + treeWidget.setColumnCount(1) + items = [] + for i in range(10): + items.append(QTreeWidgetItem(None, ['item: %d' % i])) + treeWidget.insertTopLevelItems(0, items) + + index = 0 + for it in QTreeWidgetItemIterator(treeWidget): + self.assertEqual(it.value().text(0), 'item: %d' % index) + index += 1 + +if __name__ == '__main__': + unittest.main() From 74dc26aa7180f7df26c5b975d7cd6a0443d04d78 Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Tue, 26 Apr 2011 15:19:33 -0300 Subject: [PATCH 070/455] Fix test on windows. Reviewer: Marcelo Lira Lauro Moura --- tests/QtGui/qinputcontext_test.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/QtGui/qinputcontext_test.py b/tests/QtGui/qinputcontext_test.py index c29d446..1dc3e12 100644 --- a/tests/QtGui/qinputcontext_test.py +++ b/tests/QtGui/qinputcontext_test.py @@ -11,12 +11,12 @@ class QInputContextTest(UsesQApplication): widget = QPushButton() widget.show() - if not widget.testAttribute(Qt.WA_InputMethodEnabled): - widget.setAttribute(Qt.WA_InputMethodEnabled) - context = self.app.inputContext() self.assertEqual(context.focusWidget(), None) + if not widget.testAttribute(Qt.WA_InputMethodEnabled): + widget.setAttribute(Qt.WA_InputMethodEnabled) + context.setFocusWidget(widget) self.assertEqual(context.focusWidget(), widget) From adac79f08bff1e299eb61a2341383350602b4505 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Tue, 26 Apr 2011 17:58:45 -0300 Subject: [PATCH 071/455] Fix bugs 776 and 777 Bug 776 - "Operator "QPolygon::operator<<(QPoint)" missing" Bug 777 - "Operator "QPolygon::operator<<(QVector)" missing" --- PySide/QtGui/typesystem_gui_common.xml | 18 ++++++++++++++---- tests/QtGui/qpolygonf_test.py | 6 ++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 50da933..8882367 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -651,10 +651,20 @@ - - - - + + + // %FUNCTION_NAME() + *%CPPSELF << %1; + %PYARG_0 = %CONVERTTOPYTHON[QPolygon*](%CPPSELF); + + + + + // %FUNCTION_NAME() + *%CPPSELF << %1; + %PYARG_0 = %CONVERTTOPYTHON[QPolygon*](%CPPSELF); + + diff --git a/tests/QtGui/qpolygonf_test.py b/tests/QtGui/qpolygonf_test.py index 83e643c..f842eb4 100644 --- a/tests/QtGui/qpolygonf_test.py +++ b/tests/QtGui/qpolygonf_test.py @@ -18,5 +18,11 @@ class QPolygonFNotIterableTest(unittest.TestCase): self.assertEqual(int(point.y()), i) i += 1; + def testPolygonShiftOperators(self): + p = QPolygon() + self.assertEqual(len(p), 0) + p << QPoint(10, 20) << QPoint(20, 30) << [QPoint(20, 30), QPoint(40, 50)] + self.assertEqual(len(p), 4) + if __name__ == '__main__': unittest.main() From c4225d063d7e78c6a761004745ccda4cf5188860 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 27 Apr 2011 10:04:26 -0300 Subject: [PATCH 072/455] Fix bug 766 - "Constructor "QImage(const char* const xpm[])" missing" Reviewer: Lauro Moura Marcelo Lira --- PySide/QtGui/typesystem_gui_common.xml | 52 +++--- tests/QtGui/qimage_test.py | 242 ++++++++++++++++++++++++- 2 files changed, 269 insertions(+), 25 deletions(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 8882367..f15020d 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -731,6 +731,27 @@ + + @@ -746,25 +767,7 @@ - Shiboken::AutoDecRef strList(PySequence_Fast(%PYARG_1, "Invalid sequence.")); - int lineCount = PySequence_Fast_GET_SIZE(strList.object()); - for (int line = 0; line < lineCount; ++line) { - if (!PyString_Check(PySequence_Fast_GET_ITEM(strList.object(), line))) { - PyErr_SetString(PyExc_TypeError, "The argument must be a sequence of strings."); - break; - } - } - - const char** xpm = (const char**) malloc (lineCount * sizeof(const char**)); - for (int line = 0; line < lineCount; ++line) { - xpm[line] = PyString_AS_STRING(PySequence_Fast_GET_ITEM(strList.object(), line)); - } - - %BEGIN_ALLOW_THREADS - %0 = new %TYPE(xpm); - %END_ALLOW_THREADS - - free(xpm); + @@ -997,8 +1000,14 @@ - - + + + + + + + + @@ -1014,7 +1023,6 @@ - diff --git a/tests/QtGui/qimage_test.py b/tests/QtGui/qimage_test.py index b1a3026..2eb55ac 100644 --- a/tests/QtGui/qimage_test.py +++ b/tests/QtGui/qimage_test.py @@ -2,9 +2,241 @@ '''Test cases for QImage''' import unittest -from PySide.QtGui import QImage +from PySide.QtGui import * from helper import UsesQApplication, adjust_filename +xpm = [ + "27 22 206 2", + " c None", + ". c #FEFEFE", + "+ c #FFFFFF", + "@ c #F9F9F9", + "# c #ECECEC", + "$ c #D5D5D5", + "% c #A0A0A0", + "& c #767676", + "* c #525252", + "= c #484848", + "- c #4E4E4E", + "; c #555555", + "> c #545454", + ", c #5A5A5A", + "' c #4B4B4B", + ") c #4A4A4A", + "! c #4F4F4F", + "~ c #585858", + "{ c #515151", + "] c #4C4C4C", + "^ c #B1B1B1", + "/ c #FCFCFC", + "( c #FDFDFD", + "_ c #C1C1C1", + ": c #848484", + "< c #616161", + "[ c #5E5E5E", + "} c #CECECE", + "| c #E2E2E2", + "1 c #E4E4E4", + "2 c #DFDFDF", + "3 c #D2D2D2", + "4 c #D8D8D8", + "5 c #D4D4D4", + "6 c #E6E6E6", + "7 c #F1F1F1", + "8 c #838383", + "9 c #8E8E8E", + "0 c #8F8F8F", + "a c #CBCBCB", + "b c #CCCCCC", + "c c #E9E9E9", + "d c #F2F2F2", + "e c #EDEDED", + "f c #B5B5B5", + "g c #A6A6A6", + "h c #ABABAB", + "i c #BBBBBB", + "j c #B0B0B0", + "k c #EAEAEA", + "l c #6C6C6C", + "m c #BCBCBC", + "n c #F5F5F5", + "o c #FAFAFA", + "p c #B6B6B6", + "q c #F3F3F3", + "r c #CFCFCF", + "s c #FBFBFB", + "t c #CDCDCD", + "u c #DDDDDD", + "v c #999999", + "w c #F0F0F0", + "x c #2B2B2B", + "y c #C3C3C3", + "z c #A4A4A4", + "A c #D7D7D7", + "B c #E7E7E7", + "C c #6E6E6E", + "D c #9D9D9D", + "E c #BABABA", + "F c #AEAEAE", + "G c #898989", + "H c #646464", + "I c #BDBDBD", + "J c #CACACA", + "K c #2A2A2A", + "L c #212121", + "M c #B7B7B7", + "N c #F4F4F4", + "O c #737373", + "P c #828282", + "Q c #4D4D4D", + "R c #000000", + "S c #151515", + "T c #B2B2B2", + "U c #D6D6D6", + "V c #D3D3D3", + "W c #2F2F2F", + "X c #636363", + "Y c #A1A1A1", + "Z c #BFBFBF", + "` c #E0E0E0", + " . c #6A6A6A", + ".. c #050505", + "+. c #A3A3A3", + "@. c #202020", + "#. c #5F5F5F", + "$. c #B9B9B9", + "%. c #C7C7C7", + "&. c #D0D0D0", + "*. c #3E3E3E", + "=. c #666666", + "-. c #DBDBDB", + ";. c #424242", + ">. c #C2C2C2", + ",. c #1A1A1A", + "'. c #2C2C2C", + "). c #F6F6F6", + "!. c #AAAAAA", + "~. c #DCDCDC", + "{. c #2D2D2D", + "]. c #2E2E2E", + "^. c #A7A7A7", + "/. c #656565", + "(. c #333333", + "_. c #464646", + ":. c #C4C4C4", + "<. c #B8B8B8", + "[. c #292929", + "}. c #979797", + "|. c #EFEFEF", + "1. c #909090", + "2. c #8A8A8A", + "3. c #575757", + "4. c #676767", + "5. c #C5C5C5", + "6. c #7A7A7A", + "7. c #797979", + "8. c #989898", + "9. c #EEEEEE", + "0. c #707070", + "a. c #C8C8C8", + "b. c #111111", + "c. c #AFAFAF", + "d. c #474747", + "e. c #565656", + "f. c #E3E3E3", + "g. c #494949", + "h. c #5B5B5B", + "i. c #222222", + "j. c #353535", + "k. c #D9D9D9", + "l. c #0A0A0A", + "m. c #858585", + "n. c #E5E5E5", + "o. c #0E0E0E", + "p. c #9A9A9A", + "q. c #6F6F6F", + "r. c #868686", + "s. c #060606", + "t. c #1E1E1E", + "u. c #E8E8E8", + "v. c #A5A5A5", + "w. c #0D0D0D", + "x. c #030303", + "y. c #272727", + "z. c #131313", + "A. c #1F1F1F", + "B. c #757575", + "C. c #F7F7F7", + "D. c #414141", + "E. c #080808", + "F. c #6B6B6B", + "G. c #313131", + "H. c #C0C0C0", + "I. c #C9C9C9", + "J. c #0B0B0B", + "K. c #232323", + "L. c #434343", + "M. c #3D3D3D", + "N. c #282828", + "O. c #7C7C7C", + "P. c #252525", + "Q. c #3A3A3A", + "R. c #F8F8F8", + "S. c #1B1B1B", + "T. c #949494", + "U. c #3B3B3B", + "V. c #242424", + "W. c #383838", + "X. c #6D6D6D", + "Y. c #818181", + "Z. c #939393", + "`. c #9E9E9E", + " + c #929292", + ".+ c #7D7D7D", + "++ c #ADADAD", + "@+ c #DADADA", + "#+ c #919191", + "$+ c #E1E1E1", + "%+ c #BEBEBE", + "&+ c #ACACAC", + "*+ c #9C9C9C", + "=+ c #B3B3B3", + "-+ c #808080", + ";+ c #A8A8A8", + ">+ c #393939", + ",+ c #747474", + "'+ c #7F7F7F", + ")+ c #D1D1D1", + "!+ c #606060", + "~+ c #5C5C5C", + "{+ c #686868", + "]+ c #7E7E7E", + "^+ c #787878", + "/+ c #595959", + ". . . + @ # $ % & * = - ; > , ' ) ! ~ { ] ^ / . . + + ", + ". ( + _ : < [ & } | 1 2 $ 3 4 5 3 6 7 + + 8 9 + . + . ", + ". + 0 9 a ( 3 a b c d e c f g h i g j $ k + l m + . + ", + "+ 2 8 n o p | ( q r s . # t + + + u ^ v e w + x + + + ", + "+ y z . @ A k B 7 n + ( s | p 8 C D 2 E 4 + + F G + . ", + "# H I $ J G K L - M N . 2 O P Q R R S T U s s V W j + ", + "X Y Z @ o ` _ g ...+.( 4 @.#.m G $.%.7 &.X *.=.-.;.&.", + "Q >.C ,.'.} e + ).!.k + . + + . ~.{.> ].x f 7 ^./.k (.", + "_.:.4 @ <.[.}.|.1.2.+ + + >.} 4 B + ( @ _ 3.4.5.6.r 7.", + "3.8.9.~ 0.+ a.Q b.+ + c.d.#.=.$ |.b #.e.z ^ ; ^. .f.g.", + "-.h.+ i.S M + # p j.% n 9.5.k.H l.m.V ^.n.o.M + M p.q.", + "7 r.N s.1.R t.<.|.| u.v.~ w.x.E + s y.z.A.B.C.+ 5 D.q ", + ").p.2 E.0.9 F.%.O {._ @.+ + i { [ i.G.H.P I.+ s q.} + ", + ").p.6 J.R b.K.L.M.A.! b.g.K [.R M k + N.I + + >.O.+ . ", + ").8.9.N.P...R R R R E.t.W n.+ Q.R.6 @.| + . + S.+ + . ", + "n }.w T.U.B.<.i.@ Y + + U.+ c u V.= B B 7 u.W.c + . + ", + "N T.# + }.X.Y.,.8.F.8 Z.[.`. +.+}.4 ++@+O.< ~.+ ( . + ", + "d #+1 + _ ~.u.$+b $.y @+| $+%+I.&+k.h W +.9.+ ( . + . ", + "w 0 |.*+. >.<.=+++++p a.p -+;+5.k.>+,+@ + . . + . + + ", + "q '+9.R.^ I.t b %.I.)+4 $+n.I.,+ .|.+ . . . + . + + + ", + ". p !+( + + + + + + E 0. .-+8.f.+ + . . + + . + + + + ", + ". ( A ~+{+]+^+l > /+D f.c q . + . . + + . + + + + + + " +] + class QImageTest(UsesQApplication): '''Test case for calling setPixel with float as argument''' @@ -12,8 +244,6 @@ class QImageTest(UsesQApplication): '''Test if the QImage signatures receiving string buffers exist.''' img0 = QImage(adjust_filename('sample.png', __file__)) - print type(img0.bits()) - # btw let's test the bits() method img1 = QImage(img0.bits(), img0.width(), img0.height(), img0.format()) self.assertEqual(img0, img1) @@ -33,6 +263,12 @@ class QImageTest(UsesQApplication): def testEmptyStringAsBuffer(self): img = QImage('', 100, 100, QImage.Format_ARGB32) + def testXpmConstructor(self): + label = QLabel() + img = QImage(xpm) + self.assertFalse(img.isNull()) + self.assertEqual(img.width(), 27) + self.assertEqual(img.height(), 22) if __name__ == '__main__': unittest.main() From 3bb2bf375e52006c4880aff88f20344f5ccf1f87 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 27 Apr 2011 17:51:52 -0300 Subject: [PATCH 073/455] Fix bug 836 - "Pyside crashes with more than four base classes" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Marcelo Lira Renato Araújo --- libpyside/pyside.cpp | 4 ++-- tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/bug_836.py | 28 ++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 tests/QtGui/bug_836.py diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp index a135692..4b1c17b 100644 --- a/libpyside/pyside.cpp +++ b/libpyside/pyside.cpp @@ -154,7 +154,7 @@ void initQObjectSubType(SbkObjectType* type, PyObject* args, PyObject* kwds) QByteArray className(PyString_AS_STRING(PyTuple_GET_ITEM(args, 0))); PyObject* bases = PyTuple_GET_ITEM(args, 1); - int numBases = PyTuple_GET_SIZE(args); + int numBases = PyTuple_GET_SIZE(bases); QMetaObject* baseMo = 0; for (int i = 0; i < numBases; ++i) { @@ -230,7 +230,7 @@ void initQObjectSubType(SbkObjectType* type, PyObject* args, PyObject* kwds) PyObject* getMetaDataFromQObject(QObject* cppSelf, PyObject* self, PyObject* name) { PyObject* attr = PyObject_GenericGetAttr(self, name); - if (!Shiboken::Object::isValid(reinterpret_cast(self), false)) + if (!Shiboken::Object::isValid(reinterpret_cast(self), false)) return attr; if (attr && Property::isPropertyType(attr)) { diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 2789016..ff0ce68 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -54,6 +54,7 @@ PYSIDE_TEST(bug_750.py) PYSIDE_TEST(bug_778.py) PYSIDE_TEST(bug_793.py) PYSIDE_TEST(bug_811.py) +PYSIDE_TEST(bug_836.py) PYSIDE_TEST(customproxywidget_test.py) PYSIDE_TEST(deepcopy_test.py) PYSIDE_TEST(float_to_int_implicit_conversion_test.py) diff --git a/tests/QtGui/bug_836.py b/tests/QtGui/bug_836.py new file mode 100644 index 0000000..b7d0645 --- /dev/null +++ b/tests/QtGui/bug_836.py @@ -0,0 +1,28 @@ +from PySide.QtCore import * +from PySide.QtGui import * + +class Mixin1(object): + pass + +class Mixin2(object): + pass + +class Mixin3(object): + pass + +class MainWindow(Mixin1, Mixin2, Mixin3, QFrame): + def __init__(self): + super(MainWindow, self).__init__() + +def main(): + app = QApplication([]) + # if it doesn't crash it should pass + w = MainWindow() + w.show() + QTimer.singleShot(0, w.close) + app.exec_() + +if __name__ == "__main__": + main() + + From ea4968f5f31efba2df21514ae08beb1bef29031c Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Wed, 27 Apr 2011 15:02:10 -0300 Subject: [PATCH 074/455] Fixed QVariant conversion for dictionary. Reviewer: Marcelo Lira Hugo Parente Lima --- PySide/QtCore/qvariant_conversions.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PySide/QtCore/qvariant_conversions.h b/PySide/QtCore/qvariant_conversions.h index 73e2aa4..354955b 100644 --- a/PySide/QtCore/qvariant_conversions.h +++ b/PySide/QtCore/qvariant_conversions.h @@ -97,7 +97,9 @@ struct Converter //sequence and dictornay if (PyDict_Check(pyObj)) { - return convertToVariantMap(pyObj); + QVariant ret = convertToVariantMap(pyObj); + if (ret.isValid()) + return ret; } else if (PySequence_Check(pyObj)) { return convertToVariantList(pyObj); } @@ -170,7 +172,7 @@ struct Converter ret.insert(Converter::toCpp(key), toCpp(value)); return QVariant(ret); } else { - return toCpp(map); + return QVariant(); } } From 26e45be10730d10f9d04b1c6548ac545106ce643 Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Wed, 27 Apr 2011 15:02:38 -0300 Subject: [PATCH 075/455] Implemented stream operator for PyObjectWrapper. Fixes bug #829. Reviewer: Marcelo Lira Hugo Parente Lima --- libpyside/signalmanager.cpp | 42 +++++++++++++++++++++++++++++++++++++ libpyside/signalmanager.h | 4 ++++ 2 files changed, 46 insertions(+) diff --git a/libpyside/signalmanager.cpp b/libpyside/signalmanager.cpp index 16fac54..6ab8456 100644 --- a/libpyside/signalmanager.cpp +++ b/libpyside/signalmanager.cpp @@ -87,6 +87,47 @@ PyObjectWrapper::operator PyObject*() const return m_me; } +QDataStream &operator<<(QDataStream &out, const PyObjectWrapper &myObj) +{ + static PyObject *reduce_func = 0; + + Shiboken::GilState gil; + if (!reduce_func) { + Shiboken::AutoDecRef pickleModule(PyImport_ImportModule("pickle")); + reduce_func = PyObject_GetAttrString(pickleModule, "dumps"); + } + Shiboken::AutoDecRef repr(PyObject_CallFunctionObjArgs(reduce_func, (PyObject*)myObj, NULL)); + if (repr.object()) { + char* buff; + Py_ssize_t size; + PyString_AsStringAndSize(repr.object(), &buff, &size); + QByteArray data(buff, size); + out << data; + } + return out; +} + +QDataStream &operator>>(QDataStream &in, PyObjectWrapper &myObj) +{ + static PyObject *eval_func = 0; + + Shiboken::GilState gil; + if (!eval_func) { + Shiboken::AutoDecRef pickleModule(PyImport_ImportModule("pickle")); + eval_func = PyObject_GetAttrString(pickleModule, "loads"); + } + + QByteArray repr; + in >> repr; + Shiboken::AutoDecRef pyCode(PyString_FromStringAndSize(repr.data(), repr.size())); + Shiboken::AutoDecRef value(PyObject_CallFunctionObjArgs(eval_func, pyCode.object(), 0)); + if (!value.object()) { + value = Py_None; + } + myObj = PyObjectWrapper(value); + return in; +} + }; namespace Shiboken { @@ -132,6 +173,7 @@ SignalManager::SignalManager() : m_d(new SignalManagerPrivate) // Register PyObject type to use in queued signal and slot connections qRegisterMetaType(PYTHON_TYPE); + qRegisterMetaTypeStreamOperators(PYTHON_TYPE); TypeResolver::createValueTypeResolver(PYTHON_TYPE); TypeResolver::createValueTypeResolver("object"); diff --git a/libpyside/signalmanager.h b/libpyside/signalmanager.h index f6ce1fb..5ea1366 100644 --- a/libpyside/signalmanager.h +++ b/libpyside/signalmanager.h @@ -28,6 +28,7 @@ #include #include #include +#include class QObject; @@ -49,6 +50,9 @@ private: void* m_data; //future }; +PYSIDE_API QDataStream &operator<<(QDataStream& out, const PyObjectWrapper& myObj); +PYSIDE_API QDataStream &operator>>(QDataStream& in, PyObjectWrapper& myObj); + class PYSIDE_API SignalManager { public: From 8eb96fc200e2ecebdd0945475c10c458c308ef2a Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Wed, 27 Apr 2011 15:03:43 -0300 Subject: [PATCH 076/455] Created unit test for bug 829. Reviewer: Marcelo Lira Hugo Parente Lima --- tests/QtCore/CMakeLists.txt | 1 + tests/QtCore/bug_829.conf | 2 ++ tests/QtCore/bug_829.py | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 tests/QtCore/bug_829.conf create mode 100644 tests/QtCore/bug_829.py diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index a7cd8b1..fc5fbc5 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -10,6 +10,7 @@ PYSIDE_TEST(bug_699.py) PYSIDE_TEST(bug_706.py) PYSIDE_TEST(bug_723.py) PYSIDE_TEST(bug_724.py) +PYSIDE_TEST(bug_829.py) PYSIDE_TEST(blocking_signals_test.py) PYSIDE_TEST(child_event_test.py) PYSIDE_TEST(deepcopy_test.py) diff --git a/tests/QtCore/bug_829.conf b/tests/QtCore/bug_829.conf new file mode 100644 index 0000000..90da1ee --- /dev/null +++ b/tests/QtCore/bug_829.conf @@ -0,0 +1,2 @@ +[General] +x=@Variant(\0\0\0\x7f\0\0\0\x18PySide::PyObjectWrapper\0\0\0\0\x12(dp0\nI1\nS'a'\np1\ns.) diff --git a/tests/QtCore/bug_829.py b/tests/QtCore/bug_829.py new file mode 100644 index 0000000..a805d87 --- /dev/null +++ b/tests/QtCore/bug_829.py @@ -0,0 +1,18 @@ +# Test case for PySide bug 829 +# Thomas Perl ; 2011-04-16 + +import unittest +from PySide.QtCore import QSettings +from helper import adjust_filename + +class QVariantConversions(unittest.TestCase): + def testDictionary(self): + s = QSettings(adjust_filename('bug_829.conf', __file__), QSettings.IniFormat) + #Save value + s.setValue('x', {1: 'a'}) + s.sync() + #Restore value + self.assertEqual(s.value('x'), {1: 'a'}) + +if __name__ == '__main__': + unittest.main() From 4fd1c23ae3b631188aebbf73251d04c18c42f274 Mon Sep 17 00:00:00 2001 From: Lauro Neto Date: Tue, 26 Apr 2011 16:28:22 -0300 Subject: [PATCH 077/455] Update inheritance diagram sphinx extension. Better handling missing classes. Reviewer: Renato Araujo Reviewer: Marcelo Lira --- doc/inheritance_diagram.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/doc/inheritance_diagram.py b/doc/inheritance_diagram.py index 7b13094..616b470 100644 --- a/doc/inheritance_diagram.py +++ b/doc/inheritance_diagram.py @@ -100,15 +100,22 @@ class InheritanceGraph(object): __import__(fullname) todoc = sys.modules[fullname] except ImportError: + # else it is a class, then import the module + if not path: + if currmodule: + # try the current module + path = currmodule + else: + raise InheritanceException( + 'Could not import class %r specified for ' + 'inheritance diagram' % base) try: - __import__(currmodule) - todoc = sys.modules[currmodule] - for attr in name.split('.'): - todoc = getattr(todoc, attr) + __import__(path) + todoc = getattr(sys.modules[path], base) except (ImportError, AttributeError): raise InheritanceException( 'Could not import class or module %r specified for ' - 'inheritance diagram' % (currmodule + '.' + name)) + 'inheritance diagram' % (path + '.' + base)) # If a class, just return it if inspect.isclass(todoc): From 17a4a02354482045a0a8c1f3ec65c058d4b265ef Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Thu, 28 Apr 2011 16:33:25 -0300 Subject: [PATCH 078/455] Fix documentation bug 853 - "Provide constants for Qt and PySide version" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Marcelo Lira Renato Araújo --- doc/contents.rst | 1 + doc/pysideversion.rst | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 doc/pysideversion.rst diff --git a/doc/contents.rst b/doc/contents.rst index 691bce6..c2ea806 100644 --- a/doc/contents.rst +++ b/doc/contents.rst @@ -21,6 +21,7 @@ Other stuff :maxdepth: 1 pysideapi2.rst + pysideversion.rst Module Index ============ diff --git a/doc/pysideversion.rst b/doc/pysideversion.rst new file mode 100644 index 0000000..23666b8 --- /dev/null +++ b/doc/pysideversion.rst @@ -0,0 +1,31 @@ +Getting PySide and Qt version +***************************** + +PySide exports their version numbers among the version of Qt used to compile PySide in a pythonnic way, you can check it using the variables: + +:: + + import PySide + + # Prints PySide version + # e.g. 1.0.2 + print PySide.__version__ + + # Gets a tuple with each version component + # e.g. (1, 0, 2, 'final', 1) + print PySide.__version_info__ + + # Prints the Qt version used to compile PySide + # e.g. "4.7.2" + print PySide.QtCore.__version__ + + # Gets a tuple with each version components of Qt used to compile PySide + # e.g. (4, 7, 2) + print PySide.QtCore.__version_info__ + + +Note that the Qt version used to compile PySide may differ from the version used to run PySide, to get the current running Qt version you can do: + +:: + + print PySide.QtCore.qVersion() From b2ddb6c1cd46f6e56962fd64731aaa6a85a36855 Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Thu, 28 Apr 2011 11:20:32 -0300 Subject: [PATCH 079/455] Fixed QKeyEvent polymorphic-id-expression to support QEvent::ShortcutOverride. Applyed patch from Evan Patterson Fixes bug #833 Reviewer: Marcelo Lira Hugo Parente Lima --- PySide/QtGui/typesystem_gui_common.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index f15020d..6f50865 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -2800,7 +2800,7 @@ - + %PYARG_0 = %CONVERTTOPYTHON[bool](!(&%CPPSELF == %1)); From 8d6761b93d82f59b8a75af59043eecbbf16ec9c6 Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Thu, 28 Apr 2011 14:50:25 -0300 Subject: [PATCH 080/455] Fixed QFileDialog functions which used QString as pointer to return values Fixes bug #819 Reviewer: Marcelo Lira Hugo Parente Lima --- PySide/QtGui/typesystem_gui_common.xml | 21 ++++++++++++--------- PySide/typesystem_templates.xml | 4 ++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 6f50865..0601296 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -4344,34 +4344,37 @@ + + + + - - - + + + + - - - + + + + - - - diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml index 8d5390b..5c0f1ef 100644 --- a/PySide/typesystem_templates.xml +++ b/PySide/typesystem_templates.xml @@ -241,9 +241,9 @@ - - + @@ -2704,7 +2704,7 @@ - + @@ -2764,15 +2764,15 @@ - + - + - + @@ -2819,7 +2819,7 @@ - + @@ -2862,13 +2862,13 @@ Se also bug: http://bugs.pyside.org/show_bug.cgi?id=725 --> - - - + + + - + @@ -2883,25 +2883,25 @@ - + - + - + - + - + - + - + - + - + @@ -2921,7 +2921,7 @@ - + @@ -2976,13 +2976,13 @@ - + - - + + @@ -3020,7 +3020,7 @@ - + diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index d4c53b7..4822340 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -1222,7 +1222,7 @@ - + @@ -1245,7 +1245,7 @@ - + @@ -1582,7 +1582,7 @@ - + PyObject* userTypeConstant = PyInt_FromLong(QGraphicsItem::UserType); PyDict_SetItemString(Sbk_QGraphicsItem_Type.super.ht_type.tp_dict, "UserType", userTypeConstant); @@ -1658,7 +1658,7 @@ - + @@ -2846,7 +2846,7 @@ - + @@ -2880,7 +2880,7 @@ - + @@ -5103,8 +5103,8 @@ - - + + @@ -5786,7 +5786,7 @@ - + @@ -5856,7 +5856,7 @@ - + @@ -5926,7 +5926,7 @@ - + @@ -5996,7 +5996,7 @@ - + @@ -6066,7 +6066,7 @@ - + @@ -6136,7 +6136,7 @@ - + @@ -6206,7 +6206,7 @@ - + @@ -6276,7 +6276,7 @@ - + @@ -6346,8 +6346,7 @@ - - + @@ -6437,23 +6436,23 @@ - + - + - - - - - + + + + + - - + + - + @@ -6462,18 +6461,18 @@ --> - - - - - - - - - + + + + + + + + + - + @@ -6505,18 +6504,18 @@ --> - + - + - + - + - + @@ -6535,7 +6534,7 @@ - + @@ -6557,7 +6556,7 @@ - + diff --git a/PySide/QtNetwork/typesystem_network.xml b/PySide/QtNetwork/typesystem_network.xml index 5ed1755..969eb86 100644 --- a/PySide/QtNetwork/typesystem_network.xml +++ b/PySide/QtNetwork/typesystem_network.xml @@ -37,7 +37,7 @@ - + @@ -191,7 +191,7 @@ - + diff --git a/PySide/QtOpenGL/typesystem_opengl.xml b/PySide/QtOpenGL/typesystem_opengl.xml index 6855bf3..b694400 100644 --- a/PySide/QtOpenGL/typesystem_opengl.xml +++ b/PySide/QtOpenGL/typesystem_opengl.xml @@ -44,7 +44,7 @@ - + @@ -87,11 +87,11 @@ - - + + - + diff --git a/PySide/QtScript/typesystem_script.xml b/PySide/QtScript/typesystem_script.xml index 7c28a40..870aec0 100644 --- a/PySide/QtScript/typesystem_script.xml +++ b/PySide/QtScript/typesystem_script.xml @@ -43,7 +43,7 @@ - + diff --git a/PySide/QtScriptTools/typesystem_scripttools.xml b/PySide/QtScriptTools/typesystem_scripttools.xml index d223112..5c2b5e0 100644 --- a/PySide/QtScriptTools/typesystem_scripttools.xml +++ b/PySide/QtScriptTools/typesystem_scripttools.xml @@ -24,7 +24,7 @@ - + diff --git a/PySide/QtTest/typesystem_test.xml b/PySide/QtTest/typesystem_test.xml index 85de89f..9897225 100644 --- a/PySide/QtTest/typesystem_test.xml +++ b/PySide/QtTest/typesystem_test.xml @@ -54,9 +54,9 @@ - + - + @@ -66,7 +66,7 @@ - + @@ -88,7 +88,7 @@ - + diff --git a/PySide/QtWebKit/typesystem_webkit.xml b/PySide/QtWebKit/typesystem_webkit.xml index 177a29c..45f498e 100644 --- a/PySide/QtWebKit/typesystem_webkit.xml +++ b/PySide/QtWebKit/typesystem_webkit.xml @@ -47,7 +47,7 @@ - + @@ -82,7 +82,7 @@ - + @@ -99,8 +99,10 @@ // Cast the parameters according to the extension type if (extension == QWebPage::ChooseMultipleFilesExtension) %out = %CONVERTTOPYTHON[ChooseMultipleFilesExtensionOption*](reinterpret_cast<const ChooseMultipleFilesExtensionOption*>(option)); + #if QT_VERSION >= 0x040600 else if (extension == QWebPage::ErrorPageExtension) %out = %CONVERTTOPYTHON[ErrorPageExtensionOption*](reinterpret_cast<const ErrorPageExtensionOption*>(option)); + #endif @@ -109,8 +111,10 @@ // Cast the parameters according to the extension type if (extension == QWebPage::ChooseMultipleFilesExtension) %out = %CONVERTTOPYTHON[ChooseMultipleFilesExtensionReturn*](reinterpret_cast<const ChooseMultipleFilesExtensionReturn*>(output)); + #if QT_VERSION >= 0x040600 else if (extension == QWebPage::ErrorPageExtension) %out = %CONVERTTOPYTHON[ErrorPageExtensionReturn*](reinterpret_cast<const ErrorPageExtensionReturn*>(output)); + #endif @@ -166,10 +170,10 @@ - - - + + + - + diff --git a/PySide/QtXmlPatterns/typesystem_xmlpatterns.xml b/PySide/QtXmlPatterns/typesystem_xmlpatterns.xml index 51fca16..665b302 100644 --- a/PySide/QtXmlPatterns/typesystem_xmlpatterns.xml +++ b/PySide/QtXmlPatterns/typesystem_xmlpatterns.xml @@ -21,8 +21,8 @@ - - + + From 2c83593868edc665c22f7453e8c6becc4e5d8a87 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Thu, 12 May 2011 19:01:47 -0300 Subject: [PATCH 125/455] Correctly set SUPPORTED_QT_VERSION variable to the current Qt version. --- CMakeLists.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 94deb50..ff911d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,11 +117,7 @@ else() endif() # Define supported Qt Version -if(${QT_VERSION_MAJOR} EQUAL 4 AND ${QT_VERSION_MINOR} GREATER 6) - set(SUPPORTED_QT_VERSION 4.7) -else() - set(SUPPORTED_QT_VERSION 4.6) -endif() +set(SUPPORTED_QT_VERSION "${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}") set(BINDING_VERSION ${BINDING_API_VERSION}.${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}) From c1f05a0624b1fae87f091c4c4d302ce38df4ba5a Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Thu, 12 May 2011 19:04:22 -0300 Subject: [PATCH 126/455] Only add Qt4.6 classes when using Qt4.6 on QtTest and QtGui. --- PySide/QtGui/CMakeLists.txt | 2 +- PySide/QtTest/CMakeLists.txt | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/PySide/QtGui/CMakeLists.txt b/PySide/QtGui/CMakeLists.txt index d026a93..4362115 100644 --- a/PySide/QtGui/CMakeLists.txt +++ b/PySide/QtGui/CMakeLists.txt @@ -17,7 +17,7 @@ endif() if (${QT_VERSION_MAJOR} EQUAL 4 AND ${QT_VERSION_MINOR} LESS 6) - set (QtGui_46_SRC ) + set(QtGui_46_SRC "") else() set(QtGui_46_SRC ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qmatrix2x2_wrapper.cpp diff --git a/PySide/QtTest/CMakeLists.txt b/PySide/QtTest/CMakeLists.txt index 21dd0d8..6ef7a42 100644 --- a/PySide/QtTest/CMakeLists.txt +++ b/PySide/QtTest/CMakeLists.txt @@ -1,9 +1,17 @@ project(QtTest) +if (${QT_VERSION_MAJOR} EQUAL 4 AND ${QT_VERSION_MINOR} LESS 6) + set(QtTest_46_SRC "") +else() + set(QtTest_46_SRC + ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtTest/qtest_pysideqtoucheventsequence_wrapper.cpp + ) +endif() + set(QtTest_SRC ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtTest/qtest_wrapper.cpp -${CMAKE_CURRENT_BINARY_DIR}/PySide/QtTest/qtest_pysideqtoucheventsequence_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtTest/qttest_module_wrapper.cpp +${QtTest_46_SRC} ) set(QtTest_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}") From 82335c46141201269abadf3fc05943c122ffb59e Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Thu, 12 May 2011 19:05:44 -0300 Subject: [PATCH 127/455] Always use the local Qt headers + global.h.in cleanup. Reviewer: Lauro Moura Marcelo Lira --- PySide/global.h.in | 1192 ++------------------------------------------ 1 file changed, 55 insertions(+), 1137 deletions(-) diff --git a/PySide/global.h.in b/PySide/global.h.in index 997ad85..a0a0ed1 100644 --- a/PySide/global.h.in +++ b/PySide/global.h.in @@ -22,7 +22,7 @@ #undef QT_NO_STL_WCHAR #define Q_BYTE_ORDER // used to enable QSysInfo.Endian detection on MacOSX -#include +#include "@QT_QTCORE_INCLUDE_DIR@/qnamespace.h" QT_BEGIN_HEADER @@ -328,1173 +328,91 @@ QT_END_HEADER // not in release #define QT_NO_DEBUG -#include +#include "@QT_QTCORE_INCLUDE_DIR@/QtCore" #if @ENABLE_MAC@ || @ENABLE_WIN@ // Workaround to parse the QApplication header #define Q_INTERNAL_QAPP_SRC #undef qdoc #endif -#include +#include "@QT_QTGUI_INCLUDE_DIR@/QtGui" #include "qpytextobject.h" // PySide class #if @ENABLE_X11@ - #include - #include - #include + #include "@QT_QTGUI_INCLUDE_DIR@/QX11Info" + #include "@QT_QTGUI_INCLUDE_DIR@/QX11EmbedContainer" + #include "@QT_QTGUI_INCLUDE_DIR@/QX11EmbedWidget" #elif @ENABLE_MAC@ - #include + #include "@QT_QTGUI_INCLUDE_DIR@/qmacstyle_mac.h" #endif -#include -#include -#include -#include -#include -#include +#include "@QT_QTXML_INCLUDE_DIR@/QtXml" +#include "@QT_QTUITOOLS_INCLUDE_DIR@/QtUiTools" +#include "@QT_QTNETWORK_INCLUDE_DIR@/QtNetwork" +#include "@QT_QTSCRIPT_INCLUDE_DIR@/QtScript" +#include "@QT_QTSCRIPTTOOLS_INCLUDE_DIR@/QtScriptTools" +#include "@QT_QTMULTIMEDIA_INCLUDE_DIR@/QtMultimedia" #include -#include +#include "@QT_QTDECLARATIVE_INCLUDE_DIR@/QtDeclarative" // QT_GUI_LIB must be defined to QSqlRelationalDelegate become visible #define QT_GUI_LIB #undef Q_DECLARE_INTERFACE -#include -#include +#include "@QT_QTSQL_INCLUDE_DIR@/QtSql" +#include "@QT_QTSVG_INCLUDE_DIR@/QtSvg" #if @QT_QTXMLPATTERNS_FOUND@ -# include +# include "@QT_QTXMLPATTERNS_INCLUDE_DIR@/QtXmlPatterns" #endif #if @QT_QTWEBKIT_FOUND@ -# include +# include "@QT_QTWEBKIT_INCLUDE_DIR@/QtWebKit" #endif #if @QT_QTTEST_FOUND@ -# include +# include "@QT_QTTEST_INCLUDE_DIR@/QtTest" +#if @QT_VERSION_MINOR@ > 5 # include "pysideqtesttouch.h" #endif +#endif // Phonon #include "phonon/pyside_phonon.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "@QT_PHONON_INCLUDE_DIR@/abstractaudiooutput.h" +#include "@QT_PHONON_INCLUDE_DIR@/abstractmediastream.h" +#include "@QT_PHONON_INCLUDE_DIR@/abstractvideooutput.h" +#include "@QT_PHONON_INCLUDE_DIR@/addoninterface.h" +#include "@QT_PHONON_INCLUDE_DIR@/audiooutput.h" +#include "@QT_PHONON_INCLUDE_DIR@/audiooutputinterface.h" +#include "@QT_PHONON_INCLUDE_DIR@/backendcapabilities.h" +#include "@QT_PHONON_INCLUDE_DIR@/backendinterface.h" +#include "@QT_PHONON_INCLUDE_DIR@/effect.h" +#include "@QT_PHONON_INCLUDE_DIR@/effectinterface.h" +#include "@QT_PHONON_INCLUDE_DIR@/effectparameter.h" +#include "@QT_PHONON_INCLUDE_DIR@/effectwidget.h" +#include "@QT_PHONON_INCLUDE_DIR@/mediacontroller.h" +#include "@QT_PHONON_INCLUDE_DIR@/medianode.h" +#include "@QT_PHONON_INCLUDE_DIR@/mediaobject.h" +#include "@QT_PHONON_INCLUDE_DIR@/mediaobjectinterface.h" +#include "@QT_PHONON_INCLUDE_DIR@/mediasource.h" +#include "@QT_PHONON_INCLUDE_DIR@/objectdescription.h" +#include "@QT_PHONON_INCLUDE_DIR@/objectdescriptionmodel.h" +#include "@QT_PHONON_INCLUDE_DIR@/path.h" +#include "@QT_PHONON_INCLUDE_DIR@/phonon_export.h" +#include "@QT_PHONON_INCLUDE_DIR@/phonondefs.h" +#include "@QT_PHONON_INCLUDE_DIR@/phononnamespace.h" +#include "@QT_PHONON_INCLUDE_DIR@/platformplugin.h" +#include "@QT_PHONON_INCLUDE_DIR@/seekslider.h" +#include "@QT_PHONON_INCLUDE_DIR@/streaminterface.h" +#include "@QT_PHONON_INCLUDE_DIR@/videoplayer.h" +#include "@QT_PHONON_INCLUDE_DIR@/videowidget.h" +#include "@QT_PHONON_INCLUDE_DIR@/videowidgetinterface.h" +#include "@QT_PHONON_INCLUDE_DIR@/volumefadereffect.h" +#include "@QT_PHONON_INCLUDE_DIR@/volumefaderinterface.h" +#include "@QT_PHONON_INCLUDE_DIR@/volumeslider.h" //QtHelp need be included after QtSql -#include +#include "@QT_QTHELP_INCLUDE_DIR@/QtHelp" #ifndef QT_NO_OPENGL -#define GL_ACCUM 0x0100 -#define GL_LOAD 0x0101 -#define GL_RETURN 0x0102 -#define GL_MULT 0x0103 -#define GL_ADD 0x0104 - -/* AlphaFunction */ -#define GL_NEVER 0x0200 -#define GL_LESS 0x0201 -#define GL_EQUAL 0x0202 -#define GL_LEQUAL 0x0203 -#define GL_GREATER 0x0204 -#define GL_NOTEQUAL 0x0205 -#define GL_GEQUAL 0x0206 -#define GL_ALWAYS 0x0207 - -/* AttribMask */ -#define GL_CURRENT_BIT 0x00000001 -#define GL_POINT_BIT 0x00000002 -#define GL_LINE_BIT 0x00000004 -#define GL_POLYGON_BIT 0x00000008 -#define GL_POLYGON_STIPPLE_BIT 0x00000010 -#define GL_PIXEL_MODE_BIT 0x00000020 -#define GL_LIGHTING_BIT 0x00000040 -#define GL_FOG_BIT 0x00000080 -#define GL_DEPTH_BUFFER_BIT 0x00000100 -#define GL_ACCUM_BUFFER_BIT 0x00000200 -#define GL_STENCIL_BUFFER_BIT 0x00000400 -#define GL_VIEWPORT_BIT 0x00000800 -#define GL_TRANSFORM_BIT 0x00001000 -#define GL_ENABLE_BIT 0x00002000 -#define GL_COLOR_BUFFER_BIT 0x00004000 -#define GL_HINT_BIT 0x00008000 -#define GL_EVAL_BIT 0x00010000 -#define GL_LIST_BIT 0x00020000 -#define GL_TEXTURE_BIT 0x00040000 -#define GL_SCISSOR_BIT 0x00080000 -#define GL_ALL_ATTRIB_BITS 0x000fffff - -/* BeginMode */ -#define GL_POINTS 0x0000 -#define GL_LINES 0x0001 -#define GL_LINE_LOOP 0x0002 -#define GL_LINE_STRIP 0x0003 -#define GL_TRIANGLES 0x0004 -#define GL_TRIANGLE_STRIP 0x0005 -#define GL_TRIANGLE_FAN 0x0006 -#define GL_QUADS 0x0007 -#define GL_QUAD_STRIP 0x0008 -#define GL_POLYGON 0x0009 - -/* BlendingFactorDest */ -#define GL_ZERO 0 -#define GL_ONE 1 -#define GL_SRC_COLOR 0x0300 -#define GL_ONE_MINUS_SRC_COLOR 0x0301 -#define GL_SRC_ALPHA 0x0302 -#define GL_ONE_MINUS_SRC_ALPHA 0x0303 -#define GL_DST_ALPHA 0x0304 -#define GL_ONE_MINUS_DST_ALPHA 0x0305 - -/* BlendingFactorSrc */ -/* GL_ZERO */ -/* GL_ONE */ -#define GL_DST_COLOR 0x0306 -#define GL_ONE_MINUS_DST_COLOR 0x0307 -#define GL_SRC_ALPHA_SATURATE 0x0308 -/* GL_SRC_ALPHA */ -/* GL_ONE_MINUS_SRC_ALPHA */ -/* GL_DST_ALPHA */ -/* GL_ONE_MINUS_DST_ALPHA */ - -/* Boolean */ -#define GL_TRUE 1 -#define GL_FALSE 0 - -/* ClearBufferMask */ -/* GL_COLOR_BUFFER_BIT */ -/* GL_ACCUM_BUFFER_BIT */ -/* GL_STENCIL_BUFFER_BIT */ -/* GL_DEPTH_BUFFER_BIT */ - -/* ClientArrayType */ -/* GL_VERTEX_ARRAY */ -/* GL_NORMAL_ARRAY */ -/* GL_COLOR_ARRAY */ -/* GL_INDEX_ARRAY */ -/* GL_TEXTURE_COORD_ARRAY */ -/* GL_EDGE_FLAG_ARRAY */ - -/* ClipPlaneName */ -#define GL_CLIP_PLANE0 0x3000 -#define GL_CLIP_PLANE1 0x3001 -#define GL_CLIP_PLANE2 0x3002 -#define GL_CLIP_PLANE3 0x3003 -#define GL_CLIP_PLANE4 0x3004 -#define GL_CLIP_PLANE5 0x3005 - -/* ColorMaterialFace */ -/* GL_FRONT */ -/* GL_BACK */ -/* GL_FRONT_AND_BACK */ - -/* ColorMaterialParameter */ -/* GL_AMBIENT */ -/* GL_DIFFUSE */ -/* GL_SPECULAR */ -/* GL_EMISSION */ -/* GL_AMBIENT_AND_DIFFUSE */ - -/* ColorPointerType */ -/* GL_BYTE */ -/* GL_UNSIGNED_BYTE */ -/* GL_SHORT */ -/* GL_UNSIGNED_SHORT */ -/* GL_INT */ -/* GL_UNSIGNED_INT */ -/* GL_FLOAT */ -/* GL_DOUBLE */ - -/* CullFaceMode */ -/* GL_FRONT */ -/* GL_BACK */ -/* GL_FRONT_AND_BACK */ - -/* DataType */ -#define GL_BYTE 0x1400 -#define GL_UNSIGNED_BYTE 0x1401 -#define GL_SHORT 0x1402 -#define GL_UNSIGNED_SHORT 0x1403 -#define GL_INT 0x1404 -#define GL_UNSIGNED_INT 0x1405 -#define GL_FLOAT 0x1406 -#define GL_2_BYTES 0x1407 -#define GL_3_BYTES 0x1408 -#define GL_4_BYTES 0x1409 -#define GL_DOUBLE 0x140A - -/* DepthFunction */ -/* GL_NEVER */ -/* GL_LESS */ -/* GL_EQUAL */ -/* GL_LEQUAL */ -/* GL_GREATER */ -/* GL_NOTEQUAL */ -/* GL_GEQUAL */ -/* GL_ALWAYS */ - -/* DrawBufferMode */ -#define GL_NONE 0 -#define GL_FRONT_LEFT 0x0400 -#define GL_FRONT_RIGHT 0x0401 -#define GL_BACK_LEFT 0x0402 -#define GL_BACK_RIGHT 0x0403 -#define GL_FRONT 0x0404 -#define GL_BACK 0x0405 -#define GL_LEFT 0x0406 -#define GL_RIGHT 0x0407 -#define GL_FRONT_AND_BACK 0x0408 -#define GL_AUX0 0x0409 -#define GL_AUX1 0x040A -#define GL_AUX2 0x040B -#define GL_AUX3 0x040C - -/* Enable */ -/* GL_FOG */ -/* GL_LIGHTING */ -/* GL_TEXTURE_1D */ -/* GL_TEXTURE_2D */ -/* GL_LINE_STIPPLE */ -/* GL_POLYGON_STIPPLE */ -/* GL_CULL_FACE */ -/* GL_ALPHA_TEST */ -/* GL_BLEND */ -/* GL_INDEX_LOGIC_OP */ -/* GL_COLOR_LOGIC_OP */ -/* GL_DITHER */ -/* GL_STENCIL_TEST */ -/* GL_DEPTH_TEST */ -/* GL_CLIP_PLANE0 */ -/* GL_CLIP_PLANE1 */ -/* GL_CLIP_PLANE2 */ -/* GL_CLIP_PLANE3 */ -/* GL_CLIP_PLANE4 */ -/* GL_CLIP_PLANE5 */ -/* GL_LIGHT0 */ -/* GL_LIGHT1 */ -/* GL_LIGHT2 */ -/* GL_LIGHT3 */ -/* GL_LIGHT4 */ -/* GL_LIGHT5 */ -/* GL_LIGHT6 */ -/* GL_LIGHT7 */ -/* GL_TEXTURE_GEN_S */ -/* GL_TEXTURE_GEN_T */ -/* GL_TEXTURE_GEN_R */ -/* GL_TEXTURE_GEN_Q */ -/* GL_MAP1_VERTEX_3 */ -/* GL_MAP1_VERTEX_4 */ -/* GL_MAP1_COLOR_4 */ -/* GL_MAP1_INDEX */ -/* GL_MAP1_NORMAL */ -/* GL_MAP1_TEXTURE_COORD_1 */ -/* GL_MAP1_TEXTURE_COORD_2 */ -/* GL_MAP1_TEXTURE_COORD_3 */ -/* GL_MAP1_TEXTURE_COORD_4 */ -/* GL_MAP2_VERTEX_3 */ -/* GL_MAP2_VERTEX_4 */ -/* GL_MAP2_COLOR_4 */ -/* GL_MAP2_INDEX */ -/* GL_MAP2_NORMAL */ -/* GL_MAP2_TEXTURE_COORD_1 */ -/* GL_MAP2_TEXTURE_COORD_2 */ -/* GL_MAP2_TEXTURE_COORD_3 */ -/* GL_MAP2_TEXTURE_COORD_4 */ -/* GL_POINT_SMOOTH */ -/* GL_LINE_SMOOTH */ -/* GL_POLYGON_SMOOTH */ -/* GL_SCISSOR_TEST */ -/* GL_COLOR_MATERIAL */ -/* GL_NORMALIZE */ -/* GL_AUTO_NORMAL */ -/* GL_VERTEX_ARRAY */ -/* GL_NORMAL_ARRAY */ -/* GL_COLOR_ARRAY */ -/* GL_INDEX_ARRAY */ -/* GL_TEXTURE_COORD_ARRAY */ -/* GL_EDGE_FLAG_ARRAY */ -/* GL_POLYGON_OFFSET_POINT */ -/* GL_POLYGON_OFFSET_LINE */ -/* GL_POLYGON_OFFSET_FILL */ - -/* ErrorCode */ -#define GL_NO_ERROR 0 -#define GL_INVALID_ENUM 0x0500 -#define GL_INVALID_VALUE 0x0501 -#define GL_INVALID_OPERATION 0x0502 -#define GL_STACK_OVERFLOW 0x0503 -#define GL_STACK_UNDERFLOW 0x0504 -#define GL_OUT_OF_MEMORY 0x0505 - -/* FeedBackMode */ -#define GL_2D 0x0600 -#define GL_3D 0x0601 -#define GL_3D_COLOR 0x0602 -#define GL_3D_COLOR_TEXTURE 0x0603 -#define GL_4D_COLOR_TEXTURE 0x0604 - -/* FeedBackToken */ -#define GL_PASS_THROUGH_TOKEN 0x0700 -#define GL_POINT_TOKEN 0x0701 -#define GL_LINE_TOKEN 0x0702 -#define GL_POLYGON_TOKEN 0x0703 -#define GL_BITMAP_TOKEN 0x0704 -#define GL_DRAW_PIXEL_TOKEN 0x0705 -#define GL_COPY_PIXEL_TOKEN 0x0706 -#define GL_LINE_RESET_TOKEN 0x0707 - -/* FogMode */ -/* GL_LINEAR */ -#define GL_EXP 0x0800 -#define GL_EXP2 0x0801 - - -/* FogParameter */ -/* GL_FOG_COLOR */ -/* GL_FOG_DENSITY */ -/* GL_FOG_END */ -/* GL_FOG_INDEX */ -/* GL_FOG_MODE */ -/* GL_FOG_START */ - -/* FrontFaceDirection */ -#define GL_CW 0x0900 -#define GL_CCW 0x0901 - -/* GetMapTarget */ -#define GL_COEFF 0x0A00 -#define GL_ORDER 0x0A01 -#define GL_DOMAIN 0x0A02 - -/* GetPixelMap */ -/* GL_PIXEL_MAP_I_TO_I */ -/* GL_PIXEL_MAP_S_TO_S */ -/* GL_PIXEL_MAP_I_TO_R */ -/* GL_PIXEL_MAP_I_TO_G */ -/* GL_PIXEL_MAP_I_TO_B */ -/* GL_PIXEL_MAP_I_TO_A */ -/* GL_PIXEL_MAP_R_TO_R */ -/* GL_PIXEL_MAP_G_TO_G */ -/* GL_PIXEL_MAP_B_TO_B */ -/* GL_PIXEL_MAP_A_TO_A */ - -/* GetPointerTarget */ -/* GL_VERTEX_ARRAY_POINTER */ -/* GL_NORMAL_ARRAY_POINTER */ -/* GL_COLOR_ARRAY_POINTER */ -/* GL_INDEX_ARRAY_POINTER */ -/* GL_TEXTURE_COORD_ARRAY_POINTER */ -/* GL_EDGE_FLAG_ARRAY_POINTER */ - -/* GetTarget */ -#define GL_CURRENT_COLOR 0x0B00 -#define GL_CURRENT_INDEX 0x0B01 -#define GL_CURRENT_NORMAL 0x0B02 -#define GL_CURRENT_TEXTURE_COORDS 0x0B03 -#define GL_CURRENT_RASTER_COLOR 0x0B04 -#define GL_CURRENT_RASTER_INDEX 0x0B05 -#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 -#define GL_CURRENT_RASTER_POSITION 0x0B07 -#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 -#define GL_CURRENT_RASTER_DISTANCE 0x0B09 -#define GL_POINT_SMOOTH 0x0B10 -#define GL_POINT_SIZE 0x0B11 -#define GL_POINT_SIZE_RANGE 0x0B12 -#define GL_POINT_SIZE_GRANULARITY 0x0B13 -#define GL_LINE_SMOOTH 0x0B20 -#define GL_LINE_WIDTH 0x0B21 -#define GL_LINE_WIDTH_RANGE 0x0B22 -#define GL_LINE_WIDTH_GRANULARITY 0x0B23 -#define GL_LINE_STIPPLE 0x0B24 -#define GL_LINE_STIPPLE_PATTERN 0x0B25 -#define GL_LINE_STIPPLE_REPEAT 0x0B26 -#define GL_LIST_MODE 0x0B30 -#define GL_MAX_LIST_NESTING 0x0B31 -#define GL_LIST_BASE 0x0B32 -#define GL_LIST_INDEX 0x0B33 -#define GL_POLYGON_MODE 0x0B40 -#define GL_POLYGON_SMOOTH 0x0B41 -#define GL_POLYGON_STIPPLE 0x0B42 -#define GL_EDGE_FLAG 0x0B43 -#define GL_CULL_FACE 0x0B44 -#define GL_CULL_FACE_MODE 0x0B45 -#define GL_FRONT_FACE 0x0B46 -#define GL_LIGHTING 0x0B50 -#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 -#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 -#define GL_LIGHT_MODEL_AMBIENT 0x0B53 -#define GL_SHADE_MODEL 0x0B54 -#define GL_COLOR_MATERIAL_FACE 0x0B55 -#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 -#define GL_COLOR_MATERIAL 0x0B57 -#define GL_FOG 0x0B60 -#define GL_FOG_INDEX 0x0B61 -#define GL_FOG_DENSITY 0x0B62 -#define GL_FOG_START 0x0B63 -#define GL_FOG_END 0x0B64 -#define GL_FOG_MODE 0x0B65 -#define GL_FOG_COLOR 0x0B66 -#define GL_DEPTH_RANGE 0x0B70 -#define GL_DEPTH_TEST 0x0B71 -#define GL_DEPTH_WRITEMASK 0x0B72 -#define GL_DEPTH_CLEAR_VALUE 0x0B73 -#define GL_DEPTH_FUNC 0x0B74 -#define GL_ACCUM_CLEAR_VALUE 0x0B80 -#define GL_STENCIL_TEST 0x0B90 -#define GL_STENCIL_CLEAR_VALUE 0x0B91 -#define GL_STENCIL_FUNC 0x0B92 -#define GL_STENCIL_VALUE_MASK 0x0B93 -#define GL_STENCIL_FAIL 0x0B94 -#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 -#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 -#define GL_STENCIL_REF 0x0B97 -#define GL_STENCIL_WRITEMASK 0x0B98 -#define GL_MATRIX_MODE 0x0BA0 -#define GL_NORMALIZE 0x0BA1 -#define GL_VIEWPORT 0x0BA2 -#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 -#define GL_PROJECTION_STACK_DEPTH 0x0BA4 -#define GL_TEXTURE_STACK_DEPTH 0x0BA5 -#define GL_MODELVIEW_MATRIX 0x0BA6 -#define GL_PROJECTION_MATRIX 0x0BA7 -#define GL_TEXTURE_MATRIX 0x0BA8 -#define GL_ATTRIB_STACK_DEPTH 0x0BB0 -#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 -#define GL_ALPHA_TEST 0x0BC0 -#define GL_ALPHA_TEST_FUNC 0x0BC1 -#define GL_ALPHA_TEST_REF 0x0BC2 -#define GL_DITHER 0x0BD0 -#define GL_BLEND_DST 0x0BE0 -#define GL_BLEND_SRC 0x0BE1 -#define GL_BLEND 0x0BE2 -#define GL_LOGIC_OP_MODE 0x0BF0 -#define GL_INDEX_LOGIC_OP 0x0BF1 -#define GL_COLOR_LOGIC_OP 0x0BF2 -#define GL_AUX_BUFFERS 0x0C00 -#define GL_DRAW_BUFFER 0x0C01 -#define GL_READ_BUFFER 0x0C02 -#define GL_SCISSOR_BOX 0x0C10 -#define GL_SCISSOR_TEST 0x0C11 -#define GL_INDEX_CLEAR_VALUE 0x0C20 -#define GL_INDEX_WRITEMASK 0x0C21 -#define GL_COLOR_CLEAR_VALUE 0x0C22 -#define GL_COLOR_WRITEMASK 0x0C23 -#define GL_INDEX_MODE 0x0C30 -#define GL_RGBA_MODE 0x0C31 -#define GL_DOUBLEBUFFER 0x0C32 -#define GL_STEREO 0x0C33 -#define GL_RENDER_MODE 0x0C40 -#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 -#define GL_POINT_SMOOTH_HINT 0x0C51 -#define GL_LINE_SMOOTH_HINT 0x0C52 -#define GL_POLYGON_SMOOTH_HINT 0x0C53 -#define GL_FOG_HINT 0x0C54 -#define GL_TEXTURE_GEN_S 0x0C60 -#define GL_TEXTURE_GEN_T 0x0C61 -#define GL_TEXTURE_GEN_R 0x0C62 -#define GL_TEXTURE_GEN_Q 0x0C63 -#define GL_PIXEL_MAP_I_TO_I 0x0C70 -#define GL_PIXEL_MAP_S_TO_S 0x0C71 -#define GL_PIXEL_MAP_I_TO_R 0x0C72 -#define GL_PIXEL_MAP_I_TO_G 0x0C73 -#define GL_PIXEL_MAP_I_TO_B 0x0C74 -#define GL_PIXEL_MAP_I_TO_A 0x0C75 -#define GL_PIXEL_MAP_R_TO_R 0x0C76 -#define GL_PIXEL_MAP_G_TO_G 0x0C77 -#define GL_PIXEL_MAP_B_TO_B 0x0C78 -#define GL_PIXEL_MAP_A_TO_A 0x0C79 -#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 -#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 -#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 -#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 -#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 -#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 -#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 -#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 -#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 -#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 -#define GL_UNPACK_SWAP_BYTES 0x0CF0 -#define GL_UNPACK_LSB_FIRST 0x0CF1 -#define GL_UNPACK_ROW_LENGTH 0x0CF2 -#define GL_UNPACK_SKIP_ROWS 0x0CF3 -#define GL_UNPACK_SKIP_PIXELS 0x0CF4 -#define GL_UNPACK_ALIGNMENT 0x0CF5 -#define GL_PACK_SWAP_BYTES 0x0D00 -#define GL_PACK_LSB_FIRST 0x0D01 -#define GL_PACK_ROW_LENGTH 0x0D02 -#define GL_PACK_SKIP_ROWS 0x0D03 -#define GL_PACK_SKIP_PIXELS 0x0D04 -#define GL_PACK_ALIGNMENT 0x0D05 -#define GL_MAP_COLOR 0x0D10 -#define GL_MAP_STENCIL 0x0D11 -#define GL_INDEX_SHIFT 0x0D12 -#define GL_INDEX_OFFSET 0x0D13 -#define GL_RED_SCALE 0x0D14 -#define GL_RED_BIAS 0x0D15 -#define GL_ZOOM_X 0x0D16 -#define GL_ZOOM_Y 0x0D17 -#define GL_GREEN_SCALE 0x0D18 -#define GL_GREEN_BIAS 0x0D19 -#define GL_BLUE_SCALE 0x0D1A -#define GL_BLUE_BIAS 0x0D1B -#define GL_ALPHA_SCALE 0x0D1C -#define GL_ALPHA_BIAS 0x0D1D -#define GL_DEPTH_SCALE 0x0D1E -#define GL_DEPTH_BIAS 0x0D1F -#define GL_MAX_EVAL_ORDER 0x0D30 -#define GL_MAX_LIGHTS 0x0D31 -#define GL_MAX_CLIP_PLANES 0x0D32 -#define GL_MAX_TEXTURE_SIZE 0x0D33 -#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 -#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 -#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 -#define GL_MAX_NAME_STACK_DEPTH 0x0D37 -#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 -#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 -#define GL_MAX_VIEWPORT_DIMS 0x0D3A -#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B -#define GL_SUBPIXEL_BITS 0x0D50 -#define GL_INDEX_BITS 0x0D51 -#define GL_RED_BITS 0x0D52 -#define GL_GREEN_BITS 0x0D53 -#define GL_BLUE_BITS 0x0D54 -#define GL_ALPHA_BITS 0x0D55 -#define GL_DEPTH_BITS 0x0D56 -#define GL_STENCIL_BITS 0x0D57 -#define GL_ACCUM_RED_BITS 0x0D58 -#define GL_ACCUM_GREEN_BITS 0x0D59 -#define GL_ACCUM_BLUE_BITS 0x0D5A -#define GL_ACCUM_ALPHA_BITS 0x0D5B -#define GL_NAME_STACK_DEPTH 0x0D70 -#define GL_AUTO_NORMAL 0x0D80 -#define GL_MAP1_COLOR_4 0x0D90 -#define GL_MAP1_INDEX 0x0D91 -#define GL_MAP1_NORMAL 0x0D92 -#define GL_MAP1_TEXTURE_COORD_1 0x0D93 -#define GL_MAP1_TEXTURE_COORD_2 0x0D94 -#define GL_MAP1_TEXTURE_COORD_3 0x0D95 -#define GL_MAP1_TEXTURE_COORD_4 0x0D96 -#define GL_MAP1_VERTEX_3 0x0D97 -#define GL_MAP1_VERTEX_4 0x0D98 -#define GL_MAP2_COLOR_4 0x0DB0 -#define GL_MAP2_INDEX 0x0DB1 -#define GL_MAP2_NORMAL 0x0DB2 -#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 -#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 -#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 -#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 -#define GL_MAP2_VERTEX_3 0x0DB7 -#define GL_MAP2_VERTEX_4 0x0DB8 -#define GL_MAP1_GRID_DOMAIN 0x0DD0 -#define GL_MAP1_GRID_SEGMENTS 0x0DD1 -#define GL_MAP2_GRID_DOMAIN 0x0DD2 -#define GL_MAP2_GRID_SEGMENTS 0x0DD3 -#define GL_TEXTURE_1D 0x0DE0 -#define GL_TEXTURE_2D 0x0DE1 -#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 -#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 -#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 -#define GL_SELECTION_BUFFER_POINTER 0x0DF3 -#define GL_SELECTION_BUFFER_SIZE 0x0DF4 -/* GL_TEXTURE_BINDING_1D */ -/* GL_TEXTURE_BINDING_2D */ -/* GL_VERTEX_ARRAY */ -/* GL_NORMAL_ARRAY */ -/* GL_COLOR_ARRAY */ -/* GL_INDEX_ARRAY */ -/* GL_TEXTURE_COORD_ARRAY */ -/* GL_EDGE_FLAG_ARRAY */ -/* GL_VERTEX_ARRAY_SIZE */ -/* GL_VERTEX_ARRAY_TYPE */ -/* GL_VERTEX_ARRAY_STRIDE */ -/* GL_NORMAL_ARRAY_TYPE */ -/* GL_NORMAL_ARRAY_STRIDE */ -/* GL_COLOR_ARRAY_SIZE */ -/* GL_COLOR_ARRAY_TYPE */ -/* GL_COLOR_ARRAY_STRIDE */ -/* GL_INDEX_ARRAY_TYPE */ -/* GL_INDEX_ARRAY_STRIDE */ -/* GL_TEXTURE_COORD_ARRAY_SIZE */ -/* GL_TEXTURE_COORD_ARRAY_TYPE */ -/* GL_TEXTURE_COORD_ARRAY_STRIDE */ -/* GL_EDGE_FLAG_ARRAY_STRIDE */ -/* GL_POLYGON_OFFSET_FACTOR */ -/* GL_POLYGON_OFFSET_UNITS */ - -/* GetTextureParameter */ -/* GL_TEXTURE_MAG_FILTER */ -/* GL_TEXTURE_MIN_FILTER */ -/* GL_TEXTURE_WRAP_S */ -/* GL_TEXTURE_WRAP_T */ -#define GL_TEXTURE_WIDTH 0x1000 -#define GL_TEXTURE_HEIGHT 0x1001 -#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 -#define GL_TEXTURE_BORDER_COLOR 0x1004 -#define GL_TEXTURE_BORDER 0x1005 -/* GL_TEXTURE_RED_SIZE */ -/* GL_TEXTURE_GREEN_SIZE */ -/* GL_TEXTURE_BLUE_SIZE */ -/* GL_TEXTURE_ALPHA_SIZE */ -/* GL_TEXTURE_LUMINANCE_SIZE */ -/* GL_TEXTURE_INTENSITY_SIZE */ -/* GL_TEXTURE_PRIORITY */ -/* GL_TEXTURE_RESIDENT */ - -/* HintMode */ -#define GL_DONT_CARE 0x1100 -#define GL_FASTEST 0x1101 -#define GL_NICEST 0x1102 - -/* HintTarget */ -/* GL_PERSPECTIVE_CORRECTION_HINT */ -/* GL_POINT_SMOOTH_HINT */ -/* GL_LINE_SMOOTH_HINT */ -/* GL_POLYGON_SMOOTH_HINT */ -/* GL_FOG_HINT */ -/* GL_PHONG_HINT */ - -/* IndexPointerType */ -/* GL_SHORT */ -/* GL_INT */ -/* GL_FLOAT */ -/* GL_DOUBLE */ - -/* LightModelParameter */ -/* GL_LIGHT_MODEL_AMBIENT */ -/* GL_LIGHT_MODEL_LOCAL_VIEWER */ -/* GL_LIGHT_MODEL_TWO_SIDE */ - -/* LightName */ -#define GL_LIGHT0 0x4000 -#define GL_LIGHT1 0x4001 -#define GL_LIGHT2 0x4002 -#define GL_LIGHT3 0x4003 -#define GL_LIGHT4 0x4004 -#define GL_LIGHT5 0x4005 -#define GL_LIGHT6 0x4006 -#define GL_LIGHT7 0x4007 - -/* LightParameter */ -#define GL_AMBIENT 0x1200 -#define GL_DIFFUSE 0x1201 -#define GL_SPECULAR 0x1202 -#define GL_POSITION 0x1203 -#define GL_SPOT_DIRECTION 0x1204 -#define GL_SPOT_EXPONENT 0x1205 -#define GL_SPOT_CUTOFF 0x1206 -#define GL_CONSTANT_ATTENUATION 0x1207 -#define GL_LINEAR_ATTENUATION 0x1208 -#define GL_QUADRATIC_ATTENUATION 0x1209 - -/* InterleavedArrays */ -/* GL_V2F */ -/* GL_V3F */ -/* GL_C4UB_V2F */ -/* GL_C4UB_V3F */ -/* GL_C3F_V3F */ -/* GL_N3F_V3F */ -/* GL_C4F_N3F_V3F */ -/* GL_T2F_V3F */ -/* GL_T4F_V4F */ -/* GL_T2F_C4UB_V3F */ -/* GL_T2F_C3F_V3F */ -/* GL_T2F_N3F_V3F */ -/* GL_T2F_C4F_N3F_V3F */ -/* GL_T4F_C4F_N3F_V4F */ - -/* ListMode */ -#define GL_COMPILE 0x1300 -#define GL_COMPILE_AND_EXECUTE 0x1301 - -/* ListNameType */ -/* GL_BYTE */ -/* GL_UNSIGNED_BYTE */ -/* GL_SHORT */ -/* GL_UNSIGNED_SHORT */ -/* GL_INT */ -/* GL_UNSIGNED_INT */ -/* GL_FLOAT */ -/* GL_2_BYTES */ -/* GL_3_BYTES */ -/* GL_4_BYTES */ - -/* LogicOp */ -#define GL_CLEAR 0x1500 -#define GL_AND 0x1501 -#define GL_AND_REVERSE 0x1502 -#define GL_COPY 0x1503 -#define GL_AND_INVERTED 0x1504 -#define GL_NOOP 0x1505 -#define GL_XOR 0x1506 -#define GL_OR 0x1507 -#define GL_NOR 0x1508 -#define GL_EQUIV 0x1509 -#define GL_INVERT 0x150A -#define GL_OR_REVERSE 0x150B -#define GL_COPY_INVERTED 0x150C -#define GL_OR_INVERTED 0x150D -#define GL_NAND 0x150E -#define GL_SET 0x150F - -/* MapTarget */ -/* GL_MAP1_COLOR_4 */ -/* GL_MAP1_INDEX */ -/* GL_MAP1_NORMAL */ -/* GL_MAP1_TEXTURE_COORD_1 */ -/* GL_MAP1_TEXTURE_COORD_2 */ -/* GL_MAP1_TEXTURE_COORD_3 */ -/* GL_MAP1_TEXTURE_COORD_4 */ -/* GL_MAP1_VERTEX_3 */ -/* GL_MAP1_VERTEX_4 */ -/* GL_MAP2_COLOR_4 */ -/* GL_MAP2_INDEX */ -/* GL_MAP2_NORMAL */ -/* GL_MAP2_TEXTURE_COORD_1 */ -/* GL_MAP2_TEXTURE_COORD_2 */ -/* GL_MAP2_TEXTURE_COORD_3 */ -/* GL_MAP2_TEXTURE_COORD_4 */ -/* GL_MAP2_VERTEX_3 */ -/* GL_MAP2_VERTEX_4 */ - -/* MaterialFace */ -/* GL_FRONT */ -/* GL_BACK */ -/* GL_FRONT_AND_BACK */ - -/* MaterialParameter */ -#define GL_EMISSION 0x1600 -#define GL_SHININESS 0x1601 -#define GL_AMBIENT_AND_DIFFUSE 0x1602 -#define GL_COLOR_INDEXES 0x1603 -/* GL_AMBIENT */ -/* GL_DIFFUSE */ -/* GL_SPECULAR */ - -/* MatrixMode */ -#define GL_MODELVIEW 0x1700 -#define GL_PROJECTION 0x1701 -#define GL_TEXTURE 0x1702 - -/* MeshMode1 */ -/* GL_POINT */ -/* GL_LINE */ - -/* MeshMode2 */ -/* GL_POINT */ -/* GL_LINE */ -/* GL_FILL */ - -/* NormalPointerType */ -/* GL_BYTE */ -/* GL_SHORT */ -/* GL_INT */ -/* GL_FLOAT */ -/* GL_DOUBLE */ - -/* PixelCopyType */ -#define GL_COLOR 0x1800 -#define GL_DEPTH 0x1801 -#define GL_STENCIL 0x1802 - -/* PixelFormat */ -#define GL_COLOR_INDEX 0x1900 -#define GL_STENCIL_INDEX 0x1901 -#define GL_DEPTH_COMPONENT 0x1902 -#define GL_RED 0x1903 -#define GL_GREEN 0x1904 -#define GL_BLUE 0x1905 -#define GL_ALPHA 0x1906 -#define GL_RGB 0x1907 -#define GL_RGBA 0x1908 -#define GL_LUMINANCE 0x1909 -#define GL_LUMINANCE_ALPHA 0x190A - -/* PixelMap */ -/* GL_PIXEL_MAP_I_TO_I */ -/* GL_PIXEL_MAP_S_TO_S */ -/* GL_PIXEL_MAP_I_TO_R */ -/* GL_PIXEL_MAP_I_TO_G */ -/* GL_PIXEL_MAP_I_TO_B */ -/* GL_PIXEL_MAP_I_TO_A */ -/* GL_PIXEL_MAP_R_TO_R */ -/* GL_PIXEL_MAP_G_TO_G */ -/* GL_PIXEL_MAP_B_TO_B */ -/* GL_PIXEL_MAP_A_TO_A */ - -/* PixelStore */ -/* GL_UNPACK_SWAP_BYTES */ -/* GL_UNPACK_LSB_FIRST */ -/* GL_UNPACK_ROW_LENGTH */ -/* GL_UNPACK_SKIP_ROWS */ -/* GL_UNPACK_SKIP_PIXELS */ -/* GL_UNPACK_ALIGNMENT */ -/* GL_PACK_SWAP_BYTES */ -/* GL_PACK_LSB_FIRST */ -/* GL_PACK_ROW_LENGTH */ -/* GL_PACK_SKIP_ROWS */ -/* GL_PACK_SKIP_PIXELS */ -/* GL_PACK_ALIGNMENT */ - -/* PixelTransfer */ -/* GL_MAP_COLOR */ -/* GL_MAP_STENCIL */ -/* GL_INDEX_SHIFT */ -/* GL_INDEX_OFFSET */ -/* GL_RED_SCALE */ -/* GL_RED_BIAS */ -/* GL_GREEN_SCALE */ -/* GL_GREEN_BIAS */ -/* GL_BLUE_SCALE */ -/* GL_BLUE_BIAS */ -/* GL_ALPHA_SCALE */ -/* GL_ALPHA_BIAS */ -/* GL_DEPTH_SCALE */ -/* GL_DEPTH_BIAS */ - -/* PixelType */ -#define GL_BITMAP 0x1A00 -/* GL_BYTE */ -/* GL_UNSIGNED_BYTE */ -/* GL_SHORT */ -/* GL_UNSIGNED_SHORT */ -/* GL_INT */ -/* GL_UNSIGNED_INT */ -/* GL_FLOAT */ - -/* PolygonMode */ -#define GL_POINT 0x1B00 -#define GL_LINE 0x1B01 -#define GL_FILL 0x1B02 - -/* ReadBufferMode */ -/* GL_FRONT_LEFT */ -/* GL_FRONT_RIGHT */ -/* GL_BACK_LEFT */ -/* GL_BACK_RIGHT */ -/* GL_FRONT */ -/* GL_BACK */ -/* GL_LEFT */ -/* GL_RIGHT */ -/* GL_AUX0 */ -/* GL_AUX1 */ -/* GL_AUX2 */ -/* GL_AUX3 */ - -/* RenderingMode */ -#define GL_RENDER 0x1C00 -#define GL_FEEDBACK 0x1C01 -#define GL_SELECT 0x1C02 - -/* ShadingModel */ -#define GL_FLAT 0x1D00 -#define GL_SMOOTH 0x1D01 - - -/* StencilFunction */ -/* GL_NEVER */ -/* GL_LESS */ -/* GL_EQUAL */ -/* GL_LEQUAL */ -/* GL_GREATER */ -/* GL_NOTEQUAL */ -/* GL_GEQUAL */ -/* GL_ALWAYS */ - -/* StencilOp */ -/* GL_ZERO */ -#define GL_KEEP 0x1E00 -#define GL_REPLACE 0x1E01 -#define GL_INCR 0x1E02 -#define GL_DECR 0x1E03 -/* GL_INVERT */ - -/* StringName */ -#define GL_VENDOR 0x1F00 -#define GL_RENDERER 0x1F01 -#define GL_VERSION 0x1F02 -#define GL_EXTENSIONS 0x1F03 - -/* TextureCoordName */ -#define GL_S 0x2000 -#define GL_T 0x2001 -#define GL_R 0x2002 -#define GL_Q 0x2003 - -/* TexCoordPointerType */ -/* GL_SHORT */ -/* GL_INT */ -/* GL_FLOAT */ -/* GL_DOUBLE */ - -/* TextureEnvMode */ -#define GL_MODULATE 0x2100 -#define GL_DECAL 0x2101 -/* GL_BLEND */ -/* GL_REPLACE */ - -/* TextureEnvParameter */ -#define GL_TEXTURE_ENV_MODE 0x2200 -#define GL_TEXTURE_ENV_COLOR 0x2201 - -/* TextureEnvTarget */ -#define GL_TEXTURE_ENV 0x2300 - -/* TextureGenMode */ -#define GL_EYE_LINEAR 0x2400 -#define GL_OBJECT_LINEAR 0x2401 -#define GL_SPHERE_MAP 0x2402 - -/* TextureGenParameter */ -#define GL_TEXTURE_GEN_MODE 0x2500 -#define GL_OBJECT_PLANE 0x2501 -#define GL_EYE_PLANE 0x2502 - -/* TextureMagFilter */ -#define GL_NEAREST 0x2600 -#define GL_LINEAR 0x2601 - -/* TextureMinFilter */ -/* GL_NEAREST */ -/* GL_LINEAR */ -#define GL_NEAREST_MIPMAP_NEAREST 0x2700 -#define GL_LINEAR_MIPMAP_NEAREST 0x2701 -#define GL_NEAREST_MIPMAP_LINEAR 0x2702 -#define GL_LINEAR_MIPMAP_LINEAR 0x2703 - -/* TextureParameterName */ -#define GL_TEXTURE_MAG_FILTER 0x2800 -#define GL_TEXTURE_MIN_FILTER 0x2801 -#define GL_TEXTURE_WRAP_S 0x2802 -#define GL_TEXTURE_WRAP_T 0x2803 -/* GL_TEXTURE_BORDER_COLOR */ -/* GL_TEXTURE_PRIORITY */ - -/* TextureTarget */ -/* GL_TEXTURE_1D */ -/* GL_TEXTURE_2D */ -/* GL_PROXY_TEXTURE_1D */ -/* GL_PROXY_TEXTURE_2D */ - -/* TextureWrapMode */ -#define GL_CLAMP 0x2900 -#define GL_REPEAT 0x2901 - -/* VertexPointerType */ -/* GL_SHORT */ -/* GL_INT */ -/* GL_FLOAT */ -/* GL_DOUBLE */ - -/* ClientAttribMask */ -#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 -#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 -#define GL_CLIENT_ALL_ATTRIB_BITS 0xffffffff - -/* polygon_offset */ -#define GL_POLYGON_OFFSET_FACTOR 0x8038 -#define GL_POLYGON_OFFSET_UNITS 0x2A00 -#define GL_POLYGON_OFFSET_POINT 0x2A01 -#define GL_POLYGON_OFFSET_LINE 0x2A02 -#define GL_POLYGON_OFFSET_FILL 0x8037 - -/* texture */ -#define GL_ALPHA4 0x803B -#define GL_ALPHA8 0x803C -#define GL_ALPHA12 0x803D -#define GL_ALPHA16 0x803E -#define GL_LUMINANCE4 0x803F -#define GL_LUMINANCE8 0x8040 -#define GL_LUMINANCE12 0x8041 -#define GL_LUMINANCE16 0x8042 -#define GL_LUMINANCE4_ALPHA4 0x8043 -#define GL_LUMINANCE6_ALPHA2 0x8044 -#define GL_LUMINANCE8_ALPHA8 0x8045 -#define GL_LUMINANCE12_ALPHA4 0x8046 -#define GL_LUMINANCE12_ALPHA12 0x8047 -#define GL_LUMINANCE16_ALPHA16 0x8048 -#define GL_INTENSITY 0x8049 -#define GL_INTENSITY4 0x804A -#define GL_INTENSITY8 0x804B -#define GL_INTENSITY12 0x804C -#define GL_INTENSITY16 0x804D -#define GL_R3_G3_B2 0x2A10 -#define GL_RGB4 0x804F -#define GL_RGB5 0x8050 -#define GL_RGB8 0x8051 -#define GL_RGB10 0x8052 -#define GL_RGB12 0x8053 -#define GL_RGB16 0x8054 -#define GL_RGBA2 0x8055 -#define GL_RGBA4 0x8056 -#define GL_RGB5_A1 0x8057 -#define GL_RGBA8 0x8058 -#define GL_RGB10_A2 0x8059 -#define GL_RGBA12 0x805A -#define GL_RGBA16 0x805B -#define GL_TEXTURE_RED_SIZE 0x805C -#define GL_TEXTURE_GREEN_SIZE 0x805D -#define GL_TEXTURE_BLUE_SIZE 0x805E -#define GL_TEXTURE_ALPHA_SIZE 0x805F -#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 -#define GL_TEXTURE_INTENSITY_SIZE 0x8061 -#define GL_PROXY_TEXTURE_1D 0x8063 -#define GL_PROXY_TEXTURE_2D 0x8064 - -/* texture_object */ -#define GL_TEXTURE_PRIORITY 0x8066 -#define GL_TEXTURE_RESIDENT 0x8067 -#define GL_TEXTURE_BINDING_1D 0x8068 -#define GL_TEXTURE_BINDING_2D 0x8069 - -/* vertex_array */ -#define GL_VERTEX_ARRAY 0x8074 -#define GL_NORMAL_ARRAY 0x8075 -#define GL_COLOR_ARRAY 0x8076 -#define GL_INDEX_ARRAY 0x8077 -#define GL_TEXTURE_COORD_ARRAY 0x8078 -#define GL_EDGE_FLAG_ARRAY 0x8079 -#define GL_VERTEX_ARRAY_SIZE 0x807A -#define GL_VERTEX_ARRAY_TYPE 0x807B -#define GL_VERTEX_ARRAY_STRIDE 0x807C -#define GL_NORMAL_ARRAY_TYPE 0x807E -#define GL_NORMAL_ARRAY_STRIDE 0x807F -#define GL_COLOR_ARRAY_SIZE 0x8081 -#define GL_COLOR_ARRAY_TYPE 0x8082 -#define GL_COLOR_ARRAY_STRIDE 0x8083 -#define GL_INDEX_ARRAY_TYPE 0x8085 -#define GL_INDEX_ARRAY_STRIDE 0x8086 -#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 -#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 -#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A -#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C -#define GL_VERTEX_ARRAY_POINTER 0x808E -#define GL_NORMAL_ARRAY_POINTER 0x808F -#define GL_COLOR_ARRAY_POINTER 0x8090 -#define GL_INDEX_ARRAY_POINTER 0x8091 -#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 -#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 -#define GL_V2F 0x2A20 -#define GL_V3F 0x2A21 -#define GL_C4UB_V2F 0x2A22 -#define GL_C4UB_V3F 0x2A23 -#define GL_C3F_V3F 0x2A24 -#define GL_N3F_V3F 0x2A25 -#define GL_C4F_N3F_V3F 0x2A26 -#define GL_T2F_V3F 0x2A27 -#define GL_T4F_V4F 0x2A28 -#define GL_T2F_C4UB_V3F 0x2A29 -#define GL_T2F_C3F_V3F 0x2A2A -#define GL_T2F_N3F_V3F 0x2A2B -#define GL_T2F_C4F_N3F_V3F 0x2A2C -#define GL_T4F_C4F_N3F_V4F 0x2A2D - -/* Extensions */ -#define GL_EXT_vertex_array 1 -#define GL_EXT_bgra 1 -#define GL_EXT_paletted_texture 1 -#define GL_WIN_swap_hint 1 -#define GL_WIN_draw_range_elements 1 -// #define GL_WIN_phong_shading 1 -// #define GL_WIN_specular_fog 1 - -/* EXT_vertex_array */ -#define GL_VERTEX_ARRAY_EXT 0x8074 -#define GL_NORMAL_ARRAY_EXT 0x8075 -#define GL_COLOR_ARRAY_EXT 0x8076 -#define GL_INDEX_ARRAY_EXT 0x8077 -#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 -#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 -#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A -#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B -#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C -#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D -#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E -#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F -#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 -#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 -#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 -#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 -#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 -#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 -#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 -#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 -#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 -#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 -#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A -#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B -#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C -#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D -#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E -#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F -#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 -#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 -#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 -#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 -#define GL_DOUBLE_EXT GL_DOUBLE - -/* EXT_bgra */ -#define GL_BGR_EXT 0x80E0 -#define GL_BGRA_EXT 0x80E1 - -/* EXT_paletted_texture */ - -/* These must match the GL_COLOR_TABLE_*_SGI enumerants */ -#define GL_COLOR_TABLE_FORMAT_EXT 0x80D8 -#define GL_COLOR_TABLE_WIDTH_EXT 0x80D9 -#define GL_COLOR_TABLE_RED_SIZE_EXT 0x80DA -#define GL_COLOR_TABLE_GREEN_SIZE_EXT 0x80DB -#define GL_COLOR_TABLE_BLUE_SIZE_EXT 0x80DC -#define GL_COLOR_TABLE_ALPHA_SIZE_EXT 0x80DD -#define GL_COLOR_TABLE_LUMINANCE_SIZE_EXT 0x80DE -#define GL_COLOR_TABLE_INTENSITY_SIZE_EXT 0x80DF - -#define GL_COLOR_INDEX1_EXT 0x80E2 -#define GL_COLOR_INDEX2_EXT 0x80E3 -#define GL_COLOR_INDEX4_EXT 0x80E4 -#define GL_COLOR_INDEX8_EXT 0x80E5 -#define GL_COLOR_INDEX12_EXT 0x80E6 -#define GL_COLOR_INDEX16_EXT 0x80E7 - -/* WIN_draw_range_elements */ -#define GL_MAX_ELEMENTS_VERTICES_WIN 0x80E8 -#define GL_MAX_ELEMENTS_INDICES_WIN 0x80E9 - -/* WIN_phong_shading */ -#define GL_PHONG_WIN 0x80EA -#define GL_PHONG_HINT_WIN 0x80EB - -/* WIN_specular_fog */ -#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC - -/* For compatibility with OpenGL v1.0 */ -#define GL_LOGIC_OP GL_INDEX_LOGIC_OP -#define GL_TEXTURE_COMPONENTS GL_TEXTURE_INTERNAL_FORMAT #include <@GL_H@> -#include +#include <@QT_QTOPENGL_INCLUDE_DIR@/QtOpenGL> #endif // QT_NO_OPENGL From 23a1c436e393c6b414a1022b270dc3edeedec78c Mon Sep 17 00:00:00 2001 From: Paulo Alcantara Date: Mon, 9 May 2011 18:25:33 -0300 Subject: [PATCH 128/455] Add template to toTuple() functions Signed-off-by: Paulo Alcantara --- PySide/typesystem_templates.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml index a027e65..d0e521d 100644 --- a/PySide/typesystem_templates.xml +++ b/PySide/typesystem_templates.xml @@ -357,5 +357,9 @@ } + + From 6545eb21f52545f2319d853a827a1122dfbac6cf Mon Sep 17 00:00:00 2001 From: Paulo Alcantara Date: Tue, 10 May 2011 15:36:03 -0300 Subject: [PATCH 129/455] Fix bug #606 Add toTuple() function to these all classes: - QPoint/QPointF/QSize/QSizeF/QVector2D/QVector3D/QVector4D - QLine/QLineF/QColor Signed-off-by: Paulo Alcantara Reviewer: Lauro Moura Marcelo Lira --- PySide/QtCore/typesystem_core.xml | 58 ++++++++++++++++++++++ PySide/QtGui/typesystem_gui_common.xml | 66 ++++++++++++++++++++++++++ 2 files changed, 124 insertions(+) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index a1dd5b6..3856120 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -455,6 +455,15 @@ } }; + + + + + + + + + @@ -475,6 +484,15 @@ + + + + + + + + + @@ -669,6 +687,16 @@ } }; + + + + + + + + + + @@ -692,6 +720,16 @@ + + + + + + + + + + @@ -858,6 +896,16 @@ } }; + + + + + + + + + + @@ -881,6 +929,16 @@ + + + + + + + + + + diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 4822340..6cfe6eb 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -1158,6 +1158,43 @@ } + + + + switch(%CPPSELF.spec()) { + case QColor::Rgb: + { + int r, g, b, a; + %CPPSELF.getRgb(&r, &g, &b, &a); + %PYARG_0 = Py_BuildValue("iiii", r, g, b, a); + break; + } + case QColor::Hsv: + { + int h, s, v, a; + %CPPSELF.getHsv(&h, &s, &v, &a); + %PYARG_0 = Py_BuildValue("iiii", h, s, v, a); + break; + } + case QColor::Cmyk: + { + int c, m, y, k, a; + %CPPSELF.getCmyk(&c, &m, &y, &k, &a); + %PYARG_0 = Py_BuildValue("iiiii", c, m, y, k, a); + break; + } + case QColor::Hsl: + { + int h, s, l, a; + %CPPSELF.getHsv(&h, &s, &l, &a); + %PYARG_0 = Py_BuildValue("iiii", h, s, l, a); + break; + } + default: + %PYARG_0 = 0; + } + + @@ -6533,6 +6570,16 @@ + + + + + + + + + + @@ -6555,6 +6602,16 @@ + + + + + + + + + + @@ -6577,6 +6634,15 @@ + + + + + + + + + From ad023b3cb5b2bcb1598983bccba0a49c56b9d58e Mon Sep 17 00:00:00 2001 From: Paulo Alcantara Date: Tue, 10 May 2011 16:31:42 -0300 Subject: [PATCH 130/455] Create unit tests for bug #606 Signed-off-by: Paulo Alcantara Reviewer: Lauro Moura Marcelo Lira --- tests/QtCore/CMakeLists.txt | 1 + tests/QtCore/bug_606.py | 34 ++++++++++++++++++++++++++++++++++ tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/bug_606.py | 26 ++++++++++++++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 tests/QtCore/bug_606.py create mode 100644 tests/QtGui/bug_606.py diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index cea782c..6233263 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -5,6 +5,7 @@ PYSIDE_TEST(bug_428.py) PYSIDE_TEST(bug_462.py) PYSIDE_TEST(bug_505.py) PYSIDE_TEST(bug_515.py) +PYSIDE_TEST(bug_606.py) PYSIDE_TEST(bug_656.py) PYSIDE_TEST(bug_699.py) PYSIDE_TEST(bug_706.py) diff --git a/tests/QtCore/bug_606.py b/tests/QtCore/bug_606.py new file mode 100644 index 0000000..219b8d9 --- /dev/null +++ b/tests/QtCore/bug_606.py @@ -0,0 +1,34 @@ +import unittest + +import PySide +from PySide.QtCore import QPoint, QPointF +from PySide.QtCore import QLine, QLineF +from PySide.QtCore import QSize, QSizeF + +class testCases(unittest.TestCase): + def testQPointToTuple(self): + p = QPoint(1, 2) + self.assertEqual((1, 2), p.toTuple()) + + def testQPointFToTuple(self): + p = QPointF(1, 2) + self.assertEqual((1, 2), p.toTuple()) + + def testQLineToTuple(self): + l = QLine(1, 2, 3, 4) + self.assertEqual((1, 2, 3, 4), l.toTuple()) + + def testQLineFToTuple(self): + l = QLineF(1, 2, 3, 4) + self.assertEqual((1, 2, 3, 4), l.toTuple()) + + def testQSizeToTuple(self): + s = QSize(1, 2) + self.assertEqual((1, 2), s.toTuple()) + + def testQSizeFToTuple(self): + s = QSizeF(1, 2) + self.assertEqual((1, 2), s.toTuple()) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 97eb9c3..338f2e8 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -30,6 +30,7 @@ PYSIDE_TEST(bug_575.py) PYSIDE_TEST(bug_576.py) PYSIDE_TEST(bug_585.py) PYSIDE_TEST(bug_589.py) +PYSIDE_TEST(bug_606.py) PYSIDE_TEST(bug_617.py) PYSIDE_TEST(bug_635.py) PYSIDE_TEST(bug_640.py) diff --git a/tests/QtGui/bug_606.py b/tests/QtGui/bug_606.py new file mode 100644 index 0000000..0fe1bde --- /dev/null +++ b/tests/QtGui/bug_606.py @@ -0,0 +1,26 @@ +import unittest + +import PySide +from PySide.QtGui import QVector2D, QVector3D, QVector4D +from PySide.QtGui import QColor + +class testCases(unittest.TestCase): + def testQVector2DToTuple(self): + vec = QVector2D(1, 2) + self.assertEqual((1, 2), vec.toTuple()) + + def testQVector3DToTuple(self): + vec = QVector3D(1, 2, 3) + self.assertEqual((1, 2, 3), vec.toTuple()) + + def testQVector4DToTuple(self): + vec = QVector4D(1, 2, 3, 4) + self.assertEqual((1, 2, 3, 4), vec.toTuple()) + + def testQColorToTuple(self): + c = QColor(0, 0, 255) + c.setRgb(1, 2, 3) + self.assertEqual((1, 2, 3, 255), c.toTuple()) + +if __name__ == '__main__': + unittest.main() From c057f74ce3c72d8a4d4a4f2a5357a5d3b7625fb2 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Wed, 13 Apr 2011 16:08:27 -0300 Subject: [PATCH 131/455] QPersistentModelIndex has its "operator const QModelIndex&() const" method back. --- PySide/QtCore/typesystem_core.xml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 3856120..565c2c1 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -976,8 +976,11 @@ Py_XINCREF(%PYARG_0); - - + + + + + From b926ac5defe8f198d397344337ebadd09e278dde Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Tue, 5 Apr 2011 17:52:26 -0300 Subject: [PATCH 132/455] Added tests for bug #716 - QPersistentModelIndex isn't convertible to QModelIndex The main test (exactly the same as reported) was added to QtGui tests, but also extended QAbstractItemModel test with a case that is the essence of the problem. http://bugs.pyside.org/show_bug.cgi?id=716 Reviewed by Hugo Parente Reviewed by Luciano Wolf --- tests/QtCore/qabstractitemmodel_test.py | 7 +++++++ tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/bug_716.py | 9 +++++++++ 3 files changed, 17 insertions(+) create mode 100644 tests/QtGui/bug_716.py diff --git a/tests/QtCore/qabstractitemmodel_test.py b/tests/QtCore/qabstractitemmodel_test.py index 93306ca..52e6f8d 100644 --- a/tests/QtCore/qabstractitemmodel_test.py +++ b/tests/QtCore/qabstractitemmodel_test.py @@ -16,6 +16,13 @@ class TestQModelIndexInternalPointer(unittest.TestCase): foo = Foo() idx = m.createIndex(0,0, foo) + def testPassQPersistentModelIndexAsQModelIndex(self): + # Related to bug #716 + m = MyModel() + idx = QPersistentModelIndex() + m.span(idx) + + if __name__ == '__main__': unittest.main() diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 338f2e8..3c58dcb 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -46,6 +46,7 @@ PYSIDE_TEST(bug_688.py) PYSIDE_TEST(bug_696.py) PYSIDE_TEST(bug_693.py) PYSIDE_TEST(bug_714.py) +PYSIDE_TEST(bug_716.py) PYSIDE_TEST(bug_722.py) PYSIDE_TEST(bug_728.py) PYSIDE_TEST(bug_736.py) diff --git a/tests/QtGui/bug_716.py b/tests/QtGui/bug_716.py new file mode 100644 index 0000000..fe5315e --- /dev/null +++ b/tests/QtGui/bug_716.py @@ -0,0 +1,9 @@ +from PySide.QtCore import Qt, QPersistentModelIndex +from PySide.QtGui import QStringListModel + +if __name__ == '__main__': + stringListModel = QStringListModel(['one', 'two']) + idx = stringListModel.index(1, 0) + persistentModelIndex = QPersistentModelIndex(idx) + stringListModel.data(persistentModelIndex, Qt.DisplayRole) + From 48f8b3865de03dd96bcae7b24c4c5ca16dca5831 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Mon, 16 May 2011 15:04:25 -0300 Subject: [PATCH 133/455] Fix bug 857 - "64bit Windows build broken" Reviewer: Marcelo Lira Lauro Moura --- PySide/QtNetwork/typesystem_network.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PySide/QtNetwork/typesystem_network.xml b/PySide/QtNetwork/typesystem_network.xml index 969eb86..ab3f1ef 100644 --- a/PySide/QtNetwork/typesystem_network.xml +++ b/PySide/QtNetwork/typesystem_network.xml @@ -253,7 +253,7 @@ } if (_i < 0) - _i = 16 - abs(_i); + _i = 16 - qAbs(_i); return %CONVERTTOPYTHON[uint](%CPPSELF->c[_i]); @@ -271,7 +271,7 @@ } if (_i < 0) - _i = 16 - abs(_i); + _i = 16 - qAbs(_i); %CPPSELF->c[_i] = %CONVERTTOCPP[quint8](_value); From ddae00b6c429604c3f2459f022e30ca883b9275f Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Fri, 13 May 2011 14:02:21 -0300 Subject: [PATCH 134/455] Fixed kee-reference rule. Reviewer: Luciano Wolf Hugo Parente --- PySide/QtCore/typesystem_core.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 565c2c1..75e13b1 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -2842,7 +2842,7 @@ - + From 0f1b57dc941544e1b5cee7b90d175aa46bb2fdde Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Fri, 13 May 2011 18:44:44 -0300 Subject: [PATCH 135/455] Created unit test for bug #854. Reviewer: Luciano Wolf Hugo Parente --- tests/QtGui/CMakeLists.txt | 1 + tests/QtGui/bug_854.py | 40 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 tests/QtGui/bug_854.py diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 3c58dcb..44e4c52 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -60,6 +60,7 @@ PYSIDE_TEST(bug_811.py) PYSIDE_TEST(bug_834.py) PYSIDE_TEST(bug_836.py) PYSIDE_TEST(bug_844.py) +PYSIDE_TEST(bug_854.py) PYSIDE_TEST(customproxywidget_test.py) PYSIDE_TEST(deepcopy_test.py) PYSIDE_TEST(float_to_int_implicit_conversion_test.py) diff --git a/tests/QtGui/bug_854.py b/tests/QtGui/bug_854.py new file mode 100644 index 0000000..35a092a --- /dev/null +++ b/tests/QtGui/bug_854.py @@ -0,0 +1,40 @@ +from PySide.QtGui import QTableView, QVBoxLayout, QApplication +from PySide.QtCore import QAbstractItemModel + +from helper import UsesQApplication +import unittest + + +class VirtualList(QAbstractItemModel): + def __getitem__(self, index): + self._getItemCalled = True + pass + + def rowCount(self, parent): + return 5000 + + def columnCount(self, parent): + return 3 + + def index(self, row, column, parent): + return self.createIndex(row, column) + + def parent(self, index): + return QModelIndex() + + def data(self, index, role): + return "(%i, %i)" % (index.row(), index.column()) + + +class TestQAbstractItemModel(UsesQApplication): + def testSetModel(self): + model = VirtualList() + model._getItemCalled = False + table = QTableView() + table.setModel(model) + table.show() + self.assertFalse(model._getItemCalled) + +if __name__ == "__main__": + unittest.main() + From 85a5641368287e366b27aff2027f8cbf2163fcd0 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Tue, 17 May 2011 15:46:03 -0300 Subject: [PATCH 136/455] Unit test for bug 634, based on code from Marcus Lindblom. Reviewed by Hugo Parente Reviewed by Luciano Wolf --- tests/QtCore/CMakeLists.txt | 1 + tests/QtCore/mockclass_test.py | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/QtCore/mockclass_test.py diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index 6233263..84d0ad0 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -23,6 +23,7 @@ PYSIDE_TEST(duck_punching_test.py) PYSIDE_TEST(hash_test.py) PYSIDE_TEST(max_signals.py) PYSIDE_TEST(missing_symbols_test.py) +PYSIDE_TEST(mockclass_test.py) PYSIDE_TEST(python_conversion.py) PYSIDE_TEST(qabs_test.py) PYSIDE_TEST(qabstractitemmodel_test.py) diff --git a/tests/QtCore/mockclass_test.py b/tests/QtCore/mockclass_test.py new file mode 100644 index 0000000..4210efd --- /dev/null +++ b/tests/QtCore/mockclass_test.py @@ -0,0 +1,27 @@ +# Test case for PySide bug 634 +# http://bugs.pyside.org/show_bug.cgi?id=634 +# Marcus Lindblom ; 2011-02-16 + +import unittest +from PySide.QtCore import QCoreApplication + +class Mock(object): + def __init__(self): + self.called = False + self.return_value = None + + def __call__(self, *args, **kwargs): + self.called = True + return self.return_value + + +class MockClassTest(unittest.TestCase): + def testMockQCoreApplication(self): + mock = Mock() + setattr(QCoreApplication, 'instance', mock) + QCoreApplication.instance() + self.assert_(mock.called) + +if __name__ == '__main__': + unittest.main() + From c27dceaaab0d35aa0227157d6901ab96faf78e93 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Tue, 17 May 2011 16:33:43 -0300 Subject: [PATCH 137/455] White spaces removal... --- PySide/QtCore/typesystem_core.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 75e13b1..029fa1f 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -460,7 +460,7 @@ - + @@ -489,7 +489,7 @@ - + From 952f9f0bda958afa36421c6af828f55f643a3deb Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Tue, 17 May 2011 16:34:08 -0300 Subject: [PATCH 138/455] Fix bug 686 - "Request to make Q[Mutex|Read|Write]Locker context managers" Reviewer: Marcelo Lira Luciano Wolf --- PySide/QtCore/typesystem_core.xml | 36 ++++++++++++- tests/QtCore/CMakeLists.txt | 1 + tests/QtCore/bug_686.py | 85 +++++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 tests/QtCore/bug_686.py diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 029fa1f..5a53261 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1154,10 +1154,32 @@ + + + + + + + + + %CPPSELF.unlock(); + + + + + + + + + + + %CPPSELF.unlock(); + + @@ -2023,13 +2045,23 @@ - + + + + + - + + + + + %CPPSELF.unlock(); + + diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index 84d0ad0..e49e390 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -7,6 +7,7 @@ PYSIDE_TEST(bug_505.py) PYSIDE_TEST(bug_515.py) PYSIDE_TEST(bug_606.py) PYSIDE_TEST(bug_656.py) +PYSIDE_TEST(bug_686.py) PYSIDE_TEST(bug_699.py) PYSIDE_TEST(bug_706.py) PYSIDE_TEST(bug_723.py) diff --git a/tests/QtCore/bug_686.py b/tests/QtCore/bug_686.py new file mode 100644 index 0000000..97ead98 --- /dev/null +++ b/tests/QtCore/bug_686.py @@ -0,0 +1,85 @@ +import unittest +from PySide.QtCore import * + +class MyWriteThread(QThread): + def __init__(self, lock): + QThread.__init__(self) + self.lock = lock + self.started = False + self.canQuit = False + + def run(self): + self.started = True + while not self.lock.tryLockForWrite(): + pass + self.canQuit = True + +class MyReadThread(QThread): + def __init__(self, lock): + QThread.__init__(self) + self.lock = lock + self.started = False + self.canQuit = False + + def run(self): + self.started = True + while not self.lock.tryLockForRead(): + pass + self.canQuit = True + +class MyMutexedThread(QThread): + def __init__(self, mutex): + QThread.__init__(self) + self.mutex = mutex + self.started = False + self.canQuit = False + + def run(self): + self.started = True + while not self.mutex.tryLock(): + pass + self.canQuit = True + +class TestQMutex (unittest.TestCase): + + def testReadLocker(self): + lock = QReadWriteLock() + thread = MyWriteThread(lock) + + with QReadLocker(lock): + thread.start() + while not thread.started: + pass + self.assertFalse(thread.canQuit) + + thread.wait() + self.assertTrue(thread.canQuit) + + def testWriteLocker(self): + lock = QReadWriteLock() + thread = MyReadThread(lock) + + with QWriteLocker(lock): + thread.start() + while not thread.started: + pass + self.assertFalse(thread.canQuit) + + thread.wait() + self.assertTrue(thread.canQuit) + + def testMutexLocker(self): + mutex = QMutex() + thread = MyMutexedThread(mutex) + + with QMutexLocker(mutex): + thread.start() + while not thread.started: + pass + self.assertFalse(thread.canQuit) + + thread.wait() + self.assertTrue(thread.canQuit) + +if __name__ == '__main__': + unittest.main() From 8e221bfb9731589a4a4d4712745252e50b0a97c6 Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Tue, 17 May 2011 17:36:04 -0300 Subject: [PATCH 139/455] Implemented convertion from Python types for QDate, QTime, QDateTime. Fixes bug #680 Reviewer: pcacjr Hugo Parente --- PySide/QtCore/qdate_conversions.h | 74 +++++++++++++---------- PySide/QtCore/qdatetime_conversions.h | 84 +++++++++++++++------------ PySide/QtCore/qtime_conversions.h | 75 +++++++++++++----------- PySide/QtCore/typesystem_core.xml | 34 +++++++++-- tests/QtCore/CMakeLists.txt | 1 + tests/QtCore/qdatetime_test.py | 18 ++++++ 6 files changed, 177 insertions(+), 109 deletions(-) create mode 100644 tests/QtCore/qdatetime_test.py diff --git a/PySide/QtCore/qdate_conversions.h b/PySide/QtCore/qdate_conversions.h index e0f1dd9..7c45eec 100644 --- a/PySide/QtCore/qdate_conversions.h +++ b/PySide/QtCore/qdate_conversions.h @@ -1,35 +1,45 @@ namespace Shiboken { -template <> -struct PythonConverter + +inline bool Converter::checkType(PyObject* pyObj) { - static bool isPythonConvertible(PyObject* pyObj) - { - if (!PyDateTimeAPI) - PyDateTime_IMPORT; - - return pyObj && PyDate_Check(pyObj); - } - - static QDate* transformFromPython(PyObject* obj) - { - if (isPythonConvertible(obj)) { - int day = PyDateTime_GET_DAY(obj); - int month = PyDateTime_GET_MONTH(obj); - int year = PyDateTime_GET_YEAR(obj); - return new QDate(year, month, day); - } - return 0; - } - - static PyObject* transformToPython(QDate* d) - { - if (d) { - if (!PyDateTimeAPI) - PyDateTime_IMPORT; - - return PyDate_FromDate(d->year(), d->month(), d->day()); - } - return 0; - } -}; + return ValueTypeConverter::checkType(pyObj); +} + +inline PyObject* Converter::toPython(const ::QDate& cppObj) +{ + return ValueTypeConverter::toPython(cppObj); +} + +inline bool Converter::isConvertible(PyObject* pyObj) +{ + if (ValueTypeConverter::isConvertible(pyObj)) + return true; + + if (!PyDateTimeAPI) + PyDateTime_IMPORT; + + SbkObjectType* shiboType = reinterpret_cast(SbkType< ::QDate >()); + return PyDate_Check(pyObj) || ObjectType::isExternalConvertible(shiboType, pyObj); +} + +inline QDate Converter::toCpp(PyObject* pyObj) +{ + if (!PyDateTimeAPI) + PyDateTime_IMPORT; + + if (pyObj == Py_None) { + return QDate(); + } else if (PyObject_TypeCheck(pyObj, SbkType())) { + return *Converter::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::toCpp(pyObj); + } +} + + } diff --git a/PySide/QtCore/qdatetime_conversions.h b/PySide/QtCore/qdatetime_conversions.h index a3cdf09..8ee4f48 100644 --- a/PySide/QtCore/qdatetime_conversions.h +++ b/PySide/QtCore/qdatetime_conversions.h @@ -1,41 +1,49 @@ namespace Shiboken { -template <> -struct PythonConverter + +inline bool Converter::checkType(PyObject* pyObj) { - static bool isPythonConvertible(PyObject* pyObj) - { - if (!PyDateTimeAPI) - PyDateTime_IMPORT; - - return pyObj && PyDateTime_Check(pyObj); - } - - static QDateTime* transformFromPython(PyObject* obj) - { - if (isPythonConvertible(obj)) { - int day = PyDateTime_GET_DAY(obj); - int month = PyDateTime_GET_MONTH(obj); - int year = PyDateTime_GET_YEAR(obj); - int hour = PyDateTime_DATE_GET_HOUR(obj); - int min = PyDateTime_DATE_GET_MINUTE(obj); - int sec = PyDateTime_DATE_GET_SECOND(obj); - int msec = PyDateTime_DATE_GET_MICROSECOND(obj); - return new QDateTime(QDate(year, month, day), QTime(hour, min, sec, msec)); - } - return 0; - } - - static PyObject* transformToPython(QDateTime* d) - { - if (d) { - if (!PyDateTimeAPI) - PyDateTime_IMPORT; - - QDate date = d->date(); - QTime time = d->time(); - return PyDateTime_FromDateAndTime(date.year(), date.month(), date.day(), time.hour(), time.minute(), time.second(), time.msec()); - } - return 0; - } -}; + return ValueTypeConverter::checkType(pyObj); +} + +inline PyObject* Converter::toPython(const ::QDateTime& cppObj) +{ + return ValueTypeConverter::toPython(cppObj); +} + +inline bool Converter::isConvertible(PyObject* pyObj) +{ + if (ValueTypeConverter::isConvertible(pyObj)) + return true; + + if (!PyDateTimeAPI) + PyDateTime_IMPORT; + + SbkObjectType* shiboType = reinterpret_cast(SbkType< ::QDateTime >()); + return PyDateTime_Check(pyObj) || ObjectType::isExternalConvertible(shiboType, pyObj); +} + + +inline QDateTime Converter::toCpp(PyObject* pyObj) +{ + if (!PyDateTimeAPI) + PyDateTime_IMPORT; + + if (pyObj == Py_None) { + return QDateTime(); + } else if (PyObject_TypeCheck(pyObj, SbkType())) { + return *Converter::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 msec = PyDateTime_DATE_GET_MICROSECOND(pyObj); + return QDateTime(QDate(year, month, day), QTime(hour, min, sec, msec)); + } else { + return ValueTypeConverter::toCpp(pyObj); + } +} + } diff --git a/PySide/QtCore/qtime_conversions.h b/PySide/QtCore/qtime_conversions.h index 5e172fa..080df5f 100644 --- a/PySide/QtCore/qtime_conversions.h +++ b/PySide/QtCore/qtime_conversions.h @@ -1,36 +1,45 @@ namespace Shiboken { -template <> -struct PythonConverter + +inline bool Converter::checkType(PyObject* pyObj) { - static bool isPythonConvertible(PyObject* pyObj) - { - if (!PyDateTimeAPI) - PyDateTime_IMPORT; - - return pyObj && PyTime_Check(pyObj); - } - - static QTime* transformFromPython(PyObject* obj) - { - if (isPythonConvertible(obj)) { - int hour = PyDateTime_TIME_GET_HOUR(obj); - int min = PyDateTime_TIME_GET_MINUTE(obj); - int sec = PyDateTime_TIME_GET_SECOND(obj); - int msec = PyDateTime_TIME_GET_MICROSECOND(obj); - return new QTime(hour, min, sec, msec); - } - return 0; - } - - static PyObject* transformToPython(QTime* d) - { - if (d) { - if (!PyDateTimeAPI) - PyDateTime_IMPORT; - - return PyTime_FromTime(d->hour(), d->minute(), d->second(), d->msec()); - } - return 0; - } -}; + return ValueTypeConverter::checkType(pyObj); +} + +inline PyObject* Converter::toPython(const ::QTime& cppObj) +{ + return ValueTypeConverter::toPython(cppObj); +} + +inline bool Converter::isConvertible(PyObject* pyObj) +{ + if (ValueTypeConverter::isConvertible(pyObj)) + return true; + + if (!PyDateTimeAPI) + PyDateTime_IMPORT; + + SbkObjectType* shiboType = reinterpret_cast(SbkType< ::QTime >()); + return PyTime_Check(pyObj) || ObjectType::isExternalConvertible(shiboType, pyObj); +} + +inline QTime Converter::toCpp(PyObject* pyObj) +{ + if (!PyDateTimeAPI) + PyDateTime_IMPORT; + + if (pyObj == Py_None) { + return QTime(); + } else if (PyObject_TypeCheck(pyObj, SbkType())) { + return *Converter::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 msec = PyDateTime_TIME_GET_MICROSECOND(pyObj); + return QTime(hour, min, sec, msec); + } else { + return ValueTypeConverter::toCpp(pyObj); + } +} + } diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 5a53261..37c246b 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -140,6 +140,7 @@ + @@ -559,7 +560,7 @@ - + @@ -581,6 +582,12 @@ + + + if (!PyDateTimeAPI) PyDateTime_IMPORT; + %PYARG_0 = PyDate_FromDate(%CPPSELF.year(), %CPPSELF.month(), %CPPSELF.day()); + + @@ -617,7 +624,7 @@ - + @@ -648,6 +655,14 @@ + + + QDate date = %CPPSELF.date(); + QTime time = %CPPSELF.time(); + if (!PyDateTimeAPI) PyDateTime_IMPORT; + %PYARG_0 = PyDateTime_FromDateAndTime(date.year(), date.month(), date.day(), time.hour(), time.minute(), time.second(), time.msec()); + + @@ -946,6 +961,11 @@ + + + + + @@ -962,10 +982,12 @@ - - - - + + + if (!PyDateTimeAPI) PyDateTime_IMPORT; + %PYARG_0 = PyTime_FromTime(%CPPSELF.hour(), %CPPSELF.minute(), %CPPSELF.second(), %CPPSELF.msec()); + + diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index e49e390..c0829f4 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -38,6 +38,7 @@ PYSIDE_TEST(qbytearray_operator_test.py) PYSIDE_TEST(qbytearray_test.py) PYSIDE_TEST(qcoreapplication_instance_test.py) PYSIDE_TEST(qdatastream_test.py) +PYSIDE_TEST(qdatetime_test.py) PYSIDE_TEST(qdate_test.py) PYSIDE_TEST(qenum_test.py) PYSIDE_TEST(qevent_test.py) diff --git a/tests/QtCore/qdatetime_test.py b/tests/QtCore/qdatetime_test.py new file mode 100644 index 0000000..b732477 --- /dev/null +++ b/tests/QtCore/qdatetime_test.py @@ -0,0 +1,18 @@ +import unittest +import datetime + +from PySide.QtCore import QDateTime, QDate, QTime + +class TestQDate (unittest.TestCase): + def testDateConversion(self): + dateTime = QDateTime(QDate(2011, 05, 17), QTime(11, 01, 14, 15)) + dateTimePy = QDateTime(datetime.date(2011, 05, 17), datetime.time(11, 01, 14, 15)) + self.assertEqual(dateTime, dateTimePy) + + def testDateTimeConversion(self): + dateTime = QDateTime(QDate(2011, 05, 17), QTime(11, 01, 14, 15)) + dateTimePy = QDateTime(datetime.datetime(2011, 05, 17, 11, 01, 14, 15)) + self.assertEqual(dateTime, dateTimePy) + +if __name__ == '__main__': + unittest.main() From b3f5de99994ae93dd548da3d5fbc74c8a9cd3a9a Mon Sep 17 00:00:00 2001 From: Paulo Alcantara Date: Mon, 9 May 2011 14:37:38 -0300 Subject: [PATCH 140/455] Fix typo Signed-off-by: Paulo Alcantara --- PySide/typesystem_templates.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml index d0e521d..8a26281 100644 --- a/PySide/typesystem_templates.xml +++ b/PySide/typesystem_templates.xml @@ -293,7 +293,7 @@ - From 2a634aea05487732fe06c2935dc2893f75af79ed Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Mon, 12 Dec 2011 17:46:37 -0300 Subject: [PATCH 441/455] Updated the custom widget plugin to use the new converters. --- plugins/CMakeLists.txt | 2 +- plugins/customwidget.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index b17dbc2..a65a421 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -5,7 +5,7 @@ set(ui_plugin_src customwidget.cpp ) -set (ui_plugin_moc +set(ui_plugin_moc customwidget.h customwidgets.h ) diff --git a/plugins/customwidget.cpp b/plugins/customwidget.cpp index fb849f2..d573ef4 100644 --- a/plugins/customwidget.cpp +++ b/plugins/customwidget.cpp @@ -95,11 +95,12 @@ QWidget* PyCustomWidget::createWidget(QWidget* parent) bool unkowParent = false; if (parent) { pyParent = reinterpret_cast(Shiboken::BindingManager::instance().retrieveWrapper(parent)); - if (!pyParent) { - pyParent = Shiboken::Converter::toPython(parent); - unkowParent = true; - } else { + if (pyParent) { Py_INCREF(pyParent); + } else { + static Shiboken::Conversions::SpecificConverter converter("QWidget*"); + pyParent = converter.toPython(&parent); + unkowParent = true; } } else { Py_INCREF(Py_None); @@ -129,4 +130,3 @@ void PyCustomWidget::initialize(QDesignerFormEditorInterface* core) { m_data->initialized = true; } - From e76b2b76f51ab643d6e97842ac3d3adc50b6a851 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Mon, 12 Dec 2011 20:02:38 -0300 Subject: [PATCH 442/455] Added type system entries to the primitive types used by QtOpenGL. --- PySide/QtOpenGL/typesystem_opengl.xml | 39 ++++++++++++++++++--------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/PySide/QtOpenGL/typesystem_opengl.xml b/PySide/QtOpenGL/typesystem_opengl.xml index 4c2604a..60a2d18 100644 --- a/PySide/QtOpenGL/typesystem_opengl.xml +++ b/PySide/QtOpenGL/typesystem_opengl.xml @@ -21,6 +21,21 @@ + + + + + + + + + + + + + + + @@ -191,7 +206,7 @@ - + @@ -207,7 +222,7 @@ - + @@ -415,7 +430,7 @@ - + @@ -431,7 +446,7 @@ - + @@ -640,19 +655,19 @@ - - - - + + + + - - - - + + + + From c78b4686a1f98273cf4e730efae32fa7f93ebebd Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Mon, 12 Dec 2011 19:10:07 -0200 Subject: [PATCH 443/455] Add GC support to PySide Property type. This fixes GC errors when running PySide on a Python debug env. Reviewer: Marcelo Lira --- libpyside/pysideproperty.cpp | 68 ++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 22 deletions(-) diff --git a/libpyside/pysideproperty.cpp b/libpyside/pysideproperty.cpp index e5ae5d5..1e1cf29 100644 --- a/libpyside/pysideproperty.cpp +++ b/libpyside/pysideproperty.cpp @@ -38,12 +38,14 @@ extern "C" static PyObject* qpropertyTpNew(PyTypeObject* subtype, PyObject* args, PyObject* kwds); static int qpropertyTpInit(PyObject*, PyObject*, PyObject*); -static void qpropertyFree(void*); +static void qpropertyDeAlloc(PyObject* self); //methods static PyObject* qPropertyCall(PyObject*, PyObject*, PyObject*); static PyObject* qPropertySetter(PyObject*, PyObject*); static PyObject* qPropertyGetter(PyObject*, PyObject*); +static int qpropertyTraverse(PyObject* self, visitproc visit, void* arg); +static int qpropertyClear(PyObject* self); static PyMethodDef PySidePropertyMethods[] = { {"setter", (PyCFunction)qPropertySetter, METH_O}, @@ -58,7 +60,7 @@ PyTypeObject PySidePropertyType = { QPROPERTY_CLASS_NAME, /*tp_name*/ sizeof(PySideProperty), /*tp_basicsize*/ 0, /*tp_itemsize*/ - 0, /*tp_dealloc*/ + qpropertyDeAlloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -73,10 +75,10 @@ PyTypeObject PySidePropertyType = { 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc */ - 0, /*tp_traverse */ - 0, /*tp_clear */ + qpropertyTraverse, /*tp_traverse */ + qpropertyClear, /*tp_clear */ 0, /*tp_richcompare */ 0, /*tp_weaklistoffset */ 0, /*tp_iter */ @@ -92,7 +94,7 @@ PyTypeObject PySidePropertyType = { qpropertyTpInit, /*tp_init */ 0, /*tp_alloc */ qpropertyTpNew, /*tp_new */ - qpropertyFree, /*tp_free */ + 0, /*tp_free */ 0, /*tp_is_gc */ 0, /*tp_bases */ 0, /*tp_mro */ @@ -208,23 +210,10 @@ int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds) } } -void qpropertyFree(void *self) +void qpropertyDeAlloc(PyObject* self) { - PyObject *pySelf = reinterpret_cast(self); - PySideProperty *data = reinterpret_cast(self); - PySidePropertyPrivate* pData = data->d; - - Py_XDECREF(pData->fget); - Py_XDECREF(pData->fset); - Py_XDECREF(pData->freset); - Py_XDECREF(pData->fdel); - Py_XDECREF(pData->notify); - - free(pData->typeName); - free(pData->doc); - free(pData->notifySignature); - delete data->d; - pySelf->ob_type->tp_base->tp_free(self); + qpropertyClear(self); + Py_TYPE(self)->tp_free(self); } PyObject* qPropertyCall(PyObject* self, PyObject* args, PyObject* kw) @@ -279,6 +268,41 @@ PyObject* qPropertyGetter(PyObject* self, PyObject* callback) } } +static int qpropertyTraverse(PyObject* self, visitproc visit, void* arg) +{ + PySidePropertyPrivate* data = reinterpret_cast(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(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(self)->d = 0; + return 0; +} + } // extern "C" namespace { From 7b8d2925dd61e2cb1edc78bd10cdda2e8ef19bf2 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Tue, 13 Dec 2011 16:58:30 -0200 Subject: [PATCH 444/455] Small code style changes. --- libpyside/pysideqflags.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libpyside/pysideqflags.cpp b/libpyside/pysideqflags.cpp index 4fe24b8..39f8b04 100644 --- a/libpyside/pysideqflags.cpp +++ b/libpyside/pysideqflags.cpp @@ -39,7 +39,7 @@ extern "C" { #define PYSIDE_QFLAGS(X) reinterpret_cast(X) - PyObject* PySideQFlagsNew(PyTypeObject *type, PyObject *args, PyObject *kwds) + PyObject* PySideQFlagsNew(PyTypeObject* type, PyObject* args, PyObject* kwds) { long val = 0; if (PyTuple_GET_SIZE(args)) { @@ -61,13 +61,11 @@ extern "C" { static long getNumberValue(PyObject* v) { - PyObject* number = PyNumber_Long(v); - long result = PyLong_AsLong(number); - Py_XDECREF(number); - return result; + Shiboken::AutoDecRef number(PyNumber_Long(v)); + return PyLong_AsLong(number); } - PyObject* PySideQFlagsRichCompare(PyObject *self, PyObject *other, int op) + PyObject* PySideQFlagsRichCompare(PyObject* self, PyObject* other, int op) { int result = 0; if (!PyNumber_Check(other)) { From 65d8f9fcef98f8a80015cc5e0b7526224332e7ec Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Wed, 14 Dec 2011 14:14:18 -0300 Subject: [PATCH 445/455] Fixes the QSettings related QVariant's save/load bug. --- libpyside/signalmanager.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libpyside/signalmanager.cpp b/libpyside/signalmanager.cpp index 4bcfae5..81ce14d 100644 --- a/libpyside/signalmanager.cpp +++ b/libpyside/signalmanager.cpp @@ -250,6 +250,8 @@ SignalManager::SignalManager() : m_d(new SignalManagerPrivate) // Register PyObject type to use in queued signal and slot connections qRegisterMetaType(PYTHON_TYPE); qRegisterMetaTypeStreamOperators(PYTHON_TYPE); + qRegisterMetaTypeStreamOperators("PyObjectWrapper"); + qRegisterMetaTypeStreamOperators("PySide::PyObjectWrapper"); SbkConverter* converter = Shiboken::Conversions::createConverter(&PyBaseObject_Type, 0); Shiboken::Conversions::setCppPointerToPythonFunction(converter, PyObject_PTR_CppToPython_PyObject); From 8ddbd3167bba33820b19de36c2dbac83e9e8f55d Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Thu, 15 Dec 2011 14:47:39 -0300 Subject: [PATCH 446/455] The temporary file used in the test for bug #829 must not be deleted by the test. This fixes the test in win32 platforms. --- tests/QtCore/bug_829.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/QtCore/bug_829.py b/tests/QtCore/bug_829.py index da527ad..945d8df 100644 --- a/tests/QtCore/bug_829.py +++ b/tests/QtCore/bug_829.py @@ -3,12 +3,11 @@ import unittest from PySide.QtCore import QSettings -from helper import adjust_filename import tempfile class QVariantConversions(unittest.TestCase): def testDictionary(self): - confFile = tempfile.NamedTemporaryFile() + confFile = tempfile.NamedTemporaryFile(delete=False) s = QSettings(confFile.name, QSettings.IniFormat) # Save value s.setValue('x', {1: 'a'}) From 481ba5aa3ef94b417211fd25f07f30575b5afa68 Mon Sep 17 00:00:00 2001 From: Paulo Alcantara Date: Fri, 16 Dec 2011 18:10:45 -0300 Subject: [PATCH 447/455] 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 Reviewed-by: Trust me --- PySide/QtCore/typesystem_core_common.xml | 21 ++++++++------------- tests/QtNetwork/CMakeLists.txt | 1 + tests/QtNetwork/bug_1084.py | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 13 deletions(-) create mode 100644 tests/QtNetwork/bug_1084.py diff --git a/PySide/QtCore/typesystem_core_common.xml b/PySide/QtCore/typesystem_core_common.xml index aa39e95..a2e1deb 100644 --- a/PySide/QtCore/typesystem_core_common.xml +++ b/PySide/QtCore/typesystem_core_common.xml @@ -2666,20 +2666,15 @@ - + - + - + - - - - %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(%1, Shiboken::String::len(%PYARG_1)); - %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0); - - - + + + @@ -2688,7 +2683,7 @@ - + QByteArray ba; ba.resize(%2); @@ -2712,7 +2707,7 @@ - + QByteArray ba; ba.resize(%2); diff --git a/tests/QtNetwork/CMakeLists.txt b/tests/QtNetwork/CMakeLists.txt index 3077155..7476f91 100644 --- a/tests/QtNetwork/CMakeLists.txt +++ b/tests/QtNetwork/CMakeLists.txt @@ -1,4 +1,5 @@ PYSIDE_TEST(bug_446.py) +PYSIDE_TEST(bug_1084.py) PYSIDE_TEST(basic_auth_test.py) PYSIDE_TEST(accessManager_test.py) PYSIDE_TEST(http_test.py) diff --git a/tests/QtNetwork/bug_1084.py b/tests/QtNetwork/bug_1084.py new file mode 100644 index 0000000..9d8471c --- /dev/null +++ b/tests/QtNetwork/bug_1084.py @@ -0,0 +1,16 @@ +''' unit test for BUG #1084 ''' + +import unittest +from PySide import QtNetwork +import py3kcompat as py3k + +class QTcpSocketTestCase(unittest.TestCase): + def setUp(self): + self.sock = QtNetwork.QTcpSocket() + self.sock.connectToHost('127.0.0.1', 25) + + def testIt(self): + self.sock.write(py3k.unicode_('quit')) + +if __name__ == "__main__": + unittest.main() From b2b14fe9b70cb233b003425328ef1f4d8749c744 Mon Sep 17 00:00:00 2001 From: Paulo Alcantara Date: Wed, 21 Dec 2011 14:57:32 -0300 Subject: [PATCH 448/455] 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 Reviewed-by: Marcelo Lira --- PySide/QtGui/CMakeLists.txt | 10 +- PySide/QtGui/typesystem_gui_common.xml | 149 +++++++++++++------------ tests/QtGui/CMakeLists.txt | 3 + tests/QtGui/bug_1091.py | 12 ++ 4 files changed, 100 insertions(+), 74 deletions(-) create mode 100644 tests/QtGui/bug_1091.py diff --git a/PySide/QtGui/CMakeLists.txt b/PySide/QtGui/CMakeLists.txt index 6023a32..7625634 100644 --- a/PySide/QtGui/CMakeLists.txt +++ b/PySide/QtGui/CMakeLists.txt @@ -15,7 +15,6 @@ if(ENABLE_X11) endif() endif() - if (${QT_VERSION_MAJOR} EQUAL 4 AND ${QT_VERSION_MINOR} LESS 6) set(QtGui_46_SRC "") else() @@ -60,6 +59,14 @@ else() ) endif () +if (${QT_VERSION_MAJOR} EQUAL 4 AND ${QT_VERSION_MINOR} LESS 7) + set(QtGui_47_SRC "") +else() + set(QtGui_47_SRC + ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qpainter_pixmapfragment_wrapper.cpp + ) +endif() + set(QtGui_OPTIONAL_SRC ) set(QtGui_DROPPED_ENTRIES ) check_qt_class(QtGui QAbstractPageSetupDialog QtGui_OPTIONAL_SRC QtGui_DROPPED_ENTRIES) @@ -398,6 +405,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qworkspace_wrapper.cpp ${SPECIFIC_OS_FILES} ${QPYTEXTOBJECT_MOC} ${QtGui_46_SRC} +${QtGui_47_SRC} ${QtGui_OPTIONAL_SRC} ) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index e9058b5..552636a 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -3470,7 +3470,7 @@ - + @@ -3479,7 +3479,7 @@ - + @@ -3488,7 +3488,7 @@ - + @@ -3497,7 +3497,7 @@ - + @@ -3506,7 +3506,7 @@ - + @@ -3604,24 +3604,24 @@ - + - + - + - + @@ -3632,38 +3632,38 @@ - + - + - + - + - + - + - + @@ -3759,7 +3759,7 @@ - + @@ -3821,17 +3821,17 @@ - + - + - + @@ -3868,17 +3868,17 @@ - + - + - + @@ -3893,17 +3893,17 @@ - + - + - + @@ -3913,12 +3913,12 @@ - + - + @@ -3994,12 +3994,12 @@ - + - + @@ -4247,7 +4247,7 @@ - + @@ -4529,7 +4529,7 @@ - + @@ -4540,7 +4540,7 @@ - + @@ -4555,7 +4555,7 @@ - + @@ -4731,29 +4731,29 @@ - + - + - + - + - + // Clear parent from the old child QStandardItem* _i = %CPPSELF->item(%1, %2); @@ -4766,7 +4766,7 @@ - + // Clear parent from the old child QStandardItem* _i = %CPPSELF->item(%1); @@ -4779,13 +4779,13 @@ - + - + // Clear parent from the old child QStandardItem* _i = %CPPSELF->verticalHeaderItem(%1); @@ -4817,19 +4817,19 @@ - + - + - + @@ -5086,18 +5086,18 @@ - + - + - + @@ -5200,13 +5200,13 @@ - + - + @@ -5258,12 +5258,12 @@ Shiboken::AutoDecRef result(PyObject_CallMethod(%PYARG_0, "connect", "OsO", %PYARG_0, SIGNAL(triggered()), %PYARG_2)); - + - + @@ -5425,9 +5425,12 @@ + + + - + - + - + - - - - - - + + + + + + - + - + - + %BEGIN_ALLOW_THREADS @@ -5475,7 +5478,7 @@ %END_ALLOW_THREADS - + %BEGIN_ALLOW_THREADS @@ -5483,13 +5486,13 @@ %END_ALLOW_THREADS - + - + @@ -5503,32 +5506,32 @@ - + - + - + - + - + - + diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 1d95576..9bac913 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -164,6 +164,9 @@ PYSIDE_TEST(virtual_protected_inheritance_test.py) PYSIDE_TEST(virtual_pure_override_test.py) PYSIDE_TEST(wrong_return_test.py) +if (${QTVERSION} VERSION_GREATER 4.6.9) + PYSIDE_TEST(bug_1091.py) +endif() if(Q_WS_X11) PYSIDE_TEST(x11_symbols_test.py) diff --git a/tests/QtGui/bug_1091.py b/tests/QtGui/bug_1091.py new file mode 100644 index 0000000..b58d26f --- /dev/null +++ b/tests/QtGui/bug_1091.py @@ -0,0 +1,12 @@ +''' unit test for BUG #1091 ''' + +import unittest +from PySide import QtGui + +class QPainterTestCase(unittest.TestCase): + def testIt(self): + self.assertTrue("PixmapFragment" in dir(QtGui.QPainter)) + self.assertTrue("drawPixmapFragments" in dir(QtGui.QPainter)) + +if __name__ == "__main__": + unittest.main() From 98be0df6a55b45538d107421fd557fb77f8ab92b Mon Sep 17 00:00:00 2001 From: Paulo Alcantara Date: Wed, 21 Dec 2011 18:51:34 -0300 Subject: [PATCH 449/455] 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 Reviewed-by: Marcelo Lira --- PySide/QtUiTools/typesystem_uitools.xml | 11 ++++++----- tests/QtUiTools/CMakeLists.txt | 1 + tests/QtUiTools/bug_1060.py | 18 ++++++++++++++++++ tests/QtUiTools/bug_1060.ui | 19 +++++++++++++++++++ 4 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 tests/QtUiTools/bug_1060.py create mode 100644 tests/QtUiTools/bug_1060.ui diff --git a/PySide/QtUiTools/typesystem_uitools.xml b/PySide/QtUiTools/typesystem_uitools.xml index c86ae44..08e98bd 100644 --- a/PySide/QtUiTools/typesystem_uitools.xml +++ b/PySide/QtUiTools/typesystem_uitools.xml @@ -70,27 +70,28 @@ %CPPSELF.addPluginPath(""); // force reload widgets - + - + - + - + - + + diff --git a/tests/QtUiTools/CMakeLists.txt b/tests/QtUiTools/CMakeLists.txt index eecf3df..68ed7f1 100644 --- a/tests/QtUiTools/CMakeLists.txt +++ b/tests/QtUiTools/CMakeLists.txt @@ -8,5 +8,6 @@ PYSIDE_TEST(bug_909.py) PYSIDE_TEST(bug_913.py) PYSIDE_TEST(bug_958.py) PYSIDE_TEST(bug_965.py) +PYSIDE_TEST(bug_1060.py) PYSIDE_TEST(uiloader_test.py) PYSIDE_TEST(ui_test.py) diff --git a/tests/QtUiTools/bug_1060.py b/tests/QtUiTools/bug_1060.py new file mode 100644 index 0000000..8b51501 --- /dev/null +++ b/tests/QtUiTools/bug_1060.py @@ -0,0 +1,18 @@ +''' unit test for BUG #1060 ''' + +from PySide.QtGui import QApplication +from PySide.QtUiTools import QUiLoader +from helper import adjust_filename + +class MyQUiLoader(QUiLoader): + def __init__(self): + super(MyQUiLoader, self).__init__() + + def createWidget(self, *args): + return super(MyQUiLoader, self).createWidget(*args) + +if __name__ == "__main__": + app = QApplication([]) + + ui = MyQUiLoader().load(adjust_filename("bug_1060.ui", __file__)) + ui.show() diff --git a/tests/QtUiTools/bug_1060.ui b/tests/QtUiTools/bug_1060.ui new file mode 100644 index 0000000..f4044a8 --- /dev/null +++ b/tests/QtUiTools/bug_1060.ui @@ -0,0 +1,19 @@ + + + Dialog + + + + 0 + 0 + 100 + 100 + + + + Dialog + + + + + From a8a07b77f8a781764eef62eb05bfeac864368cad Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Thu, 22 Dec 2011 21:49:08 -0300 Subject: [PATCH 450/455] Declares Python types using the new "" tag. Reviewed by Hugo Parente Reviewed by Paulo Alcantara --- PySide/QtCore/typesystem_core_common.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PySide/QtCore/typesystem_core_common.xml b/PySide/QtCore/typesystem_core_common.xml index a2e1deb..8955612 100644 --- a/PySide/QtCore/typesystem_core_common.xml +++ b/PySide/QtCore/typesystem_core_common.xml @@ -21,6 +21,16 @@ + + + + + + + + + + From afc9a7e10b8fd1816b99628de5be3e84032fca03 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Fri, 30 Dec 2011 15:30:29 -0300 Subject: [PATCH 451/455] Version bump to 1.1.0. --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 03f9db8..0151eea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,8 +5,8 @@ project(pysidebindings) cmake_minimum_required(VERSION 2.6) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Macros/ ${CMAKE_MODULE_PATH}) -find_package(GeneratorRunner 0.6.15 REQUIRED) -find_package(Shiboken 1.0.10 REQUIRED) +find_package(GeneratorRunner 0.6.16 REQUIRED) +find_package(Shiboken 1.1.0 REQUIRED) find_package(Qt4 4.5.0 REQUIRED) find_file(GL_H "gl.h" PATH_SUFFIXES "GL") include(FindQt4Extra) @@ -62,8 +62,8 @@ endif() set(BINDING_NAME PySide) set(BINDING_API_MAJOR_VERSION "1") -set(BINDING_API_MINOR_VERSION "0") -set(BINDING_API_MICRO_VERSION "9") +set(BINDING_API_MINOR_VERSION "1") +set(BINDING_API_MICRO_VERSION "0") set(BINDING_API_RELEASE_LEVEL "final") # alpha, beta, rc, or final set(BINDING_API_SERIAL 1) # leave as 0 when release level is final set(BINDING_API_VERSION "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}.${BINDING_API_MICRO_VERSION}" CACHE STRING "PySide version" FORCE) From d30a8672c3db038886273d194f5bcdcb19cc29bd Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Fri, 30 Dec 2011 15:31:11 -0300 Subject: [PATCH 452/455] Version bump to 1.1.1. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0151eea..696b4e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,7 @@ endif() set(BINDING_NAME PySide) set(BINDING_API_MAJOR_VERSION "1") set(BINDING_API_MINOR_VERSION "1") -set(BINDING_API_MICRO_VERSION "0") +set(BINDING_API_MICRO_VERSION "1") set(BINDING_API_RELEASE_LEVEL "final") # alpha, beta, rc, or final set(BINDING_API_SERIAL 1) # leave as 0 when release level is final set(BINDING_API_VERSION "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}.${BINDING_API_MICRO_VERSION}" CACHE STRING "PySide version" FORCE) From db6f1e3306e626b871d6ed1a971638d106648b51 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Tue, 13 Mar 2012 14:26:42 -0300 Subject: [PATCH 453/455] Fix PySide compilation. Change-Id: Ie7a30961232526af59cbc21dbf1b58ab9a4e3e7b Reviewed-by: Hugo Parente Lima --- CMakeLists.txt | 3 +-- cmake/Macros/PySideModules.cmake | 2 +- doc/CMakeLists.txt | 2 +- tests/pysidetest/CMakeLists.txt | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 696b4e3..a7ffbd5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,8 +5,7 @@ project(pysidebindings) cmake_minimum_required(VERSION 2.6) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Macros/ ${CMAKE_MODULE_PATH}) -find_package(GeneratorRunner 0.6.16 REQUIRED) -find_package(Shiboken 1.1.0 REQUIRED) +find_package(Shiboken 1.1.1 REQUIRED) find_package(Qt4 4.5.0 REQUIRED) find_file(GL_H "gl.h" PATH_SUFFIXES "GL") include(FindQt4Extra) diff --git a/cmake/Macros/PySideModules.cmake b/cmake/Macros/PySideModules.cmake index 9eabd56..4877b12 100644 --- a/cmake/Macros/PySideModules.cmake +++ b/cmake/Macros/PySideModules.cmake @@ -20,7 +20,7 @@ macro(create_pyside_module module_name module_include_dir module_libraries modul endif() add_custom_command(OUTPUT ${${module_sources}} - COMMAND ${GENERATORRUNNER_BINARY} ${GENERATOR_EXTRA_FLAGS} + COMMAND ${SHIBOKEN_BINARY} ${GENERATOR_EXTRA_FLAGS} ${pyside_BINARY_DIR}/pyside_global.h --include-paths=${pyside_SOURCE_DIR}${PATH_SEP}${QT_INCLUDE_DIR} --typesystem-paths=${pyside_SOURCE_DIR}${PATH_SEP}${${module_typesystem_path}} diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 61eeb09..967c289 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -23,7 +23,7 @@ configure_file("conf.py.in" "rst/conf.py" @ONLY) configure_file(typesystem_doc.xml.in typesystem_doc.xml @ONLY) add_custom_target("docrsts" - COMMAND ${GENERATORRUNNER_BINARY} --generator-set=qtdoc + COMMAND ${SHIBOKEN_BINARY} --generator-set=qtdoc ${pyside_BINARY_DIR}/pyside_global.h --include-paths="${QT_INCLUDE_DIR}${PATH_SEP}${pyside_SOURCE_DIR}" --api-version=${SUPPORTED_QT_VERSION} diff --git a/tests/pysidetest/CMakeLists.txt b/tests/pysidetest/CMakeLists.txt index 01d61f7..78c6f95 100644 --- a/tests/pysidetest/CMakeLists.txt +++ b/tests/pysidetest/CMakeLists.txt @@ -34,7 +34,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/testbinding/testbinding_module_wrapper.cpp ) add_custom_command(OUTPUT ${testbinding_SRC} -COMMAND ${GENERATORRUNNER_BINARY} ${GENERATOR_EXTRA_FLAGS} +COMMAND ${SHIBOKEN_BINARY} ${GENERATOR_EXTRA_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/pysidetest_global.h --include-paths=${pyside_BINARY_DIR}${PATH_SEP}${CMAKE_CURRENT_SOURCE_DIR}${PATH_SEP}${QT_INCLUDE_DIR}${PATH_SEP}${QT_QTCORE_INCLUDE_DIR}${PATH_SEP}${QT_QTGUI_INCLUDE_DIR} --typesystem-paths=${CMAKE_CURRENT_SOURCE_DIR}${PATH_SEP}${pyside_SOURCE_DIR}${PATH_SEP}${QtCore_SOURCE_DIR}${PATH_SEP}${QtCore_BINARY_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR} From fe8dc36f90fe64590f7f13843a076f8d2d61f378 Mon Sep 17 00:00:00 2001 From: Juhapekka Piiroinen Date: Tue, 6 Mar 2012 13:57:16 +0200 Subject: [PATCH 454/455] 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 --- cmake/Macros/PySideModules.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Macros/PySideModules.cmake b/cmake/Macros/PySideModules.cmake index 4877b12..2fe6cd1 100644 --- a/cmake/Macros/PySideModules.cmake +++ b/cmake/Macros/PySideModules.cmake @@ -71,7 +71,7 @@ macro(check_qt_class module class optional_source_files dropped_entries) endif () string(TOLOWER ${class} _class) string(TOUPPER ${module} _module) - if (${namespace}) + if (_namespace) set(_cppfile ${CMAKE_CURRENT_BINARY_DIR}/PySide/${module}/${_namespace}_${_class}_wrapper.cpp) else () set(_cppfile ${CMAKE_CURRENT_BINARY_DIR}/PySide/${module}/${_class}_wrapper.cpp) From f011ce2cb9e2b93a748874de007232ec88cc8ac1 Mon Sep 17 00:00:00 2001 From: Juhapekka Piiroinen Date: Mon, 5 Mar 2012 07:59:41 +0200 Subject: [PATCH 455/455] 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 --- PySide/QtCore/typesystem_core_common.xml | 7 +++++++ tests/QtCore/python_conversion.py | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/PySide/QtCore/typesystem_core_common.xml b/PySide/QtCore/typesystem_core_common.xml index 8955612..2e83131 100644 --- a/PySide/QtCore/typesystem_core_common.xml +++ b/PySide/QtCore/typesystem_core_common.xml @@ -1257,6 +1257,13 @@ %0 = new %TYPE(date, time, Qt::TimeSpec(%8)); + + + QDate date(%1, %2, %3); + QTime time(%4, %5, %6); + %0 = new %TYPE(date, time); + + diff --git a/tests/QtCore/python_conversion.py b/tests/QtCore/python_conversion.py index 2472dee..84845c0 100644 --- a/tests/QtCore/python_conversion.py +++ b/tests/QtCore/python_conversion.py @@ -43,5 +43,22 @@ class TestDateTimeConversions (unittest.TestCase): self.assertEqual(dateTime, other.toPython()) + def testQDateTime6arg(self): + dateTime = datetime.datetime(2010, 4, 23, 11, 14, 7) + other = QDateTime(dateTime) + + otherDate = other.date() + self.assertEqual(dateTime.year, otherDate.year()) + self.assertEqual(dateTime.month, otherDate.month()) + self.assertEqual(dateTime.day, otherDate.day()) + + otherTime = other.time() + self.assertEqual(dateTime.hour, otherTime.hour()) + self.assertEqual(dateTime.minute, otherTime.minute()) + self.assertEqual(dateTime.second, otherTime.second()) + self.assertEqual(dateTime.microsecond/1000, otherTime.msec()) + + self.assertEqual(dateTime, other.toPython()) + if __name__ == '__main__': unittest.main()