From 47ae1acdd9b6caaa8626e58fc97888dfdc821fe1 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 28 Jan 2011 13:36:27 +0100 Subject: Cocoa/Alien: fix qgraphicseffectsource autotest The test discovered a serious bug where we for alien widgets on mac returned a zero sized paintdevice. The reason is that we used to ask the nsview backing the widget for its size, but with alien, there where no such view. Very strange that this was not seen visually for any of the many applications tested. This patch does the same implementation strategy as found in QWidget::metric in qwidget_x11.cpp --- src/gui/kernel/qwidget_mac.mm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 1a1bb6e..3ba12cd 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -4858,16 +4858,19 @@ int QWidget::metric(PaintDeviceMetric m) const case PdmWidthMM: return qRound(metric(PdmWidth) * 25.4 / qreal(metric(PdmDpiX))); case PdmHeight: - case PdmWidth: { + case PdmWidth: #ifndef QT_MAC_USE_COCOA - HIRect rect; + { HIRect rect; HIViewGetFrame(qt_mac_nativeview_for(this), &rect); -#else - NSRect rect = [qt_mac_nativeview_for(this) frame]; -#endif if(m == PdmWidth) return (int)rect.size.width; return (int)rect.size.height; } +#else + if (m == PdmWidth) + return data->crect.width(); + else + return data->crect.height(); +#endif case PdmDepth: return 32; case PdmNumColors: -- cgit v0.12