Is there a possibility to set a default activated button to "No" instead of "Yes"
QMessageBox::StandardButton reply=QMessageBox::question(this, "Warning ", "This will deleate your data, Do you want to continue ?",QMessageBox::No|QMessageBox::Yes);
if(reply == QMessageBox::Yes){
// Deleate Memory
}
else{
// don't deleate
}
Last parameter of QMessageBox::question is for default activated button. Default value is QMessageBox::NoButton
which means there is no default button. replace it with QMessageBox::No
which means button with "No" label on it. A little bit confusing.
QMessageBox::question(this, "Warning ", "This will deleate your data, Do you want to continue ?", QMessageBox::No|QMessageBox::Yes, QMessageBox::No);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.