PyQt Window Focus on right-click

658 views Asked by At

I have a very basic setup.

A main dialog window made with:

dialog = QtGui.QDialog()

Then a couple commands to set it visible:

dialog.setFocus(True) 
dialog.show()
dialog.raise_()
dialog.activateWindow() 
app.exec_()

One of this dialog window widgets has a right-click menu connected. The problem:

A right-clicking on a QtGui.QDialog dialog window (app) does not make it "current" or "active"...

Example Situation: With two app windows open on a screen both placed side-by-side: a web browser on a left and my QtGui.QDialog app on a right. The web browser is currently active (or "in focus"). Moving a mouse over the QtGui.QDialog app. Right-clicking on QtGui.QDialog does not make it active. I would have to left-click on QtGui.QDialog in order to make it active. Question: How can I get a left-click functionality (in term of making the window active) with a right click.

Many thanks in advance!

0

There are 0 answers