~ubuntu-branches/ubuntu/raring/python-qt4/raring-proposed

« back to all changes in this revision

Viewing changes to debian/patches/fix-QTextBlockUserData.patch

  • Committer: Package Import Robot
  • Author(s): Julian Taylor
  • Date: 2013-03-29 14:35:15 UTC
  • Revision ID: package-import@ubuntu.com-20130329143515-caln0b1j2309ekqb
Tags: 4.10-0ubuntu2
backport fix-QTextBlockUserData.patch from upstream snapshot
fixes e.g. syntax highlighting in editors (LP: #1161818)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: fix QTextBlockUserData losing its data
 
2
Origin: pyqt4 4.10.1 snapshot
 
3
Bug: http://www.riverbankcomputing.com/pipermail/pyqt/2013-March/032457.html
 
4
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/python-qt4/+bug/1161818
 
5
Author: phil@riverbankcomputing.com
 
6
 
 
7
--- a/sip/QtGui/qsyntaxhighlighter.sip
 
8
+++ b/sip/QtGui/qsyntaxhighlighter.sip
 
9
@@ -1,4 +1,4 @@
 
10
-// qsyntaxhighlighter.sip generated by MetaSIP on Fri Mar  1 21:42:08 2013
 
11
+// qsyntaxhighlighter.sip generated by MetaSIP on Thu Mar 14 02:48:42 2013
 
12
 //
 
13
 // This file is part of the QtGui Python extension module.
 
14
 //
 
15
@@ -68,7 +68,25 @@ protected:
 
16
     int previousBlockState() const;
 
17
     int currentBlockState() const;
 
18
     void setCurrentBlockState(int newState);
 
19
-    void setCurrentBlockUserData(QTextBlockUserData *data /Transfer/);
 
20
+    void setCurrentBlockUserData(QTextBlockUserData *data /GetWrapper/);
 
21
+%MethodCode
 
22
+        // Ownership of the user data is with the document not the text block.
 
23
+        QTextDocument *td = sipCpp->document();
 
24
+        
 
25
+        if (td)
 
26
+        {
 
27
+            PyObject *td_obj = sipConvertFromType(td, sipType_QTextDocument, 0);
 
28
+        
 
29
+            if (td_obj)
 
30
+            {
 
31
+                sipTransferTo(a0Wrapper, td_obj);
 
32
+                Py_DECREF(td_obj);
 
33
+            }
 
34
+        }
 
35
+        
 
36
+        sipCpp->setCurrentBlockUserData(a0);
 
37
+%End
 
38
+
 
39
     QTextBlockUserData *currentBlockUserData() const;
 
40
 %If (Qt_4_4_0 -)
 
41
     QTextBlock currentBlock() const;
 
42
--- a/sip/QtGui/qtextobject.sip
 
43
+++ b/sip/QtGui/qtextobject.sip
 
44
@@ -1,4 +1,4 @@
 
45
-// qtextobject.sip generated by MetaSIP on Fri Mar  1 21:42:08 2013
 
46
+// qtextobject.sip generated by MetaSIP on Thu Mar 14 02:48:42 2013
 
47
 //
 
48
 // This file is part of the QtGui Python extension module.
 
49
 //
 
50
@@ -193,7 +193,26 @@ public:
 
51
     QTextBlock next() const;
 
52
     QTextBlock previous() const;
 
53
     QTextBlockUserData *userData() const;
 
54
-    void setUserData(QTextBlockUserData *data /Transfer/);
 
55
+    void setUserData(QTextBlockUserData *data /GetWrapper/);
 
56
+%MethodCode
 
57
+        // Ownership of the user data is with the document not the text block.
 
58
+        const QTextDocument *td = sipCpp->document();
 
59
+        
 
60
+        if (td)
 
61
+        {
 
62
+            PyObject *td_obj = sipConvertFromType(const_cast<QTextDocument *>(td),
 
63
+                    sipType_QTextDocument, 0);
 
64
+        
 
65
+            if (td_obj)
 
66
+            {
 
67
+                sipTransferTo(a0Wrapper, td_obj);
 
68
+                Py_DECREF(td_obj);
 
69
+            }
 
70
+        }
 
71
+        
 
72
+        sipCpp->setUserData(a0);
 
73
+%End
 
74
+
 
75
     int userState() const;
 
76
     void setUserState(int state);
 
77
 %If (Qt_4_4_0 -)