small script to fix Qt4 include headers
authorLars Knoll <lars.knoll@nokia.com>
Sat, 7 May 2011 19:52:08 +0000 (21:52 +0200)
committerLars Knoll <lars.knoll@nokia.com>
Sat, 7 May 2011 19:52:08 +0000 (21:52 +0200)
The script goes through all includes of the style of
and changes them to <QtWidget/QAction>

Simply run over your source code to get most compile
errors due to classes that moved between different
Qt libraries fixed.

bin/fixqt4headers [new file with mode: 0755]

diff --git a/bin/fixqt4headers b/bin/fixqt4headers
new file mode 100755 (executable)
index 0000000..8546815
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+modules=`ls $QTDIR/include`
+
+files=`find * -name '*.h' -or -name '*.cpp' -or -name '*.C'`
+
+echo $files
+
+for module in $modules; do
+# once we change other things, change the line from == "QtWidgets" to != "Qt" to get everything fixed
+    if [ $module == "QtWidgets" ]; then
+        echo $module ":"
+        includes=`ls $QTDIR/include/$module`
+        for i in $includes; do
+#            echo "    fixing " $i
+            perl -pi -e "s,^#include +<.+/$i>,#include <$module/$i>," $files;
+#            perl -pi -e 's,^#include +".+/$i",#include "$module/$i",' $files;
+        done;
+    fi;
+done;