Search code examples
pythonpyqtclickfocusqpushbutton

PyQT Buttons do not get focus on first click


I am having a problem with all the QPushButton buttons in my PyQt application.

For some reason, even if the window has focus, the first click on a button will not register (no 'click affect' or button action occurs). Following this, as though it now has focus, I can click the button, or any other button, on the first go. As soon as the focus changes to another non-button widget, again none of the buttons will click on the first attempt.


Solution

  • Update: This issue was present for maybe 4 months. After continuing to try everything I could find online and nothing working, I gave up. After about 2 weeks, the issue randomly disappeared.

    I have not made any intentional changes to package versions, but it's possible the issue was fixed in a minor version update of PySide. It has now been good for a few weeks so I am convinced it is solved :)

    The version of PySide I am currently using is 5.15.1, I'm not sure if this is the same as before but can confirm the issue is not present here