Remove the total line count, and trigger the update *after* the key/mouse events
This commit is contained in:
+7
-6
@@ -740,8 +740,9 @@ class GuiDocEditor(QTextEdit):
|
|||||||
elif keyEvent == QKeySequence.Undo:
|
elif keyEvent == QKeySequence.Undo:
|
||||||
self.docAction(nwDocAction.UNDO)
|
self.docAction(nwDocAction.UNDO)
|
||||||
else:
|
else:
|
||||||
self.docFooter.updateLineCount()
|
|
||||||
QTextEdit.keyPressEvent(self, keyEvent)
|
QTextEdit.keyPressEvent(self, keyEvent)
|
||||||
|
self.docFooter.updateLineCount()
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def focusNextPrevChild(self, toNext):
|
def focusNextPrevChild(self, toNext):
|
||||||
@@ -764,8 +765,10 @@ class GuiDocEditor(QTextEdit):
|
|||||||
if qApp.keyboardModifiers() == Qt.ControlModifier:
|
if qApp.keyboardModifiers() == Qt.ControlModifier:
|
||||||
theCursor = self.cursorForPosition(mEvent.pos())
|
theCursor = self.cursorForPosition(mEvent.pos())
|
||||||
self._followTag(theCursor)
|
self._followTag(theCursor)
|
||||||
self.docFooter.updateLineCount()
|
|
||||||
QTextEdit.mouseReleaseEvent(self, mEvent)
|
QTextEdit.mouseReleaseEvent(self, mEvent)
|
||||||
|
self.docFooter.updateLineCount()
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def resizeEvent(self, theEvent):
|
def resizeEvent(self, theEvent):
|
||||||
@@ -2205,7 +2208,7 @@ class GuiDocEditFooter(QWidget):
|
|||||||
self.linesIcon.setFixedHeight(self.sPx)
|
self.linesIcon.setFixedHeight(self.sPx)
|
||||||
self.linesIcon.setAlignment(Qt.AlignLeft | Qt.AlignTop)
|
self.linesIcon.setAlignment(Qt.AlignLeft | Qt.AlignTop)
|
||||||
|
|
||||||
self.linesText = QLabel("Line: 0 of 0")
|
self.linesText = QLabel("Line: 0")
|
||||||
self.linesText.setIndent(0)
|
self.linesText.setIndent(0)
|
||||||
self.linesText.setMargin(0)
|
self.linesText.setMargin(0)
|
||||||
self.linesText.setContentsMargins(0, 0, 0, 0)
|
self.linesText.setContentsMargins(0, 0, 0, 0)
|
||||||
@@ -2295,13 +2298,11 @@ class GuiDocEditFooter(QWidget):
|
|||||||
"""
|
"""
|
||||||
if self.theItem is None:
|
if self.theItem is None:
|
||||||
iLine = 0
|
iLine = 0
|
||||||
nLine = 0
|
|
||||||
else:
|
else:
|
||||||
theCursor = self.docEditor.textCursor()
|
theCursor = self.docEditor.textCursor()
|
||||||
iLine = theCursor.blockNumber() + 1
|
iLine = theCursor.blockNumber() + 1
|
||||||
nLine = self.docEditor.qDocument.blockCount()
|
|
||||||
|
|
||||||
self.linesText.setText("Line: %d of %d" % (iLine, nLine))
|
self.linesText.setText(f"Line: {iLine:n}")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user