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. QML WebEngineView elements integrate in page and scroll
Forum Updated to NodeBB v4.3 + New Features

QML WebEngineView elements integrate in page and scroll

Scheduled Pinned Locked Moved Unsolved QtWebEngine
1 Posts 1 Posters 626 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.
  • R Offline
    R Offline
    red_spider
    wrote on last edited by
    #1

    Hello, I have been suffering from this problem for a long time, maybe someone will help, I will be grateful.
    there is a page where the web element is mounted in this page, but it does not fit the entire area, when you try to scroll, nothing happens in the element area. Everything works when to scroll through the green area (all in the example). The question is how to catch (handle) the WebEngineView focus?

    if scroll green region = all is well
    if mouse cursor in web page = does not scroll
    but left click and swipe works

    example

    import QtQuick 2.12
    import QtQuick.Controls 2.12
    import QtQuick.Window 2.12
    import QtWebEngine 1.8
    Window {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
    
        Flickable{
            id: pageFlickable
            width: parent.width
            height: parent.height
    
            Column {
                anchors.fill: parent
                Rectangle{
                    width: parent.width
                    height: 150
                    color: "#93d905"
                }
                Item{
                    id: descriptionTextForm
                    width: parent.width
                    height: webView.height
    
                    WebEngineView {
                        id: webView
                        x:15
                        y:15
                        width: descriptionTextForm.width - 60
                        settings.focusOnNavigationEnabled: false
    
                        onContextMenuRequested: function(request) {
                            request.accepted = true
                        }
    
                        onHeightChanged: {
                                pageFlickable.contentHeight = webView.height + 150
                        }
    
                        onScrollPositionChanged: {
                           // console.log("scroll: " + scrollPosition.y)
                        }
    
                        onNewViewRequested: function(request) {
                            Qt.openUrlExternally(request.requestedUrl)
                        }
    
                        url: "https://www.qt.io/blog"
                        onLoadingChanged: {
    
                            webView.runJavaScript(
                                        "document.documentElement.scrollHeight;", function (i_actualPageHeight) {webView.height = i_actualPageHeight; });
    
                            if (loadRequest.errorString)
                                console.error(loadRequest.errorString);
                        }
                    }
                }
            }
            ScrollBar.vertical: ScrollBar {
                width: 15
                policy: ScrollBar.AlwaysOn
            }
        }
    }
    
    1 Reply Last reply
    0

    • Login

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