[SOLVED] focus problem on Ubuntu when using QMessageBoxes
It looks like there is a bug when running Qt apps on Ubuntu, I don’t know if the bug is on the Qt side or the Ubuntu but I have a feeling that this was not present in past versions of Ubuntu and I do not see this happen on red hat. Im hoping you guys can validate if I am doing something wrong first.
Here is the situation: I push a button on my ui which is connected to a slot. Inside that slot I open a QMessageBox. If i click on the Ok button everything is fine but if i simply click enter without focusing on the message box first the I cannot edit QLineEdits or QSpinBoxes of that ui until i focus another window then come back to it. Here is the slot’s code in my QMainWindow:
- void on_pushButton_clicked(){
- QMessageBox clrMsg;
- clrMsg.setWindowTitle("IRIG-B");
- clrMsg.setText("Are you sure you want to clear the IRIG-B faults?");
- int res=clrMsg.exec();
- //...do my stuff
- }
- }
P.S. I am currently using ubuntu 10.04 LTS. This is easilly reproducable, just add this slot to the MainWindow of a new project and add a pushbutton, qlineedit and qspinbox to the mainwindow form. Start the app, click the pushbutton, click enter , try to edit spinboxes or lineedits->res: can’t edit them with keyboard unless you alt+tab and back first
3 replies
You must log in to post a reply. Not a member yet? Register here!
