summaryrefslogtreecommitdiffstats
path: root/qmake/doc/src/snippets/qmake/replacefunction.pro
diff options
context:
space:
mode:
Diffstat (limited to 'qmake/doc/src/snippets/qmake/replacefunction.pro')
-rw-r--r--qmake/doc/src/snippets/qmake/replacefunction.pro46
1 files changed, 46 insertions, 0 deletions
diff --git a/qmake/doc/src/snippets/qmake/replacefunction.pro b/qmake/doc/src/snippets/qmake/replacefunction.pro
new file mode 100644
index 0000000000..98013ba42d
--- /dev/null
+++ b/qmake/doc/src/snippets/qmake/replacefunction.pro
@@ -0,0 +1,46 @@
+#! [0]
+defineReplace(headersAndSources) {
+ variable = $$1
+ names = $$eval($$variable)
+ headers =
+ sources =
+
+ for(name, names) {
+ header = $${name}.h
+ exists($$header) {
+ headers += $$header
+ }
+ source = $${name}.cpp
+ exists($$source) {
+ sources += $$source
+ }
+ }
+ return($$headers $$sources)
+}
+#! [0]
+
+defineReplace(matchingFiles) {
+ names = $$ARGS
+ files =
+
+ for(name, names) {
+ header = $${name}.h
+ source = $${name}.cpp
+ exists($$header):exists($$source) {
+ files += $$header
+ files += $$source
+ }
+ }
+ return($$files)
+}
+
+names = delegate model view main
+message(Finding all headers and sources from the following list of names:)
+message($$names)
+allFiles = $$headersAndSources(names)
+message(Found: $$allFiles)
+
+message(Finding only matching headers and sources from the following list of names:)
+message($$names)
+matching = $$matchingFiles($$names)
+message(Found: $$matching)