From e0fb34194f9ce85f67f158011b4e706835a5667c Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Thu, 24 Sep 2009 17:59:10 +0100 Subject: Implemented QWidget::mapFromGlobal, QWidget::mapToGlobal, for case where child widget owns a native window --- src/gui/kernel/qwidget_s60.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 8667325..912ba1f 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -1216,9 +1216,10 @@ QPoint QWidget::mapToGlobal(const QPoint &pos) const return pos + tp; } - // This is the native window case. Consider using CCoeControl::PositionRelativeToScreen() - // if we decide to go with CCoeControl - return QPoint(); + // Native window case + const TPoint widgetScreenOffset = internalWinId()->PositionRelativeToScreen(); + const QPoint globalPos = QPoint(widgetScreenOffset.iX, widgetScreenOffset.iY) + pos; + return globalPos; } QPoint QWidget::mapFromGlobal(const QPoint &pos) const @@ -1232,8 +1233,10 @@ QPoint QWidget::mapFromGlobal(const QPoint &pos) const return pos - tp; } - // ### TODO native window - return QPoint(); + // Native window case + const TPoint widgetScreenOffset = internalWinId()->PositionRelativeToScreen(); + const QPoint widgetPos = pos - QPoint(widgetScreenOffset.iX, widgetScreenOffset.iY); + return widgetPos; } void QWidget::setWindowState(Qt::WindowStates newstate) -- cgit v0.12