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:
@@ -52,6 +52,11 @@ TextEdit {
|
||||
|
||||
persistentSelection: true
|
||||
|
||||
// Work around QTBUG 93281
|
||||
Component.onCompleted: if (text.includes("<img")) {
|
||||
Controller.forceRefreshTextDocument(contentLabel.textDocument, contentLabel)
|
||||
}
|
||||
|
||||
text: "<style>
|
||||
table {
|
||||
width:100%;
|
||||
|
||||
@@ -684,3 +684,9 @@ bool Controller::encryptionSupported() const
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Controller::forceRefreshTextDocument(QQuickTextDocument *textDocument, QQuickItem *item)
|
||||
{
|
||||
// HACK: Workaround bug QTBUG 93281
|
||||
connect(textDocument->textDocument(), SIGNAL(imagesLoaded()), item, SLOT(updateWholeDocument()));
|
||||
}
|
||||
|
||||
@@ -96,6 +96,8 @@ public:
|
||||
Q_INVOKABLE QString plainText(QQuickTextDocument *document) const;
|
||||
bool encryptionSupported() const;
|
||||
|
||||
Q_INVOKABLE void forceRefreshTextDocument(QQuickTextDocument *textDocument, QQuickItem *item);
|
||||
|
||||
private:
|
||||
explicit Controller(QObject *parent = nullptr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user