[PyQt] QMessageBox does not get focus

Mads Ipsen mpi at comxnet.dk
Sun Sep 27 16:46:16 BST 2009


Mads Ipsen wrote:
> When I launch a QMessageBox like below, from a QMainWindow the box 
> does not have keyboard focus (its not the active window), implying 
> that the key-shortcuts cannot be used. Any fixes or suggestions?
>
> Mads
>
> QtGui.QMessageBox.warning(self, 'Some title',
>                                self.tr("The document has been 
> modified.\n"
>                                        "Do you want to save your 
> changes?"),
>                                QtGui.QMessageBox.Yes | 
> QtGui.QMessageBox.Default,
>                                QtGui.QMessageBox.No,
>                                QtGui.QMessageBox.Cancel | 
> QtGui.QMessageBox.Escape)
>
Let me rephrase this:

* Run application.py in examples/mainwindows/application
* Type something in the editor window.
* Close the application by pressing the 'cross' in the upper-right 
corner of the application window.
* A QMessageBox appears. It does not have keyboard focus.

If you exit by pressing Ctrl+Q, however, the QMessageBox will have 
keyboard focus.

Mads


-- 
+------------------------------------------------------------+
| Mads Ipsen, Scientific developer                           |
+------------------------------+-----------------------------+
| QuantumWise A/S              | phone:         +45-29716388 |
| Nørresøgade 27A              | www:    www.quantumwise.com |
| DK-1370 Copenhagen, Denmark  | email:  mpi at quantumwise.com |
+------------------------------+-----------------------------+




More information about the PyQt mailing list