The printing in Qt5 needs to be included specifying QtPrintSupport

# include <QPrinter>
is no longer enough. With Qt5 one needs:
# include <QtPrintSupport/QPrinter>