src/eric7/QScintilla/DocstringGenerator/PyDocstringGenerator.py

branch
eric7
changeset 10078
9ebe2183cf49
parent 10057
1e31ca1078ab
child 10439
21c28b0f9e41
--- 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.

eric ide

mercurial