View Full Version : Incorrect position of QPushButton on mac

24th February 2011, 14:52
I am using Qt 4.7.1 on both mac and windows (downloaded from the binary packages), and am seeing a problem on mac with the layout and positioning of the QPushButton widget.

Occasionally buttons will be placed in the wrong position, looking like they are incorrectly vertically offset by half their height.

I've attached a screenshot to show what I mean:

Has anyone seen this issue?

I think it may be related to the behaviour of Qt on mac that converts small buttons from rounded to square, maybe I should be setting the minimum size for these buttons?


27th February 2011, 10:01
Please show us your code for building the layout containing those buttons.

1st March 2011, 12:27
I've recreated the problem in a small QtCreator project, and attached it to this post.
Also heres a screen shot of the problem again, recreated in this test app.



The button itself is layed out in a custom widget class. This widget is then added to a dock widget.

The bug happens only when that dock is floating. Once you dock it into the main app window, the button reverts to being 'square' is not cut off any more.
Whats odd is that, if you edit the code so that the dock is docked in the main app window by default, it gets layed out properly (both when docked and when floating)! Plus the button is rendered 'rounded' when docked!

1st March 2011, 13:53
What happens if you add the dock widget manually and not with Designer?

1st March 2011, 18:34
If I create the dock widget programmatically instead of through the QtCreator template, then the same problem happens.

I guess its time to support a bug report to Qt; I was hoping it was something I was doing wrong, so I could fix it quickly!