Use Qt5 CMake 2.8.12 features.

Also move Widget dependent classes from Core to Widgets. Closes #278.