예제 #1
0
 def _get_image(self, name):
     """ Returns the QImage stored as the ImageResource with 'name'.
     """
     document = self._control.document()
     image = document.resource(QtGui.QTextDocument.ImageResource,
                               QtCore.QUrl(name))
     return image
예제 #2
0
 def _add_image(self, image):
     """ Adds the specified QImage to the document and returns a
         QTextImageFormat that references it.
     """
     document = self._control.document()
     name = str(image.cacheKey())
     document.addResource(QtGui.QTextDocument.ImageResource,
                          QtCore.QUrl(name), image)
     format = QtGui.QTextImageFormat()
     format.setName(name)
     return format