Yes it is perfectly fine if you have only 1 button. If you have 2 buttons, then use ButtonRole QMessageBox::buttonRole ( QAbstractButton * button ) const to check what button has been presssed