Is it possible to use QPainter and QPaintDevice classes in a console app?

First, I was getting the error "cannot connect to X server" when trying to run the app from a script (which is correct, there is no X server to connect to)

When I rebuild the program as a console app using QCoreApplication instead of QApplication I get a segfault when accessing these classes.

Why do I ask?
Because a lot of the documentation points to the possibility that QPainter may not work without X since it may require portions of it at runtime for font rendering etc?
(However, this does seem ridiculous, since a lot of things these classes are useful for, aren't GUI oriented at all)