Results 1 to 4 of 4

Thread: how to transfer javascript string array to qt with qtwebkit

  1. #1
    Join Date
    Aug 2010
    Posts
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Question how to transfer javascript string array to qt with qtwebkit

    var ar = new Array("one", "two");

    plugin.do(ar);

    qt object

    class plugin:QObject{
    Q_OBJECT
    public Q_SLOTS:
    void do();
    };

    how to define function "do()" ?

    Thanks

  2. #2
    Join Date
    Aug 2009
    Posts
    11
    Thanks
    1

    Default Re: how to transfer javascript string array to qt with qtwebkit

    Qt Code:
    1. class Plugin : QObject {
    2. Q_OBJECT
    3. public slots:
    4. void do(const QVariantList &params); // in your instance, you use QStringList instead of QVariantList
    5. }
    To copy to clipboard, switch view to plain text mode 

    Read more:
    http://doc.qt.nokia.com/4.6/scriptin...pt-and-c-types
    Last edited by hvitual; 19th August 2010 at 13:17.

  3. #3
    Join Date
    May 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: how to transfer javascript string array to qt with qtwebkit

    Thank you. With QStringList it works

  4. #4
    Join Date
    Oct 2012
    Posts
    2
    Qt products
    Qt4 Qt/Embedded

    Default Re: how to transfer javascript string array to qt with qtwebkit

    Hi.
    I try to do as you

    Qt Code:
    1. class AxBouncer : public QWidget, public QAxBindable
    2. {
    3. Q_OBJECT
    4. public slots:
    5. ...
    6. void setXxx(const QStringList& list);
    7. signals:
    8. void bouncing();
    9. }
    10.  
    11. ...
    12. void AxBouncer::setXxx(const QStringList& list) // or QVariantList
    13. {
    14. emit bouncing();
    15. QMessageBox::information( this, "About QSimpleAX", "This is a Qt widget, and this slot has been\n"
    16. "called through ActiveX/OLE automation!" );
    17. emit bouncing();
    18. }
    To copy to clipboard, switch view to plain text mode 

    javascript:
    Qt Code:
    1. var ar = new Array("123","456","789");
    2. AxBouncer.setXxx(ar[2]);
    To copy to clipboard, switch view to plain text mode 
    it works.

    This code
    Qt Code:
    1. AxBouncer.setXxx(ar);
    To copy to clipboard, switch view to plain text mode 
    Throws the error:
    Qt Code:
    1. QMetaType::registerTypedef: Binary compatibility break
    2. Type name 'QStringList' previously registered as typedef of 'QStringList'[11],
    3. now registering as typedef of 'IDispatch*'[1028]
    To copy to clipboard, switch view to plain text mode 

    bouncing signal does not work at all.
    Qt Code:
    1. function AxBouncer::bouncing()
    2. {
    3. document.title = "Bouncing again!";
    4. alert("Bouncing again!");
    5. }
    To copy to clipboard, switch view to plain text mode 

    window 7, internet explorer 9, Qt 4.8.x and qt-everywhere-opensource-src-5.0.0-beta1, Microsoft Visual Studio 2008 and 2010 + SP1

Similar Threads

  1. QTWebKit, out of control Javascript CPU usage
    By Dkamerad in forum Qt Programming
    Replies: 2
    Last Post: 12th December 2014, 05:01
  2. QtWebKit access HTML manipulated by javascript
    By rbp in forum Qt Programming
    Replies: 1
    Last Post: 19th September 2009, 02:29
  3. QtWebkit and JavaScript error messages
    By Diph in forum Qt Programming
    Replies: 1
    Last Post: 29th April 2009, 11:10
  4. add custom HTML attribute by javascript in QtWebKit
    By sand.fj.wen in forum Qt Programming
    Replies: 3
    Last Post: 17th April 2009, 07:25
  5. String Array
    By Sarma in forum Qt Programming
    Replies: 1
    Last Post: 13th May 2006, 07:53

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.