[Interest] widget rendering (alignment, sizing) issues on OS X

René J.V. Bertin rjvbertin at gmail.com
Wed May 25 17:04:28 CEST 2016


On Wednesday May 25 2016 06:28:27 Adam Light wrote:

Hi Adam,

> In our application, we have the following code in a
> QApplication::eventFilter reimplementation for this exact reason:
> 
> 		case QEvent::ChildAdded:
...
> 					theChildWidget->setAttribute(Qt::WA_LayoutUsesWidgetRect, true);

That's very interesting, I hadn't yet realised there was a way to do this for every widget created.

> We do this on Macintosh and Windows. Testing I did years ago did not show
> any effect on Windows, but without doing this on Macintosh the layouts of
> many of our dialogs do not look very good. The attribute probably doesn't

I find that layouts of cross-platform applications that haven't been tweaked for OS X don't look good in general (as if being rendered in some kind of accessibility mod), but that's most likely not related to this attribute.

> actually need to be set on every widget type, but I didn't notice much harm
> in doing so.

Not even in comboboxes? I checked a few yesterday that in the end turned out to be clipped for other reasons, and they got even more clipped with this attribute set.

> I believe that if you set a style sheet on a widget, then it's style will
> no longer be/derive from QMacStyle on Macintosh. So one solution might be
> not using QWidget::setStyleSheet.

It was my understanding that the problem indeed arises when QMacStyle is not being used, but in my case that wasn't because of style sheets.

R.



More information about the Interest mailing list