The problem is here:
{
BOBSMainWindow w;
w.show();
}
w.show()
is not a blocking call. So you're creating a window, showing it, and then it immediately is destructed when it goes out of scope. You should either declare w
as a member variable or construct it on the heap:
BOBSMainWindow *w = new BOBSMainWindow(this);