Firstly, what do you mean by “crash”? That is not a technical description for a developer. segmentation fault? Have your tried adding a try...catch block to catch an exception?
Your code looks OK. Most likely it is related to you configuration and build environment. Focus on creating a minimal compilable example to demonstrate your problem, which includes a CMakeLists.txt file and a cxx file. Is the Qt widget really needed?
Also you are using SimpleITK from the C++ interface. How have you compiled SimpleITK? Make options? How is it installed? What OS are you on? Compiler? Version of SimpleITK? etc?