Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML WebChannel - "value updates in HTML will be broken"
Qt 6.11 is out! See what's new in the release blog

QML WebChannel - "value updates in HTML will be broken"

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 1.4k Views 1 Watching
  • 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.
  • S Offline
    S Offline
    Stuart Jones
    wrote on last edited by
    #1

    After a bit of work, I've got WebChannel working from my QML:

    import QtQuick 2.7
    import QtQuick.Window 2.2
    import MyLibrary 1.0
    
    Window {
        width: 1280
        minimumWidth: 1024
    
        height: 960
        minimumHeight: 240
    
        WebEngineView {
            webChannel: myWebChannel
    
            anchors.fill: parent
        }
    
        WebChannel {
            id: myWebChannel
            registeredObjects: [myLibraryObject]
        }
    
        MyLibraryObject {
            id: myLibraryObject
            WebChannel.id: "myLibaryObject"
        }
    }
    

    The HTML:

    <head>
        <script type="text/javascript" src="qrc:///qtwebchannel/qwebchannel.js"></script>
        <script type="text/javascript" src="qrc:///js/modules/myLibrary.js"></script>
    </head>
    

    And the Javascript:

    console.log("myLibrary.js");
    
    window.onload = function() {
        new QWebChannel(qt.webChannelTransport, function (channel) {
            var myLibraryObject = channel.objects.myLibraryObject;
    
            console.log(myLibraryObject.label);
        });
    }
    

    When I run my application, the debug output is full of "Property 'X' of object 'QQuickItem' has no notify signal and is not constant, value updates in HTML will be broken!"

    It refers not only to my custom MyLibraryObject, but also QQuick objects lik QQuickItem and QQuickRectangle.

    I'm also seeing a number of "Don't know how to handle '', use qRegisterMetaType to register it."

    How is this all fixed?

    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