PDA

View Full Version : close window but do not exit application



madhukumar
5th February 2014, 16:59
how to close window without close application

sakya
5th February 2014, 17:11
setQuitOnLastWindowClosed(bool quit) (http://qt-project.org/doc/qt-5/qguiapplication.html#quitOnLastWindowClosed-prop)

high_flyer
5th February 2014, 17:11
there is a way, but what would be the point?
Is there another way to communicate with the application?

d_stranz
6th February 2014, 00:00
how to close window without close application

Are you sure mean "close" and not "minimize"? Clicking the "X" at the top right of the window frame (in Windows, anyway) closes the window. If it is the application's main window, the application will exit. You can override this behavior by calling setQuitOnLastWindowClosed( false ) or by overriding the closeEvent() handler and calling ignore() on the event.

But why would you want to do that? When a user clicks the "X", he expects the application to exit. You are trying to implement something that goes against the normal behavior that every other application follows.

And like high_flyer says, if you do override this behavior, how will the use be able to exit the application? Will you force him to kill it with Task Manager?

madhukumar
6th February 2014, 00:15
i used setQuitLastWindowClosed () function used but it shows the error like

setQuitLastWindowClosed was not declare in the scope

ChrisW67
6th February 2014, 00:19
There is no function setQuitLastWindowClosed() in Qt.

BTW: With your many years of Qt experience in multiple languages and on multiple platforms you should have absolutely no trouble sorting this out.

madhukumar
6th February 2014, 00:21
i used calculator button on the LCD screen on bottom when touched calculator button it shows the calculator menu when again i touched calculator button main screen is closed or LCD screen off
but i want only calculator application close without close LCD screen or main application

ChrisW67
6th February 2014, 00:57
Can I be the first to say, "Huh?"
If this is somehow related to your other threads then add it to those threads, don't start another.

d_stranz
6th February 2014, 01:16
setQuitLastWindowClosed was not declare in the scope

Maybe learning how to use QtAssistant (http://qt-project.org/doc/qt-5/qtassistant-index.html)would help you figure out that the method is really called QApplication::setQuitOnLastWindowClosed() (QGuiApplication in Qt 5).

anda_skoa
6th February 2014, 09:38
Merged the threads and fixed the title

Cheers,
_