BUG:346990 Don't crash if no pattern has been selected
This removes the static_cast'ing of resources by using the qt metatype system instead. Now we don't get weird void* pointers pointing into the void.