diff -r b8396ae5c2c2 -r 9ebe2183cf49 src/eric7/QScintilla/DocstringGenerator/PyDocstringGenerator.py --- a/src/eric7/QScintilla/DocstringGenerator/PyDocstringGenerator.py Sat May 27 18:30:13 2023 +0200 +++ b/src/eric7/QScintilla/DocstringGenerator/PyDocstringGenerator.py Sat May 27 18:57:32 2023 +0200 @@ -683,23 +683,30 @@ self.hasInfo = True self.__splitArgumentToNameTypeValue(argumentsList, quote, quoteReplace) - functionName = ( + self.functionName = ( text[: positionArgumentsStart - 1] .replace("async def ", "") .replace("def ", "") ) - if functionName == "__init__": + if self.functionName == "__init__": self.functionType = "constructor" - elif functionName.startswith("__"): - if functionName.endswith("__"): + elif self.functionName.startswith("__"): + if self.functionName.endswith("__"): self.visibility = "special" else: self.visibility = "private" - elif functionName.startswith("_"): + elif self.functionName.startswith("_"): self.visibility = "protected" else: self.visibility = "public" + if self.functionName.endswith("Event") or self.functionName in ("eventFilter",): + self.eventHandler = True + # Qt event handlers are protected + self.visibility = "protected" + elif self.functionName in ("event",): + self.eventHandler = True + def parseBody(self, text): """ Public method to parse the function body text.