[webkit-qt] Getting a QWebElement based on mouse position

Lindsay Mathieson lindsay.mathieson at gmail.com
Wed Nov 23 14:24:23 PST 2011


On Wed, 23 Nov 2011 10:39:02 PM Stefan Bogner wrote:
> My first idea was to use page()->frameAt( event->globalPos() )

As you said later, QMouseEvent::pos()  is better, but you really should be 
checking the return value before using it. page()->frameAt() will return a 
NULL if you give it an invalid coordinate which is why your call segfaulted.

A better sequence would be

QWebElement *elem  = page()->frameAt(QMouseEvent::pos() );
if (elem != NULL)
{
	...
}
-- 
Lindsay


More information about the webkit-qt mailing list