diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-07-15 00:26:39 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-07-15 00:26:39 +0200 |
commit | be0576f6a1f8839ac49b9164102b4b0a3bc25a7f (patch) | |
tree | a797d1547f9992e34748cdc59fe3a41bdebcde12 | |
parent | Switch to room after joining invite (diff) | |
download | nheko-be0576f6a1f8839ac49b9164102b4b0a3bc25a7f.tar.xz |
Add workaround for TextEdit not rerendering after image loaded
fixes #541
-rw-r--r-- | resources/qml/MatrixText.qml | 5 | ||||
-rw-r--r-- | src/timeline/TimelineViewManager.cpp | 10 | ||||
-rw-r--r-- | src/timeline/TimelineViewManager.h | 4 |
3 files changed, 19 insertions, 0 deletions
diff --git a/resources/qml/MatrixText.qml b/resources/qml/MatrixText.qml index 65d66315..9129b154 100644 --- a/resources/qml/MatrixText.qml +++ b/resources/qml/MatrixText.qml @@ -7,6 +7,7 @@ import QtQuick.Controls 2.3 import im.nheko 1.0 TextEdit { + id: r textFormat: TextEdit.RichText readOnly: true focus: false @@ -24,4 +25,8 @@ TextEdit { cursorShape: hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor } + Component.onCompleted: { + TimelineManager.fixImageRendering(r.textDocument, r) + } + } diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp index b7fd4093..b39ef615 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp @@ -681,3 +681,13 @@ TimelineViewManager::forwardMessageToRoom(mtx::events::collections::TimelineEven }, *e); } + +//! WORKAROUND(Nico): for https://bugreports.qt.io/browse/QTBUG-93281 +void +TimelineViewManager::fixImageRendering(QQuickTextDocument *t, QQuickItem *i) +{ + if (t) { + QObject::connect( + t->textDocument(), SIGNAL(imagesLoaded()), i, SLOT(updateWholeDocument())); + } +} diff --git a/src/timeline/TimelineViewManager.h b/src/timeline/TimelineViewManager.h index 556bcf4c..15b4f523 100644 --- a/src/timeline/TimelineViewManager.h +++ b/src/timeline/TimelineViewManager.h @@ -5,6 +5,8 @@ #pragma once #include <QHash> +#include <QQuickItem> +#include <QQuickTextDocument> #include <QQuickView> #include <QQuickWidget> #include <QSharedPointer> @@ -68,6 +70,8 @@ public: Q_INVOKABLE void openLeaveRoomDialog(QString roomid) const; Q_INVOKABLE void removeVerificationFlow(DeviceVerificationFlow *flow); + Q_INVOKABLE void fixImageRendering(QQuickTextDocument *t, QQuickItem *i); + void verifyUser(QString userid); void verifyDevice(QString userid, QString deviceid); |