Hi,

I have the following code;

Qt Code:
  1. void GroupChatViewController::closeEvent(QCloseEvent* event)
  2. {
  3. QMessageBox* msgBox = new QMessageBox(0);
  4. msgBox->setAttribute(Qt::WA_DeleteOnClose);
  5. msgBox->setWindowTitle(tr("Quit Group Chat?"));
  6. msgBox->setText(tr("Are your sure to quit from group chat?"));
  7. msgBox->setIcon(QMessageBox::Question);
  8. QPushButton* yesButton = msgBox->addButton(tr("Yes"), QMessageBox::AcceptRole);
  9. QPushButton* noButton = msgBox->addButton(tr("Cancel"), QMessageBox::RejectRole);
  10. msgBox->setDefaultButton(noButton);
  11. msgBox->exec();
  12.  
  13. if(msgBox->clickedButton() == noButton)
  14. {
  15. msgBox->close();
  16. return;
  17. }
  18. else if(msgBox->clickedButton() == yesButton)
  19. {
  20. if(_groupImSession)
  21. {
  22. if(_groupImSession->_groupImSessionEstablished)
  23. {
  24. _groupImSessionManager->closeGroupImSession(_groupImSession);
  25. }
  26. }
  27.  
  28. QWidget::closeEvent(event);
  29. }
  30. }
To copy to clipboard, switch view to plain text mode 

The message diaolog appears but the problem here is program doesn't advance neither when I click noButton nor yesButton.