mathgl: support Qt 4 or 5 with option parameter

Fixes #897.
Closes #923.