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. How can I call C++ function from Internet Explore control's JavaScript context?
Forum Updated to NodeBB v4.3 + New Features

How can I call C++ function from Internet Explore control's JavaScript context?

Scheduled Pinned Locked Moved Qt WebKit
7 Posts 2 Posters 5.7k 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.
  • G Offline
    G Offline
    giselite
    wrote on last edited by
    #1

    I am trying to use Google Earth in Qt program,all the work is started from loading these Html file:
    @
    //This is a html file,I delete angle brackets and other tokens in these file ,it seems make my text fail to post every tiem.
    // script type="text/javascript" src="geMap.js"> script
    //div id="map3d" style="position: absolute; top: 0px; left: 0px; height: 680px; width: 1024px;"
    @
    and in geMap.js,I can call the web browser's method,
    @
    var ge;
    google.load("earth", "1");
    function init() {
    google.earth.setLanguage(en);
    google.earth.createInstance('map3d', initCB, failureCB);
    }

      function initCB(instance) {
          //window.external.JSInitCB(instance);
         ge = instance; 
         ge.getWindow().setVisibility(true); 
          
         //Tell win-form that Earth plug-in have already.
         //winEarthReady();          
                  
         ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO);
      } 
      function failureCB(errorCode) {
          // Do something at here if there's an error
          //window.external.JSFailureCB(errorCode);
      } 
      
      //Appoint initial function of earth plug-in.
      google.setOnLoadCallback(init); 
    

    @
    What I haven't know is QWebView can not support Google Earth Plug-in untill I load my html file use QWebView ,so I have to use Internet Explore ActiveX control instead.The problem is use IE control embedded in QAxWidget is not easy as use QWebView,and what I need is something like the functionality of QWebView's addToJavaScriptWindowObject method to make the IE control or QAxWidget reachable from JavaScript context,It's really stuck me.I have do the trick in MFC program use some macro like DECLARE_DISPATCH_MAP() and BEGIN_DISPATCH_MAP(CMyView, CHtmlView) etc. and call JavaScript function from C++ code use IDispatch interface,I found in Qt program I can call JavaScript function from C++ context use the same approach,but how can I call C++ code from JavaScript context of IE control?
    I really expect some one can give me a little hint,thanks!

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      Please add some more information describing what you want to achieve. Otherwise it's unlikely that you'll get an answer.

      Please add this to your first post, just click on the edit link right to the post, below your avatar/username.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giselite
        wrote on last edited by
        #3

        Sorry,It's my web browser's fault,I just find It lost my text when I submmit my post.Thank you for your kind hearted advice,I will try to reedit in other web browser.Thank you.
        [quote author="Volker" date="1320449962"]Please add some more information describing what you want to achieve. Otherwise it's unlikely that you'll get an answer.

        Please add this to your first post, just click on the edit link right to the post, below your avatar/username.[/quote]

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          [quote author="giselite" date="1320494891"]Sorry,It's my web browser's fault,I just find It lost my text when I submmit my post.Thank you for your kink heat advice,I will try to reeidt in other web browser.Thank you.
          [/quote]

          No problem, this happens from time to time. Hopefully you find your lost text :-) - Enjoy the weekend.

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • G Offline
            G Offline
            giselite
            wrote on last edited by
            #5

            As you might expect,It lost again... Why my IE and Google chrome fighting with me %>_<%.
            It's really a good idear that whenever before you press submit,make a copy! O(∩_∩)O~

            Bad luck ,how can I post my question out?I have try to wite it in my reply,but erery time I submit,it failed... Really make me cry...

            [quote author="Volker" date="1320495807"]
            [quote author="giselite" date="1320494891"]Sorry,It's my web browser's fault,I just find It lost my text when I submmit my post.Thank you for your kink heat advice,I will try to reeidt in other web browser.Thank you.
            [/quote]

            No problem, this happens from time to time. Hopefully you find your lost text :-) - Enjoy the weekend.[/quote]

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #6

              Something really strange is going on here, as your other comments make it through.

              I suggest you test this issue in the "Beta Testing Forum":http://developer.qt.nokia.com/forums/viewforum/5/. Just open a new thread there, stating that you test an issue. I now would post just the first sentence, then add new comments containing just one more paragraph each, until the error shows up again, then remove that paragraph, and add sentence for sentence of that paragraph, then word for word just to boil down at which excact place the error occurs. Maybe this can track down the cause. Also, it can be that you discovered a subtle error in the forums software, as that usually rejects empty posts! The Beta Testing forum is the right place for that, you don't need to bother about "polluting" something there.

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • G Offline
                G Offline
                giselite
                wrote on last edited by
                #7

                Thank you very much,I have got the reason.That's my fault to wrap html file in @-tags,and it seems that the html token can not be write in post text.I will report this to Beta Testing Forum,Thank you very much!
                [quote author="Volker" date="1320499603"]Something really strange is going on here, as your other comments make it through.

                I suggest you test this issue in the "Beta Testing Forum":http://developer.qt.nokia.com/forums/viewforum/5/. Just open a new thread there, stating that you test an issue. I now would post just the first sentence, then add new comments containing just one more paragraph each, until the error shows up again, then remove that paragraph, and add sentence for sentence of that paragraph, then word for word just to boil down at which excact place the error occurs. Maybe this can track down the cause. Also, it can be that you discovered a subtle error in the forums software, as that usually rejects empty posts! The Beta Testing forum is the right place for that, you don't need to bother about "polluting" something there. [/quote]

                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