Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt close a running window through code

Tags:

c++

window

qt

I have a program that opens another window and i want the old window to close. Is there some function or something that would close the window through the code but keep the other window running?

like image 730
tyty5949 Avatar asked Jul 31 '12 21:07

tyty5949


People also ask

How do I close a window in Qt?

Detailed Description. Close events are sent to widgets that the user wants to close, usually by choosing "Close" from the window menu, or by clicking the X title bar button. They are also sent when you call QWidget::close() to close a widget programmatically.

How do I close a widget in Qt?

The qwidget has a promoted widget. The promoted widget has a number of labels and buttons. One of the buttons is a home button. On clicking this button the user needs to close the form and open the home form.

How do you remove minimize and maximize button in Qt?

To turn off the Maximize Button on the default windows, set the max size of your Window on your Ui file. You will notice the Maximize button is greyed out when you run your program.


1 Answers

this->close();

or

close();

Ref: http://doc.qt.digia.com/4.7/qwidget.html#close

like image 140
nandan Avatar answered Sep 18 '22 08:09

nandan