4
from PySide.QtCore import *
5
from PySide.QtGui import *
6
from helper import UsesQApplication
8
class Foo(QPyTextObject):
11
def intrinsicSize(self, doc, posInDocument, format):
15
def drawObject(self, painter, rect, doc, posInDocument, format):
18
class QAbstractTextDocumentLayoutTest(UsesQApplication):
20
objectType = QTextFormat.UserObject + 1
23
fmt = QTextCharFormat()
24
fmt.setObjectType(QAbstractTextDocumentLayoutTest.objectType)
26
cursor = self.textEdit.textCursor()
27
cursor.insertText(unichr(0xfffc), fmt)
28
self.textEdit.setTextCursor(cursor)
33
self.textEdit = QTextEdit()
37
self.textEdit.document().documentLayout().registerHandler(QAbstractTextDocumentLayoutTest.objectType, interface)
39
QTimer.singleShot(0, self.foo)
42
self.assertTrue(Foo.called)
44
if __name__ == "__main__":