previously, I was trying some code to stop the "while" loop when the window is close. but it didnt work. but i have already taken out them and now i have QTMaiinForm inside the int main(). I complied but still the same problem.