aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/snippets_translate/handlers.py7
-rw-r--r--tools/snippets_translate/tests/test_converter.py1
2 files changed, 6 insertions, 2 deletions
diff --git a/tools/snippets_translate/handlers.py b/tools/snippets_translate/handlers.py
index 0e0508a4f..b749f04b8 100644
--- a/tools/snippets_translate/handlers.py
+++ b/tools/snippets_translate/handlers.py
@@ -480,10 +480,13 @@ def handle_methods_return_type(x):
def handle_functions(x):
- re_capture = re.compile(r"^ *[a-zA-Z0-9]+ ([\w\*\&]+\(.*\)$)")
+ re_capture = re.compile(r"^ *([a-zA-Z0-9]+) ([\w\*\&]+\(.*\)$)")
capture = re_capture.search(x)
if capture:
- content = capture.group(1)
+ return_type = capture.group(1)
+ if return_type == "return": # "return QModelIndex();"
+ return x
+ content = capture.group(2)
function_name = content.split("(")[0]
re_par = re.compile(r"\((.+)\)")
par_capture = re_par.search(x)
diff --git a/tools/snippets_translate/tests/test_converter.py b/tools/snippets_translate/tests/test_converter.py
index ced52d26a..073dde6d9 100644
--- a/tools/snippets_translate/tests/test_converter.py
+++ b/tools/snippets_translate/tests/test_converter.py
@@ -331,6 +331,7 @@ def test_functions():
st("QString myDecoderFunc(const QByteArray &localFileName);")
== "def myDecoderFunc(localFileName):"
)
+ assert st("return QModelIndex();") == "return QModelIndex()"
def test_foreach():