Menu

QWebView widget

Anonymous
2016-01-30
2016-02-05
<< < 1 2 (Page 2 of 2)
  • Stefan Zieker

    Stefan Zieker - 2016-02-02

    Hi Pier,

    I think this is a good idea. But I'm implementing the script debugger for SequenceScripts and CustomConsoleLogScripts at the moment. Therefore you should implement this.

    Best regards,
    Stefan

     
  • Anonymous

    Anonymous - 2016-02-02

    Hi Stefan,
    it is OK for me.
    Kindest regards,
    Pier Andrea.

     

    Last edit: Anonymous 2016-02-02
  • Anonymous

    Anonymous - 2016-02-02

    Hi Stefan,
    I've extended the WebView component with the following routine:

    webView.execute(Qstring);
    

    callable from the WebView component in this way:

    <script>webView.execute("Hello from WebView JS!!!!");</script>
    

    the corresponding signal is available to the WebView component:

    function executeScript(value)
    {
        scriptThread.appendTextToConsole(value);//"Hello from WebView JS!!!!" 
    }
    
    UI_webView.executeSignal.connect(executeScript);
    

    Unfortunatly, to return a value to the WebView component is possible but not so easy to implement. I'll try but is not so important at moment.
    Now we have a bi-direction communication system between SC and the WebView component.

    Kindest regards,
    Pier Andrea.

    ps: you may change the name of the callable routine and the signal if this is not good in relationship with your standard.

     

    Last edit: Anonymous 2016-02-02
  • Stefan Zieker

    Stefan Zieker - 2016-02-02

    Hi Pier,

    this sounds good me. I will integrate this into the official SC source this weekend (I'm busy the next 3 days).

    Best regards,
    Stefan

     
  • Anonymous

    Anonymous - 2016-02-02

    Hi Stefan,
    I'm busy too, we will update during the weekend.
    Kindest regards,
    Pier Andrea.

     
  • Anonymous

    Anonymous - 2016-02-02

    Hi Stefan,
    the last update for Today. I've modified the argument from QString to QStringList in the webView.execute() routine; Now both of the following formats are supported:

    <script>webView.execute("hello world"); 
    <script>var a=[]; for(i=0;i<100;i++)a.push(i);webView.execute(a); </script>
    

    with the SC routine:

    function executeScript(value)
    {
        for(i=0;i<value.length;i++)
        scriptThread.appendTextToConsole(value[i]);
    }
    
    UI_webView.executeSignal.connect(executeScript);
    

    Now the inter-communication offers more flexibility.

    Kindest regards,
    Pier Andrea..

     

    Last edit: Anonymous 2016-02-02
  • Anonymous

    Anonymous - 2016-02-03

    Hi Stefan,
    In attachemnt a tiny JSEditor made with the popular package editarea. (http://www.cdolivet.com/editarea/). Good the interaction with SC. Unfortunatly the syntax highlighting seems to work no so well.
    Kindest regards,
    Pier Andrea.

     

    Last edit: Anonymous 2016-02-03
  • Stefan Zieker

    Stefan Zieker - 2016-02-03

    nice

     
  • Stefan Zieker

    Stefan Zieker - 2016-02-04

    Hi Pier,

    I have integrated your changes into the official example and changed following:
    - renamed the executeSignal to callWorkerScriptSignal
    - changed the QStringList argument to QVariant (now you call the function with every possible data type (mixed Arrays too) )
    - removed the MyApi class
    - changed the GUI

    Best regards,
    Stefan

     

    Last edit: Stefan Zieker 2016-02-04
  • Anonymous

    Anonymous - 2016-02-04

    Hi Stefan,
    I've finished the JSEdit example and now it seems to work well.
    I'll try the new version of the WebView component ASAP.
    Kindest regards,
    Pier Andrea..

     
  • Anonymous

    Anonymous - 2016-02-04

    Hi Stefan,
    Much elegant. I have to learn more about signal and slots!
    In attachemnt JSEditor adapted to the last version of the WV component.
    Kindest regards,
    Pier Andrea.

     

    Last edit: Anonymous 2016-02-04
  • Stefan Zieker

    Stefan Zieker - 2016-02-04

    Hi Pier,

    your ScriptWebView idea is really powerfull!

    Best regards,
    Stefan

     
  • Stefan Zieker

    Stefan Zieker - 2016-02-04

    Hi Pier,

    I have changed the WV a little bit. Now you can return a value from the worker script (callWorkerScriptSignal).

    Best regards,
    Stefan

     

    Last edit: Stefan Zieker 2016-02-04
  • Anonymous

    Anonymous - 2016-02-04

    Hi Stefan,
    You are great, I've tryed for hours to obtain this result and now...I'm studying your code.
    The idea is great, unfortunatly the intrinsically asyncronous nature of QT makes this solution significantly slower than the previous and potentially expose to stackoverflows (as in the picture after moving too much the sliders).
    This routine is great for synchronizing the WV-JS with the SC-JC code but you could obtain the same effect by modifying global WV vars directly from SC but for just one or few routine calls.
    I consider your result so amazing that I propose you to DUPLICATE (or OVERLOAD) this routine (as SUBS and FUNCs in Visual Basic):
    1) One routine as in the previous version (async, without return value, no wait time etc)
    2) A second routine(the last version (Synch, with return value, with wait time).
    This means to have two signals.
    In this manner, all potential uses are covered.
    Thank you again, you are very talented.
    Kindest regards,
    Pier Andrea.

     
  • Stefan Zieker

    Stefan Zieker - 2016-02-05

    Hi Pier,

    see attachment.

    Best regards,
    Stefan

     
  • Anonymous

    Anonymous - 2016-02-05

    Hi Stefan,
    the code is incredibly fluid (also the callWorkerScriptWithResult routine). I think that removing the delay completely changed the performance. I think that the VW component is perfect in this form.
    Thank you again for you efforts.
    Yesterdy I've started to work to a new plugIn based on the wkhtmltopdf project
    wkhtmltopdf.org/
    for rendering HTML to PDF or Pictures. In this way we may use SC+WV+wkhtmltopdf as poweful tool for creating documents (test,reports, graphs etc) without ACROBAT or other dependencies.
    At moment I have a command-line tool working well with SC (the only extra dependence is Qt5Svg.dll + SC and WV libs) the idea is to link the component (an extra dll, I suppose) to SC for direct (HTML JSON transfer)/indirect (online HTTP- or file depending-) rendering of HTML documents.
    I'll send you the code ASAP.
    Kindest regards,
    Pier Andrea.

     

    Last edit: Anonymous 2016-02-05
  • Anonymous

    Anonymous - 2016-02-05

    Hi Stefan,
    thank you for the new 4.01 release.
    Kindest regards,
    Pier Andrea

     
<< < 1 2 (Page 2 of 2)

Anonymous
Anonymous

Add attachments
Cancel