diff -r 6bbe8e2210d7 -r 71208bcc7d99 src/eric7/QScintilla/Editor.py --- a/src/eric7/QScintilla/Editor.py Sat Jan 13 12:58:16 2024 +0100 +++ b/src/eric7/QScintilla/Editor.py Sat Jan 13 13:01:09 2024 +0100 @@ -490,6 +490,11 @@ self.gotoLine(1) # connect the mouse hover signals + # mouse hover for the editor margins + self.SCN_DWELLSTART.connect(self.__marginHoverStart) + self.SCN_DWELLEND.connect(self.__marginHoverEnd) + + # mouse hover help for the editor text self.SCN_DWELLSTART.connect(self.__showMouseHoverHelp) self.SCN_DWELLEND.connect(self.__cancelMouseHoverHelp) self.__mouseHoverHelp = None @@ -3959,6 +3964,51 @@ elif self.markersAtLine(line) & (1 << self.warning): self.__showWarning(line) + @pyqtSlot(int, int, int) + def __marginHoverStart(self, pos, x, y): + """ + Private slot showing the text of a syntax error or a warning marker. + + @param pos mouse position into the document + @type int + @param x x-value of mouse screen position + @type int + @param y y-value of mouse screen position + @type int + """ + from PyQt6.QtGui import QCursor + from PyQt6.QtWidgets import QToolTip + margin = self.__marginNumber(x) + if margin == self.__indicMargin: + # determine width of all margins; needed to calculate document line + width = 0 + for margin in range(5): + width += self.marginWidth(margin) + + message = "" + line = self.lineIndexFromPoint(QPoint(width + 1, y))[0] + if self.markersAtLine(line) & (1 << self.syntaxerror): + for handle in self.syntaxerrors: + if self.markerLine(handle) == line: + message = "\n".join([e[0] for e in self.syntaxerrors[handle]]) + break + elif self.markersAtLine(line) & (1 << self.warning): + for handle in self._warnings: + if self.markerLine(handle) == line: + message = "\n".join([w[0] for w in self._warnings[handle]]) + break + + if message: + QToolTip.showText(QCursor.pos(), message) + + @pyqtSlot() + def __marginHoverEnd(self): + """ + Private slot cancelling the display of syntax error or a warning marker text. + """ + from PyQt6.QtWidgets import QToolTip + QToolTip.hideText() + @pyqtSlot() def handleMonospacedEnable(self): """ @@ -6697,9 +6747,7 @@ ): return - if Preferences.getEditor("AutoCheckSyntax") and Preferences.getEditor( - "OnlineSyntaxCheck" - ): + if Preferences.getEditor("OnlineSyntaxCheck"): self.__onlineSyntaxCheckTimer.stop() if self.isPy3File():