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 can I disable the pinch-zoom action in Qt WebEngine 6.5.3
Forum Updated to NodeBB v4.3 + New Features

How can I disable the pinch-zoom action in Qt WebEngine 6.5.3

Scheduled Pinned Locked Moved Unsolved QtWebEngine
2 Posts 2 Posters 709 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.
  • X Offline
    X Offline
    Xiang Zhang
    wrote on last edited by
    #1

    Hello,

    I am using QtWebEngine to display a webpage I built in my Qt application, and I have implemented the following code to prevent the default wheel event behavior in the HTML file:

    window.addEventListener('wheel', function(event) {
        if (event.ctrlKey) {
            event.preventDefault()
        }
    });
    

    This solution effectively disables the pinch-to-zoom feature in desktop browsers like Google Chrome. However, when the page is loaded in Qt WebEngine, specifically on macOS, the pinch-to-zoom feature remains active. During the zoom process, no wheel, touch, gesture, or pointer events seem to be triggered on the window object.

    Could you please provide some guidance on how to properly disable pinch-zoom functionality in Qt WebEngine on macOS?

    Thank you.

    1 Reply Last reply
    0
    • G Offline
      G Offline
      Gabriel Eles
      wrote on last edited by
      #2

      For us it works with:

      // Disable pinch zoom in web browser
      qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-pinch");
      
      1 Reply Last reply
      1

      • Login

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