Try to fix a build failure on Mac

Users have reported that the build fails on Mac because it tries to reference
Qt's private headers. This fix might (or might not) fix the problem; it's hard
to tell because I don't have access to that platform.

Reported by guruz^mgoetz, bartel and pepijndevos on IRC.