add discriminant type

Apparently needs to be cast as an explicit type to get dispatched under Qt 5.
Merge pull request #2 from gjhiggins/master

add discriminant type