summaryrefslogtreecommitdiffstats
path: root/src/interfaceframework/doc/snippets
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@qt.io>2022-10-13 11:32:07 +0200
committerDominik Holland <dominik.holland@qt.io>2022-10-18 09:34:51 +0200
commitf79cdbbaa6969fb3dd92748c7cda71ed0fc5746e (patch)
treee0c549b14638683b39b09744be8215d4fe3eac47 /src/interfaceframework/doc/snippets
parentbfdc561cc3ef050b312d40ed430801f0d5efe73a (diff)
ifcodegen: Add support to load extra jinja filters
In addition to allow a filters.py which can be part of a custom template folder, there is now also a way to load filters from other locations. The extra_filters are configured in the generation yaml file and can load files from other templates or common folders within the template search path. Fixes: QTBUG-107005 Change-Id: I518ff96659a3792fbb2a1d64ffc1d5c40eb69767 Reviewed-by: Robert Griebl <robert.griebl@qt.io>
Diffstat (limited to 'src/interfaceframework/doc/snippets')
-rw-r--r--src/interfaceframework/doc/snippets/filters.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/interfaceframework/doc/snippets/filters.py b/src/interfaceframework/doc/snippets/filters.py
new file mode 100644
index 00000000..31784d61
--- /dev/null
+++ b/src/interfaceframework/doc/snippets/filters.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+# Copyright (C) 2021 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+import json
+import inspect
+
+from qface.idl.domain import Module, Interface, Property, Parameter, Field, Struct
+from qface.helper.generic import lower_first, upper_first
+from qface.helper.qtcpp import Filters
+
+from generator.global_functions import jinja_error, jinja_warning
+from generator.filters import deprecated_filter
+
+def custom_filter(s):
+ jinja_warning("Test calling a function from the ifcodegen within our own filters")
+ return
+
+filters['custom_filter'] = custom_filter