Need more calls to update document margins due to the document title bar.
This commit is contained in:
@@ -228,7 +228,6 @@ class GuiDocEditor(QTextEdit):
|
|||||||
tHandle = self.theHandle
|
tHandle = self.theHandle
|
||||||
self.clearEditor()
|
self.clearEditor()
|
||||||
self.loadText(tHandle, showStatus=False)
|
self.loadText(tHandle, showStatus=False)
|
||||||
self.updateDocMargins()
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def loadText(self, tHandle, tLine=None, showStatus=True):
|
def loadText(self, tHandle, tLine=None, showStatus=True):
|
||||||
@@ -289,6 +288,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
"""
|
"""
|
||||||
self.setPlainText(theText)
|
self.setPlainText(theText)
|
||||||
self.setDocumentChanged(True)
|
self.setDocumentChanged(True)
|
||||||
|
self.updateDocMargins()
|
||||||
return
|
return
|
||||||
|
|
||||||
def saveText(self):
|
def saveText(self):
|
||||||
@@ -370,6 +370,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
"""
|
"""
|
||||||
if tHandle == self.theHandle:
|
if tHandle == self.theHandle:
|
||||||
self.docTitle.setTitleFromHandle(self.theHandle)
|
self.docTitle.setTitleFromHandle(self.theHandle)
|
||||||
|
self.updateDocMargins()
|
||||||
return
|
return
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ class GuiDocViewer(QTextBrowser):
|
|||||||
self.theHandle = tHandle
|
self.theHandle = tHandle
|
||||||
self.theProject.setLastViewed(tHandle)
|
self.theProject.setLastViewed(tHandle)
|
||||||
self.docTitle.setTitleFromHandle(self.theHandle)
|
self.docTitle.setTitleFromHandle(self.theHandle)
|
||||||
|
self.updateDocMargins()
|
||||||
|
|
||||||
# Make sure the main GUI knows we changed the content
|
# Make sure the main GUI knows we changed the content
|
||||||
self.theParent.viewMeta.refreshReferences(tHandle)
|
self.theParent.viewMeta.refreshReferences(tHandle)
|
||||||
@@ -199,23 +200,11 @@ class GuiDocViewer(QTextBrowser):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def updateDocTitle(self, tHandle):
|
def updateDocMargins(self):
|
||||||
"""Called when an item label is changed to check if the document
|
"""Automatically adjust the margins so the text is centred if
|
||||||
title bar needs updating,
|
Config.textFixedW is enabled or we're in Zen mode. Otherwise,
|
||||||
|
just ensure the margins are set correctly.
|
||||||
"""
|
"""
|
||||||
if tHandle == self.theHandle:
|
|
||||||
self.docTitle.setTitleFromHandle(self.theHandle)
|
|
||||||
return
|
|
||||||
|
|
||||||
##
|
|
||||||
# Events
|
|
||||||
##
|
|
||||||
|
|
||||||
def resizeEvent(self, theEvent):
|
|
||||||
"""Make sure the document title is the same width as the window.
|
|
||||||
"""
|
|
||||||
QTextBrowser.resizeEvent(self, theEvent)
|
|
||||||
|
|
||||||
tB = self.lineWidth()
|
tB = self.lineWidth()
|
||||||
tW = self.width() - 2*tB
|
tW = self.width() - 2*tB
|
||||||
tH = self.docTitle.height()
|
tH = self.docTitle.height()
|
||||||
@@ -235,6 +224,26 @@ class GuiDocViewer(QTextBrowser):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def updateDocTitle(self, tHandle):
|
||||||
|
"""Called when an item label is changed to check if the document
|
||||||
|
title bar needs updating,
|
||||||
|
"""
|
||||||
|
if tHandle == self.theHandle:
|
||||||
|
self.docTitle.setTitleFromHandle(self.theHandle)
|
||||||
|
self.updateDocMargins()
|
||||||
|
return
|
||||||
|
|
||||||
|
##
|
||||||
|
# Events
|
||||||
|
##
|
||||||
|
|
||||||
|
def resizeEvent(self, theEvent):
|
||||||
|
"""Make sure the document title is the same width as the window.
|
||||||
|
"""
|
||||||
|
QTextBrowser.resizeEvent(self, theEvent)
|
||||||
|
self.updateDocMargins()
|
||||||
|
return
|
||||||
|
|
||||||
##
|
##
|
||||||
# Internal Functions
|
# Internal Functions
|
||||||
##
|
##
|
||||||
|
|||||||
Reference in New Issue
Block a user