View Full Version : Problem with styled QPushButton clickable area

12th May 2011, 14:31
I have styled my QPushButton using the following style. Inside the border of the button and in the corners there are large areas that are not clickable (about 4 pixels inside the button outline). Using :hover I can see that Qt thinks the mouse is over the button but when I click, the button is not drawn as pressed and there is no clicked signal. It's only when the mouse is close to the centre of the button that I can register a click.

I have tried experimenting with padding and margins but this hasn't helped. If I remove enough styling so that the widget looks drawn in the native style then the whole button is clickable.

QPushButton {
color: #000000;
background-color: #ffff00;
QPushButton:pressed {
background-color: #4444cc;
QPushButton:hover {
color: #cccccc;

13th May 2011, 12:00
This can't be the only style code for your button.
Show the rest too.

13th May 2011, 14:24
This is the only other styling information I can find, anything else must be set to defaults:

QPushButton:focus { background-color: #9494bb; }
QPushButton:disabled {
background-color: #444444;

13th May 2011, 16:51
I get this *exact* problem and was searching the net for an answer. I'm using 4.7.3, and it only manifests for me on macosx, not windows. Basically, the button responds to hover correctly but it seems like there is a clicking dead space all around the button. It seems to affect QPushButton and QComboBox, but maybe others.

You can take the C++ calculator example, change the Button class to inherit from QPushButton instead of QToolButton, and stick setStyleSheet("background-color:blue;"); in the constructor to reproduce.

19th July 2011, 23:48
Anyone solved this problem? I'm seeing the same thing and am looking for a fix. Only seeing the problem on Mac too. Windows clickable area is just fine.

[UPDATE] Just found this QT open defect:

So it looks like a patch is needed to fix it.