[webkit-qt] Fwd: Custom Context Menu Events

Mitchell Verter mitchell.verter at gmail.com
Thu Feb 28 17:14:23 PST 2013


Hi all,
I am fairly new to QT and the QT-Webkit, so I was hoping someone could
guide me through this:

====================
I'm trying to think through the problem with the context menus.
The issue is that it gives several different menus, depending on the
context.
A.  Page Contex
.. i.  Forward
.. ii. Reload
..  iii. Back
B.  Image Context
.. i. Copy Image
.. ii.  Save Image
.. iii.  Copy Image Link (?)

The issue is that we want to limit Image context (B) to do only (B.ii)

I am guessing that we would need to do something with:
============================================

 bool <http://qt-project.org/doc/qt-4.7/qml-bool.html>QWebPage

swallowContextMenuEvent(QContextMenuEvent<http://qt-project.org/doc/qt-4.7/qcontextmenuevent.html>
 *
event)

Filters the context menu event, *event*, through handlers for scrollbars
and custom event handlers in the web page. Returns true if the event was
handled; otherwise false.

A web page may swallow a context menu event through a custom event handler,
allowing for context menus to be implemented in HTML/JavaScript. This is
used by Google Maps <http://maps.google.com/>, for example.

Look up this member
<http://qt.gitorious.org/qt/qt/blobs/4.7/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h#line256>in
the source code.

=================================================


How would we retrict it to context (B)?


Someone told me this previously:


[14:52]  so how do i constrain this to only affect the image context menu
[14:54]  QWebPage::hitTestContent(const QPoint &Â pos) and
!QWebHitTestResult::imageUrl().isEmpty()

Thanks for the help!
Mitchell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20130228/284abcb5/attachment.html>


More information about the webkit-qt mailing list