summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlinjunhalida <linjunhalida@gmail.com>2011-01-04 23:43:56 +0800
committerHugo Parente Lima <hugo.pl@gmail.com>2011-01-04 19:55:14 -0200
commit32681f7b7039f41bec4c4965370d4b66bee53532 (patch)
treed98be485a7d9e6c552a1f8cda78af8a5fa4562e7
parent15dd2e07edd4d1114bd8651987327e3ebc9ba6a6 (diff)
downloadpyside-32681f7b7039f41bec4c4965370d4b66bee53532.tar.gz
pyside-32681f7b7039f41bec4c4965370d4b66bee53532.tar.xz
pyside-32681f7b7039f41bec4c4965370d4b66bee53532.zip
add new QDatetime init function with 6 arguments
Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
-rw-r--r--PySide/QtCore/typesystem_core.xml7
-rw-r--r--tests/QtCore/python_conversion.py11
2 files changed, 18 insertions, 0 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml
index f41acd5..6b66b57 100644
--- a/PySide/QtCore/typesystem_core.xml
+++ b/PySide/QtCore/typesystem_core.xml
@@ -822,6 +822,13 @@
%0 = new %TYPE(date, time, Qt::TimeSpec(%8));
</inject-code>
</add-function>
+ <add-function signature="QDateTime(int, int, int, int, int, int)">
+ <inject-code class="target" position="beginning">
+ QDate date(%1, %2, %3);
+ QTime time(%4, %5, %6);
+ %0 = new %TYPE(date, time);
+ </inject-code>
+ </add-function>
<add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="reduce_code">
diff --git a/tests/QtCore/python_conversion.py b/tests/QtCore/python_conversion.py
index 43dfccf..b75fee1 100644
--- a/tests/QtCore/python_conversion.py
+++ b/tests/QtCore/python_conversion.py
@@ -44,7 +44,18 @@ class TestDateTimeConversions (unittest.TestCase):
self.assertEqual(dateTime, other.toPython())
+ # with 6 arguments
+ other = QDateTime(2010, 04, 23, 11, 14, 01)
+ otherDate = other.date()
+ self.assertEqual(2010, otherDate.year())
+ self.assertEqual(4, otherDate.month())
+ self.assertEqual(23, otherDate.day())
+
+ otherTime = other.time()
+ self.assertEqual(11, otherTime.hour())
+ self.assertEqual(14, otherTime.minute())
+ self.assertEqual(1, otherTime.second())
if __name__ == '__main__':
unittest.main()