summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextdocument_p.cpp
diff options
context:
space:
mode:
authorAlexander Volkov <avolkov@astralinux.ru>2018-09-25 18:09:28 +0300
committerAlexander Volkov <avolkov@astralinux.ru>2021-01-12 15:33:10 +0300
commit376e3bd8ecf40881685714f6f19e12d68e92127e (patch)
tree8a137b8cea51115b405202ef6c0cffdf6fe78192 /src/gui/text/qtextdocument_p.cpp
parent9e09677c1dd4da92735736a0fbcb703416bf4d6d (diff)
Introduce QUrlResourceProvider to load resources for HTML
QTextDocument and the text editor classes suggest to override their loadResource() methods to provide data associated with a text document. This approach has the following drawbacks: - it requires subclassing - there is no way to set a global resource provider - QLabel is missing virtual loadResource() method and it can't be added without breaking ABI QUrlResourceProvider is designed to solve these issues. One should create a derived class that implements QUrlResourceProvider::resource(). The objects of the derived class then can be set for any text document. The default resource provider can be set with QUrlResourceProvider::setDefaultProvider(). This change also adds QLabel::setResourceProvider(), which doesn't break ABI. [ChangeLog][QtGui][Text] Introduced QUrlResourceProvider that allows to load resources for HTML. It is intended to replace the use of QTextDocument::loadResource(). Change-Id: Iaf19b229f522a73508f20715257450fe58f68daf Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui/text/qtextdocument_p.cpp')
-rw-r--r--src/gui/text/qtextdocument_p.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index d6da0f38d2..1f2e8d2da2 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -52,6 +52,7 @@
#include "qtextdocumentlayout_p.h"
#include "qtexttable.h"
#include "qtextengine_p.h"
+#include "qurlresourceprovider.h"
#include <stdlib.h>
@@ -186,7 +187,8 @@ QTextDocumentPrivate::QTextDocumentPrivate()
docChangeLength(0),
framesDirty(true),
rtFrame(nullptr),
- initialBlockCharFormatIndex(-1) // set correctly later in init()
+ initialBlockCharFormatIndex(-1), // set correctly later in init()
+ resourceProvider(nullptr)
{
editBlock = 0;
editBlockCursorPosition = -1;