Fix inline images not showing up

Work around QTBUG 93281

See https://bugreports.qt.io/browse/QTBUG-93281 for details
This commit is contained in:
Tobias Fella
2022-10-17 18:54:59 +00:00
parent b9f8ef2570
commit 785a82df93
3 changed files with 13 additions and 0 deletions

View File

@@ -52,6 +52,11 @@ TextEdit {
persistentSelection: true persistentSelection: true
// Work around QTBUG 93281
Component.onCompleted: if (text.includes("<img")) {
Controller.forceRefreshTextDocument(contentLabel.textDocument, contentLabel)
}
text: "<style> text: "<style>
table { table {
width:100%; width:100%;

View File

@@ -684,3 +684,9 @@ bool Controller::encryptionSupported() const
return false; return false;
#endif #endif
} }
void Controller::forceRefreshTextDocument(QQuickTextDocument *textDocument, QQuickItem *item)
{
// HACK: Workaround bug QTBUG 93281
connect(textDocument->textDocument(), SIGNAL(imagesLoaded()), item, SLOT(updateWholeDocument()));
}

View File

@@ -96,6 +96,8 @@ public:
Q_INVOKABLE QString plainText(QQuickTextDocument *document) const; Q_INVOKABLE QString plainText(QQuickTextDocument *document) const;
bool encryptionSupported() const; bool encryptionSupported() const;
Q_INVOKABLE void forceRefreshTextDocument(QQuickTextDocument *textDocument, QQuickItem *item);
private: private:
explicit Controller(QObject *parent = nullptr); explicit Controller(QObject *parent = nullptr);