QPushButton being stuck after a clickButton() call

Last edited on

Symptom

Occasionally a call to the clickButton() function for dialog buttons will fail. The button appears pressed down and has not popped back up. This happens randomly and only with Qt 4.3.x.

Explanation

A new QEvent prioritization mechanism was introduced with Qt 4.3. Initially this new feature suffered from a timing-dependent problem leading to events being delivered in the wrong order. In the above case the mouse release event was delivered before the mouse press event.

The problem was fixed in Qt 4.3.4, as the following extract from the Qt Change Notes explains:

* [190356] Fixed a regression from 4.2 where the order of posted
      events with the same priority would be sent out of order.

Workaround

Set the environment variable SQUISH_EVENT_HACK to 1. This will make Squish use a synchronous event delivery mechanism. This will be slightly slower and might have negative side effects elsewhere.

Solution

Upgrade to Qt 4.3.4 or later. Qt technical support may also be able to issue an individual patch for older releases if referred to above problem.