PDA

View Full Version : QMessageBox with Enter key



dima
1st May 2011, 10:16
Hi all,

I have code :

QMessageBox k(parent);
k.setText(msg);
k.setStandardButtons(QMessageBox::Ok);
k.setDefaultButton(QMessageBox::Ok);
int r = k.exec();

1.If I press mouse on Ok button , message box close and parent application become enable.

2.If I press Enter from keyboard message box closed but parent application is DISABLE ??!!!

r value in both scenario is 1024.

WHY ?

MasterBLB
1st May 2011, 11:15
beacuse your application seems to have some behavior 'disable on press enter'.And while you are closing QMessageBox by enter key,the first one closes the msg,but next ones provided by autorepeat will be sent to your application.
Please show all your code,then maybe I'll be able to help you better.