[webkit-qt] Information on QGraphicsWebView::inputMethodQuery(Qt::ImMicroFocus)

manish.s.sharma at nokia.com manish.s.sharma at nokia.com
Thu Apr 1 05:01:09 PDT 2010

Hi All,

Need a small information on QGraphicsWebView::inputMethodQuery() / QWbeView::inputMethodQuery implementation. Below is what we are trying to achieve:-

1) QRect rect = QGraphocsWebView::inputMethodQuery(Qt::ImMicroFocus);
2) map rect to QGraphicsView’s, so that we can get the actual position of the rect in QGraphicsView’s coordinate.

Basically we want to know the coordinates of cursor inside a text field in a web page in view coordinates.

Results of above operation:-

1) When I query for Qt::ImMicroFocus to get the cursor position it returns a value which is much larger (even greater than the size of QGraphicsWebView, happens when we have a bigger web page scroll bar gets activate and input filed is at the bottom of the page), I guess this rect returned is relative to the web page loaded inside QGraphicsWebView.

2) We are trying to use this returned Qt::ImMicroFocus to map to QGraphicsView’s co-ordinate. Since the value returned is relative to the loaded page we can’t use this value to map to the view using QGraphicsItem::mapToScene() + QGraphicsView::mapFromScene. 

And from the Qt documentations it looks like the Qt::ImMicroFocus is in widget co-ordinates and this is how it works in QTextEdit also, irrespective of text content ImMicroFocus is always relative to the QTextEdit’s coordinate.

If the microfocus returned is in widget coordinate like in QTextEdit it is easy to map to the scene and to the view. AFAIK there is no way to map the QGraphicsWebView/QWebView’s ImMicroFoucs  returned value to actual view’s position since it is not in QGraphicsWebView’s coordinate ☹.

I feel that it is a incorrect implementation inside QGraphicsWebView/QWebView, or am I missing something very basic? Please help.

(Attaching a small test app for getting the logs of the microfocus.)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: webview.zip
Type: application/x-zip-compressed
Size: 1056 bytes
Desc: webview.zip
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20100401/8767d027/attachment.bin>

More information about the webkit-qt mailing list