Your code is causing a crash because you are using the pressMeButton pointer in your MainWindow without initializing it first. In C++, using an uninitialized pointer leads to undefined behavior, which most often results in an immediate application crash (termination).