Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. How to test content of a mouse-click in QWebEnginePage?
QtWS25 Last Chance

How to test content of a mouse-click in QWebEnginePage?

Scheduled Pinned Locked Moved QtWebEngine
2 Posts 1 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dcortesi
    wrote on 29 Dec 2014, 03:19 last edited by
    #1

    In an app using QWebView/QWebPage, one can ask the QWebPage for its mainFrame() or currentFrame(), getting a QWebFrame.

    The QWebFrame offers the method hitTestContent(pos) which tells whether the thing at that position is a URL, an image, or something else. I use this in a custom context menu for a QWebPage, to find out if the item right-clicked for the context menu was a URL.

    It seems the QWebEnginePage does not offer access to a frame, or any other way of finding out the content under a mouse click. One can create a custom context menu, but I do not see how to determine if the right-click fell on a URL or not. Is this available?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dcortesi
      wrote on 29 Dec 2014, 17:19 last edited by
      #2

      Let me just add that if you right-click in a Chrome browser window, the context menu is quite different depending on whether you right-click on a link ("Open Link in New Tab," etc), on an image ("Save Image as..." etc), on open text ("Back", "Reload" etc), even different again on an image that is inside a link.

      So the browser code itself certainly has all the details of the target under a right-click. With QWebPage that information is available. I hope that it is available from QWebEnginePage and that I have just overlooked it.

      1 Reply Last reply
      0

      2/2

      29 Dec 2014, 17:19

      • Login

      • Login or register to search.
      2 out of 2
      • First post
        2/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved