Export QTextImageHandler and add accessor for image
To allow optimizations in the scene graph, we export the private QTextImageHandler class and add a function which will fetch a given image when required, or return the cached image in the document resources. Task-number: QTBUG-20917 Change-Id: If45e51b0d9a267bc198623165e7a2cc1fb2b961f Reviewed-on: http://codereview.qt-project.org/5227 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>bb10
parent
bc60b6787c
commit
0992a24653
|
|
@ -217,6 +217,13 @@ QSizeF QTextImageHandler::intrinsicSize(QTextDocument *doc, int posInDocument, c
|
|||
return getPixmapSize(doc, imageFormat);
|
||||
}
|
||||
|
||||
QImage QTextImageHandler::image(QTextDocument *doc, const QTextImageFormat &imageFormat)
|
||||
{
|
||||
Q_ASSERT(doc != 0);
|
||||
|
||||
return getImage(doc, imageFormat);
|
||||
}
|
||||
|
||||
void QTextImageHandler::drawObject(QPainter *p, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format)
|
||||
{
|
||||
Q_UNUSED(posInDocument)
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@ QT_BEGIN_NAMESPACE
|
|||
|
||||
class QTextImageFormat;
|
||||
|
||||
class QTextImageHandler : public QObject,
|
||||
public QTextObjectInterface
|
||||
class Q_GUI_EXPORT QTextImageHandler : public QObject,
|
||||
public QTextObjectInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QTextObjectInterface)
|
||||
|
|
@ -70,9 +70,10 @@ public:
|
|||
|
||||
virtual QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format);
|
||||
virtual void drawObject(QPainter *p, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format);
|
||||
QImage image(QTextDocument *doc, const QTextImageFormat &imageFormat);
|
||||
|
||||
typedef QImage (*ExternalImageLoaderFunction)(const QString &name, const QString &context);
|
||||
static Q_GUI_EXPORT ExternalImageLoaderFunction externalLoader; //this is needed by Qt3Support
|
||||
static ExternalImageLoaderFunction externalLoader; //this is needed by Qt3Support
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
Loading…
Reference in New Issue