Allow compiling against a Qt build configured with -no-opengl
I am currently working on running Gwenview on an FreeBSD QEMU instance and have configured my Qt build without OpenGL support since I don't have any 3D graphics support. This change fixes compilation against such a Qt configuration.