Hi,
I have the following code;
void GroupChatViewController
::closeEvent(QCloseEvent* event
) {
msgBox->setAttribute(Qt::WA_DeleteOnClose);
msgBox->setWindowTitle(tr("Quit Group Chat?"));
msgBox->setText(tr("Are your sure to quit from group chat?"));
msgBox->setDefaultButton(noButton);
msgBox->exec();
if(msgBox->clickedButton() == noButton)
{
msgBox->close();
return;
}
else if(msgBox->clickedButton() == yesButton)
{
if(_groupImSession)
{
if(_groupImSession->_groupImSessionEstablished)
{
_groupImSessionManager->closeGroupImSession(_groupImSession);
}
}
}
}
void GroupChatViewController::closeEvent(QCloseEvent* event)
{
QMessageBox* msgBox = new QMessageBox(0);
msgBox->setAttribute(Qt::WA_DeleteOnClose);
msgBox->setWindowTitle(tr("Quit Group Chat?"));
msgBox->setText(tr("Are your sure to quit from group chat?"));
msgBox->setIcon(QMessageBox::Question);
QPushButton* yesButton = msgBox->addButton(tr("Yes"), QMessageBox::AcceptRole);
QPushButton* noButton = msgBox->addButton(tr("Cancel"), QMessageBox::RejectRole);
msgBox->setDefaultButton(noButton);
msgBox->exec();
if(msgBox->clickedButton() == noButton)
{
msgBox->close();
return;
}
else if(msgBox->clickedButton() == yesButton)
{
if(_groupImSession)
{
if(_groupImSession->_groupImSessionEstablished)
{
_groupImSessionManager->closeGroupImSession(_groupImSession);
}
}
QWidget::closeEvent(event);
}
}
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.
Bookmarks