Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. Qt bridge: how to receive JS objects
Forum Updated to NodeBB v4.3 + New Features

Qt bridge: how to receive JS objects

Scheduled Pinned Locked Moved Qt WebKit
1 Posts 1 Posters 714 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.
  • O Offline
    O Offline
    obs_sergio
    wrote on last edited by
    #1

    I have implemented a simple plugin using @QWebPluginFactory@
    and the Qt bridge.

    The plugin creates an object using my class, when the HTML contains an embedded object with the mime type I defined.

    According to http://qt-project.org/doc/qt-4.8/qtwebkit-bridge.html

    bq. QWebElement
    A signal, slot or property that expects or returns a QWebElement can work seamlessly with JavaScript references to DOM elements. The JavaScript environment can select DOM elements, keep them in variables, then pass them to Qt as a QWebElement, and receive them back.

    So I defined a method in my class, like the following

    @
    void MyClass::method1 (const QWebElement& object)
    {
    [...]
    }
    @

    and another one like

    @
    void MyClass::method2(QObject *object)
    {
    [...]
    }
    @

    But none of them seem to give me access to the Javascript properties and methods of the incoming object, when this object is not an HTML, object.

    For example, using the following Javascript

    @
    myobject = document.getElementById('myobject');

    myargument = new Array();

    myobject.method1(myargument);

    /* The following call errors with 'Error: incompatible type of argument(s) in call to method2(); candidates were
    method2(QObject*) */
    myobject.method2(myargument);
    @

    How can I receive a JS object in the methods I define and have access to its methods and properties?

    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