fix: prevent images overriding content when changing pages
Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
@ -28,7 +28,7 @@
|
||||
* Why? Because we want to re-scale images dynamically based on the document's size, in order to
|
||||
* not have images being weirdly cropped out in different resolutions.
|
||||
*/
|
||||
class VariableSizedImageObject : public QObject, public QTextObjectInterface {
|
||||
class VariableSizedImageObject final : public QObject, public QTextObjectInterface {
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QTextObjectInterface)
|
||||
|
||||
@ -38,7 +38,15 @@ class VariableSizedImageObject : public QObject, public QTextObjectInterface {
|
||||
|
||||
void setMetaEntry(QString meta_entry) { m_meta_entry = meta_entry; }
|
||||
|
||||
protected:
|
||||
public slots:
|
||||
/** Stops all currently loading images from modifying the document.
|
||||
*
|
||||
* This does not stop the ongoing network tasks, it only prevents their result
|
||||
* from impacting the document any further.
|
||||
*/
|
||||
void flush();
|
||||
|
||||
private:
|
||||
/** Adds the image to the document, in the given position.
|
||||
*/
|
||||
void parseImage(QTextDocument* doc, QImage image, int posInDocument);
|
||||
@ -49,7 +57,8 @@ class VariableSizedImageObject : public QObject, public QTextObjectInterface {
|
||||
*/
|
||||
void loadImage(QTextDocument* doc, const QUrl& source, int posInDocument);
|
||||
|
||||
private:
|
||||
QString m_meta_entry;
|
||||
|
||||
QList<QUrl> m_fetching_images;
|
||||
QSet<QUrl> m_fetching_images;
|
||||
};
|
||||
|
Reference in New Issue
Block a user