(I’ve decided to follow a more agile workflow: instead of creation a “one post covers the whole topic”-post, to post also updates for each step. Article will be therefore edited while “doing”)
Last week I’ve cleaned Qt-includes for a larger project. Like
#include how it should be. With proper indirection, so that the Qt-library handles how and where the class is implemented.
A colleauge raised the question, why not use
#include to be even more precise and to see the used module directly (needed for the CMakeLists or qmake).
First step: identify all used Qt-includes
$ git grep "include <Q" | cut -d : -f 2 | sort -u
# include <QApplication>
# include <QAtomicInt>
# include <QDebug>
# include <QFileDialog>
# include <QHBoxLayout>
Greps all includes starting with an uppercase Q; then split the result at the “:”; then sort und make it unique
Second step: create a replacement-list and a (python?) script which does this for all .h/.cpp-files