[Qt-interest] New Bee Question: Quiting under following situation

Nathan Carter nathancarter5 at gmail.com
Tue Jun 9 18:04:36 CEST 2009


Rahul,

A signal is not the only thing that can make a slot go off.  If you  
want to call a slot at a certain point in your code, simply call it as  
a function.  That is, you could replace the comment line in your code  
below with the following line.
	qApp->quit();

If you try this and it causes problems in your application because  
quitting at that point is too sudden (e.g., other things need to  
finish up first) then you could always have the quit take place a  
moment later, right before the event loop restarts, with the following  
line.
	QTimer::singleShot( 0, qApp, SLOT(quit()) );

Nathan


>
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com 
> ] On Behalf Of Rahulkumar Tibdewal
> Sent: Tuesday, June 09, 2009 8:18 AM
> To: qt-interest
> Subject: [Qt-interest] New Bee Question: Quiting under following  
> situation
>
> Hi All,
>
> I want to quit a application from the following code.
>
> QMessageBox::StandardButton reply;
> reply = QMessageBox::information(this, tr(“xyz”),tr(“xyz”));
> if(reply == QMessageBox::Ok)
> {
>                 //Some to be done here to close the application.
> }
>
> In the code above, I am having a problem in getting reference of  
> OKButton.
> So I was not able to quit application by using connect (okButton,  
> SIGNAL(clicked), qApp, SLOT(quit()));
>
> Please help me in getting rid of this situation.
>
> Thanks
> Rahul
> DISCLAIMER ========== This e-mail may contain privileged and  
> confidential information which is the property of Persistent Systems  
> Ltd. It is intended only for the use of the individual or entity to  
> which it is addressed. If you are not the intended recipient, you  
> are not authorized to read, retain, copy, print, distribute or use  
> this message. If you have received this communication in error,  
> please notify the sender and delete all copies of this message.  
> Persistent Systems Ltd. does not accept any liability for virus  
> infected mails.
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090609/def3c3c6/attachment.html 


More information about the Qt-interest-old mailing list