Important: Please read the Qt Code of Conduct -

QGraphicswebview and plugin

  • Hi I have one plugin which is basically a subclass of QLineEdit and QPushButton, I am using this in my application which uses QWebView it works great there. In another application we are using QGraphicsWebView and we want to use few of our existing plugin in which are QWidget based so to have these plugin widgets in our QGrpahicsWebView we are using QGraphicsProxyWidget but this is not woking good as the same plugin widget works with QWebView. I am using it same way as it says in documentation that I can set my QWidget to GraphicsProxyWidget, i.e. QGraphicsProxyWidget.setWidget(myPushButton).
    I am unable to get button clicked signal in my javascript function. I am trying to figure out what step did I miss? becausae exact same plugin widget works good with QWebView. I even subclassed QGraphicsProxyWIdget and added the exact same signal "clicked" in hope that it will do that job but even this also does not work.
    Can any one please let me know if I need to do somethign special to get it working.


  • should work to my knowledge, can you post some test code that replicates this problem, someone can dig further

  • Ah I am having almost same problem, but I am not using nay proxywidget.
    can you please let me know when you find some solution?

  • were you able to fix this problem ?? I had similar problem as I said above and i found a solution. Can you try making conection when the whole document gets loaded. I mean you can do your connect after onload()

  • I am unable to see onload() function any where in QtAssistant, do you by any chance mean loadFinished() signal? Please note that I am not using QWebView and my plug-in widgets are all QPushButton.

  • onload() function is not in Qt Assistant because it is not Qt api, I am talking about JavaScript onload.

    You can add your event listener and connect all your signals in that, thats the way all signals will be initialized. you can do like this


    function myFunction()
    myObject.mysignal.connect(alert("Hello world I got my signal"));

    update: it is like in body element you put onLoad=myFunction()

  • Thank you immii This does the trick, as well I exported my QWebPage object and did the connection for other plugin object against the signal of QWebPage::loadFinished(), that also works, I am kind of confuse now which approach is better and which one should I keep in my code. Qt Assistant does talk about loadFinished() but no where I found any thing which talks about onLoad() in body element so I am stickging wint loadFinished at the moment.

  • Well that is possible, but not guaranteed in my opinion because what if the initialization for the loadFinished() signal fails, then all of your other signals which you are connecting against this will also fail. So If I were you I would have gone with onLoad().

Log in to reply