Please nominate your Qt Champions for 2021!

QWebView - How to concurrently support panning of an entire web page and elements in the page (e.g. Google Maps)

  • Hi There

    I've run into a bit of an issue related to a whitelist Web Browser my company has been developing / maintaining for one of our product lines. The browser runs on top of Qt 4.8.6, using qtwebkit (Migration to 5.X would be ideal, but the embedded Linux OS we're using is too old to support the newer versions based on our testing, and upgrading to a newer OS is too costly to us / our customers). The primary interface to the browser is a 6x8 touchscreen, mounted inside an aircraft cockpit.

    For sites that have things like scrollable/embedded maps (ex. Google Maps), the users of the browser want the ability to drag the entire page when they are selecting something outside of the map, and drag just the map (without the entire page scrolling) when the map is selected (like most of the popular mobile browsers).

    Thus far, I am able to do one or the other, but not both.

    • When I hook mouse handlers into a QWebView or QGraphicsWebView, I can turn the cursor into a hand and very easily support dragging of the entire web page. However, that inhibits the page's ability to handle the mouse events for when a user is pulling over a map (i.e. When a user drags over a map, it drags the entire page instead of just moving the map).

    • When I don't add in the hooks to handle mouse events, things like maps are scrollable by grapping/dragging them, but of course the user loses the ability to drag the entire page.

    I've tried several good examples on the web:

    ...but they all seem to have the same limitations.

    Right now my the browser uses the later (no full page panning), with scroll bars disabled and a directional-arrow overlay to allow the user to scroll the entire page (as the display size is limited, and scrollbars take up too much space when they are sized large enough for the user to interact with them)...but this is not ideal.

    My Question: Is there any easy way to make it so that the page, and elements in a page, can both be scrolled seamlessly through mouse dragging using the same implementation?

    Thanks! Rob

Log in to reply