Results 1 to 6 of 6

Thread: Help with QML, JavaScript and C++

  1. #1
    Join Date
    Jan 2011
    Posts
    18
    Thanks
    6
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Help with QML, JavaScript and C++

    Hi,
    Can a C++ file and Qml File Share the same javascript file , if it is possible how Can we do that.

    Thanks,
    Regards.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Help with QML, JavaScript and C++

    Would you care to elaborate? What do you mean "share a javascript file"? How does C++ use javascript files?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    chetu1984 (11th February 2011)

  4. #3
    Join Date
    Jan 2011
    Posts
    18
    Thanks
    6
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Help with QML, JavaScript and C++

    Thanks "Master of Zen" At last someone wanted to answer my question
    I will elaborated as much as i can,

    I am Learning Qt and QML using the Declarative example and out of that i used the Calculator example where the Qml file makes use of Java script File for calculating the values, so in the process of learning i am trying to get the same calculated value form the Java script file to on of the Forms i have in the QT application, so what i tried to do is opening the Qml calculator file on button click on the Qt form and trying to get the calculated value back on to a text box in the Qt form but not on to the display on to the calculator.qml . what i thought is if there is a way that i can make use of same java script file for getting the value to the text box in Qt form. presently i am studying through the documents for integrating Qml and C++. i am still not able to figure out what to do .so if anyone could guide me in the right direction, it would be a great help.

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Help with QML, JavaScript and C++

    If you design your (javascript) code right, you can use QScriptEngine to run a javascript function. This is more or less what QML does behind the scenes anyway.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #5
    Join Date
    Jan 2011
    Posts
    18
    Thanks
    6
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Help with QML, JavaScript and C++

    Okay, Can you please give me an example of right design.... or what it can possible look like.... just the algorithmic part....

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Help with QML, JavaScript and C++

    Just expose the javascript function so that the engine can use it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 9
    Last Post: 29th November 2010, 12:12
  2. getting javaScript from html
    By ashvindh in forum Qt Programming
    Replies: 1
    Last Post: 26th September 2010, 12:57
  3. javascript problem
    By bmn in forum Qt Programming
    Replies: 1
    Last Post: 24th August 2009, 13:40
  4. Javascript
    By ale301168 in forum Qt Programming
    Replies: 0
    Last Post: 6th September 2008, 23:23
  5. JavaScript in QTextBrowser
    By manojmka in forum Qt Programming
    Replies: 4
    Last Post: 27th December 2007, 08:22

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.