aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--PySide/QtGui/typesystem_gui_common.xml12
-rw-r--r--tests/QtGui/CMakeLists.txt1
-rw-r--r--tests/QtGui/qtextline_test.py23
3 files changed, 35 insertions, 1 deletions
diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml
index f455d64b0..90525c7aa 100644
--- a/PySide/QtGui/typesystem_gui_common.xml
+++ b/PySide/QtGui/typesystem_gui_common.xml
@@ -407,8 +407,18 @@
<value-type name="QTextLine" >
<enum-type name="CursorPosition"/>
<enum-type name="Edge"/>
- <!-- ### See bug 741 -->
<modify-function signature="cursorToX(int*,QTextLine::Edge)const" remove="all" />
+ <modify-function signature="cursorToX(int,QTextLine::Edge)const">
+ <modify-argument index="0">
+ <replace-type modified-type="PyObject" />
+ </modify-argument>
+ <inject-code class="target" position="beginning">
+ %BEGIN_ALLOW_THREADS
+ %RETURN_TYPE %0 = %CPPSELF->::%TYPE::%FUNCTION_NAME(&amp;%1, %2);
+ %END_ALLOW_THREADS
+ %PYARG_0 = Shiboken::makeTuple(%0, %1);
+ </inject-code>
+ </modify-function>
<modify-function signature="xToCursor(qreal,QTextLine::CursorPosition)const">
<modify-argument index="2">
<rename to="edge"/>
diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt
index 5b4b02bce..91236afe8 100644
--- a/tests/QtGui/CMakeLists.txt
+++ b/tests/QtGui/CMakeLists.txt
@@ -109,6 +109,7 @@ PYSIDE_TEST(qtableview_test.py)
PYSIDE_TEST(qtabwidget_test.py)
PYSIDE_TEST(qtextedit_test.py)
PYSIDE_TEST(qtextedit_signal_test.py)
+PYSIDE_TEST(qtextline_test.py)
PYSIDE_TEST(qtoolbar_test.py)
PYSIDE_TEST(qtoolbox_test.py)
PYSIDE_TEST(qtransform_test.py)
diff --git a/tests/QtGui/qtextline_test.py b/tests/QtGui/qtextline_test.py
new file mode 100644
index 000000000..76a711e32
--- /dev/null
+++ b/tests/QtGui/qtextline_test.py
@@ -0,0 +1,23 @@
+
+import unittest
+
+from PySide.QtGui import QTextLayout
+from helper import UsesQApplication
+
+class QTextLineTest(UsesQApplication):
+
+ def testCursorToX(self):
+ textLayout = QTextLayout()
+ textLayout.beginLayout()
+ line = textLayout.createLine()
+ self.assert_(line.isValid())
+ x, cursorPos = line.cursorToX(0)
+ self.assertEqual(type(x), float)
+ self.assertEqual(type(cursorPos), int)
+ x, cursorPos = line.cursorToX(1)
+ self.assertEqual(type(x), float)
+ self.assertEqual(type(cursorPos), int)
+
+if __name__ == '__main__':
+ unittest.main()
+