Results 1 to 5 of 5

Thread: Can we Call a QT Function(VC++) instead of JavaScript function in an HTML page? How?

  1. #1
    Join Date
    Aug 2010
    Posts
    8
    Thanks
    2
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Windows

    Question Can we Call a QT Function(VC++) instead of JavaScript function in an HTML page? How?

    I want customize my documentation containing html pages and to display them in QT Assistant. I need to implement a function on all the html pages which looks for a particular file in local drive and determine whether it is present or not?

    I was thinking of implementing this functionality using Qt code. Is there a possibility that we could use Qt function written in VC++ instead of a javascript function to perform the mentioned task?

    I have a little knowledge of html and javascript. But, i have tried a javascript function too but it just didn't get called when implemented and assistant is invoked from command line.

    Thanks In Advance. Please comment.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Can we Call a QT Function(VC++) instead of JavaScript function in an HTML page? H

    You can expose QObject properties, slots and signals in the QtWebKit browser scripting environment using The QtWebKit Bridge. Qt Assistant uses this browser component but you would have to make a modified version of Assistant in order to plug in and expose your functionality. (Not sure if the compiled docs support JavaScript at all though)

    Why does documentation need to know about files outside the docs?

  3. #3
    Join Date
    Aug 2010
    Posts
    8
    Thanks
    2
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Can we Call a QT Function(VC++) instead of JavaScript function in an HTML page? H

    Thanks Chris for your suggestion i will go through the QTWebKit and QTWebKit Bridge Documentation. Meanwhile, if you can provide me some example regarding the same that would be great.

    I want that function to first look for a requested file(currently opened html) in local drive at a specific location and if it is present there i will open it locally otherwise it would be downloaded from the server. So, that user wouldn't have to bother for internet access everytime he reads the documentation.

    If there are any other easy way to implement it. please keep your comments coming. Thanks in Advance.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Can we Call a QT Function(VC++) instead of JavaScript function in an HTML page? H

    You are talking about your docs being a bunch-o-files in a folder on the disc: this is not the same as Qt Assistant in which all the pages are shipped in one Sqlite database.

    You can do this using a handler for a custom url scheme handler (e.g. docs://... rather than http://) for a QNetworkAccessManager you attach to your browser component. I expect this is how the qrc:// scheme and Assistant's qthelp:// is done. See http://doc.qt.nokia.com/qq/32/qq32-w...protocols.html for the basic framework. I have done something like this to support an offline tile map cache: it does not take a lot of code. If you are careful to use relative links within your docs it could be browsable from a standard browser directly (useful for docs authoring) or through the embedded WebKit browser (indirectly).

    It is, of course, easier just to ship the docs with the product.

  5. #5
    Join Date
    Aug 2010
    Posts
    8
    Thanks
    2
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Can we Call a QT Function(VC++) instead of JavaScript function in an HTML page? H

    You are talking about your docs being a bunch-o-files in a folder on the disc: this is not the same as Qt Assistant in which all the pages are shipped in one Sqlite database.

    No. I am generating all the .qch files and including them in .qhc to display the help in the QT Assistant.

    I think QTWebKit and QTWebKitBridge is the way to do it.

    Thanks Chris.

Similar Threads

  1. Call a JavaScript function from C++ using QtWebkit
    By Rastersoft in forum Qt Programming
    Replies: 9
    Last Post: 14th May 2014, 12:03
  2. Javascript Function execution in html page
    By saeedIRHA in forum Newbie
    Replies: 6
    Last Post: 17th October 2011, 13:01
  3. Pass data from QT to javascript function
    By thanhluanbk88 in forum Qt Programming
    Replies: 3
    Last Post: 3rd March 2011, 10:40
  4. Replies: 7
    Last Post: 9th December 2010, 22:26
  5. Replies: 2
    Last Post: 15th November 2010, 05:17

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.