qt - What is the best way to implement a inter-qwebview communication? -


overview:

i trying create poc application mimics webintents-like feature. so, in qt application, create 2 qwebviews launching 2 different webapps. let's call them apps , b.

scenario:

  • main application creates 2 qwebviews each launching app i.e. appa, appb.
  • app programmed fetch data via ajax, automatically.
  • app b needs part of data. appb displays button (html) called . note: since, appa has info, appb invoke javascript api injected it's(appb) dom means of addtojavascriptwindowobject() method call when qwebview launched.
  • app-a completed ajax call , indicates completion in webview.
  • user clicks button in appb,
  • app b invokes javascript api i.e. fetcdata({source: "appa");
  • now control in qt-world:

question: control in context of appb, how should communicate webview in appa -- i.e. appb asks appa: hey appa, please give me data have fetched?

can signals , slots me here? or should use other form of ipc.

i read page: http://qt-project.org/doc/qt-4.8/qtwebkit-bridge.html, still didn't hint solution problem.

another related question: qwebviews created in own threads ?

share|improve question
up vote 0 down vote accepted

can't emit sort of signal appb says, "hey, finished fetching data if wants it" or missing something? happen @ end of appb::fetchdata().

all have after connect interested objects signal.

share|improve answer
    
sorry, there typo in question, fixed that. – karthik apr 18 '13 @ 20:07
    
the appb doesn't need such signal yet. since proof-of-concept. didn't make appa emit "data-ready" "finished-fetching" type signals. user (i.e. me) click button on appb fetch data through qt. done upon seeing qwebview of appa populated fetched data. – karthik apr 18 '13 @ 20:13
    
so in scenario, appb needs handle of webview of appa , call method appb::fetchdata(in qt-cpp). method in turn needs call javascript code of appb's qwebview has data! not totally sure how to accomplish this. – karthik apr 18 '13 @ 20:17
    
since control in mainwindow, simple pass address of appa appb::fetchdata(mywebview* app_ptr), use app_ptr access members of appa need. – phlucious apr 18 '13 @ 20:34
    
if did connect datafetched() signal appa slot in appb, can accomplish same thing in appb's slot using qobject::sender(); – phlucious apr 18 '13 @ 20:36

your answer

 
discard

posting answer, agree privacy policy , terms of service.

not answer you're looking for? browse other questions tagged or ask own question.

Comments