Use markContentsDirty on the QTextDocument instead of the textWidth hack

This commit is contained in:
Veronica K. B. Olsen
2020-08-18 08:50:08 +02:00
parent b80ff750fb
commit 4a20a0eb01
2 changed files with 6 additions and 8 deletions
+3 -4
View File
@@ -1037,10 +1037,9 @@ class GuiBuildNovelDocView(QTextBrowser):
self.verticalScrollBar().setValue(sPos)
self._updateBuildAge()
# This forces a repaint of the text, It's a hack to fix an occational
# issue where the find/replace above interfers with the rendering and
# leaves parts of the document blank.
self.qDocument.setTextWidth(self.qDocument.textWidth())
# Since we change the content while it may still be rendering, we mark
# the document dirty again to make sure it's re-rendered properly.
self.qDocument.markContentsDirty(0, self.qDocument.characterCount())
return
+3 -4
View File
@@ -180,10 +180,9 @@ class GuiDocViewer(QTextBrowser):
# Make sure the main GUI knows we changed the content
self.theParent.viewMeta.refreshReferences(tHandle)
# This forces a repaint of the text, It's a hack to fix an occational
# issue where the find/replace above interfers with the rendering and
# leaves parts of the document blank.
self.qDocument.setTextWidth(self.qDocument.textWidth())
# Since we change the content while it may still be rendering, we mark
# the document dirty again to make sure it's re-rendered properly.
self.qDocument.markContentsDirty(0, self.qDocument.characterCount())
return True