| 1041 | |
| 1042 | QWidget *w = qApp->focusWidget(); |
| 1043 | if(w) { |
| 1044 | QRect r = w->inputMethodQuery(Qt::ImMicroFocus).toRect(); |
| 1045 | |
| 1046 | // The ime window positions are based on the WinId with active focus. |
| 1047 | QWidget *imeWnd = QWidget::find(WinQueryFocus(HWND_DESKTOP)); |
| 1048 | if (imeWnd) { |
| 1049 | QPoint pt (r.bottomLeft()); |
| 1050 | pt = w->mapToGlobal(pt); |
| 1051 | pt = imeWnd->mapFromGlobal(pt); |
| 1052 | |
| 1053 | pcp->xLeft = pt.x(); |
| 1054 | pcp->xRight = pt.x() + r.width(); |
| 1055 | // invert Y |
| 1056 | // bottom is exclusive and top is inclusive on Qt |
| 1057 | // bottom is inclusive and top is exclusive on OS/2 |
| 1058 | pcp->yBottom = imeWnd->height() - pt.y(); |
| 1059 | pcp->yTop = pcp->yBottom + r.height(); |
| 1060 | } |
| 1061 | } |
| 1062 | |