From qt.webkit to gt.webview problem

Post

Posted
Rating:
#1 (In Topic #1452)
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’
gbWilly leads the usergroup ‘GambOS Contributor’
gbWilly is in the usergroup ‘Blogger’
I've an older simple project that is still using qt5.webkit.
As this component is deprecated and we're not even able to package it anymore on debian 13 (upcoming new stable) I decided it's time to move to qt5.webview instead.

When I changed the component from qt5.webkit to qt5.webview, the newly provided WebView control appeared to be another beast than the previous one.

In qt5.webkit this is what I do to load a markdown file, convert it to html and show it in a WebView control (provided by qt5.webkit)

Code (gambas)

  1. Public Sub Form_Open()
  2.  
  3.   Dim sContent As String
  4.  
  5.   sContent = Markdown.ToHTML(File.Load("./test.md"))
  6.   WebView1.HTML = sContent
  7.  
  8.   Me.Center
  9.   Me.Caption = Application.Name & " - Using webkit"
  10.  

With WebView control provided by qt5.webview this part doesn't work anymore:

Code (gambas)

  1. WebView1.HTML = sContent
The .HTML simply doesn't exist with WebView control provided by qt5.webview.
And I can't seem to find it's equivalent (if that even exists)

How do I get my converted file (in sContent) to show in my WebView?
Documentation is so bad for this, even at the most basic level of explaining a property, event or the likes.

Been reading wiki over and over again, trying, reading some more wiki and so on…
Again, this is going to be something stupid easy I overlooked…  :D

Added is the toy to play with using qt5.webkit. You'll need to change to qt5.webview to see what goes wrong:
Attachment

Enjoy…

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#2
Banned
WebView has methods SetHtml() and GetHtml()

Code (gambas)

  1.  
  2. WebView1.SetHtml(sContent)
  3.  
  4.  
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’
gbWilly leads the usergroup ‘GambOS Contributor’
gbWilly is in the usergroup ‘Blogger’

BruceSteers said

WebView has methods SetHtml() and GetHtml()

Funny thing is I tried:

Code (gambas)

  1. WebView1.GetHtml(sContent)
  2.  
But gambas didn't like that, and said 'too many arguments' as GetHtml seems not to have any arguments.
The inline help and wiki only says: 'Symbol does not exist' if looking for some clarification.
So, how the hell do I know what I can do with it other that try different possible combinations, or dive into the source code.

The same 'Symbol does not exist' is shown for SetHtml, so I never even tried it after trying GetHtml. A rather stupid decision from me in retrospective.
Image

(Click to enlarge)

And webview has a lot of these,  'Symbol does not exist'!
A matter of adding 2 single quotes above the method in source code (if written in Gambas, I didn't check) like this:

Code (gambas)

  1. '' This sets the html content for the webview
  2. Public Sub SetHtml(Value As String)
  3.  
  4.   ..
  5.  
  6.  
Then wiki should load in that stuff and at least show 'This sets the html content for the webview' instead of  'Symbol does not exist'
'The symbol does not exist' is not the correct sentence here and very misleading info as it does exist, just lacks the 2 single quotes before the method that auto generates wiki content for the symbol (unless it's written in C, then I don't know how wiki content get's auto generated)

Anyway,

thank you very much Bruce

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#4
Banned
Yeah GetHtml is for reading in the html from the webview to a variable
Ie.
Dim sPageHtml As String = WebView1.GetHtml()


"Symbol does not exist" looks like a wiki bug. It shouldn't really be trying to find Control.SetHtml it should be specifically looking for WebView.SetHtml
Online now: No Back to the top

Post

Posted
Rating:
#5
Banned

BruceSteers said

"Symbol does not exist" looks like a wiki bug. It shouldn't really be trying to find Control.SetHtml it should be specifically looking for WebView.SetHtml

or just page missing.

I just went to the page , logged in, selected "create" that shows the default…

<HIGHLIGHT highlight="html">@{syntax}
@{help}
</HIGHLIGHT>
Hit save and now there's a page.

I requested to Benoit that the wiki automatically show the default page (syntax/help) if no page exists.
I guess it's still not so.
Online now: No Back to the top

Post

Posted
Rating:
#6
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’
gbWilly leads the usergroup ‘GambOS Contributor’
gbWilly is in the usergroup ‘Blogger’

BruceSteers said

I just went to the page , logged in, selected "create" that shows the default…

<HIGHLIGHT highlight="html">@{syntax}
@{help}
</HIGHLIGHT>
Hit save and now there's a page.

I requested to Benoit that the wiki automatically show the default page (syntax/help) if no page exists.
I guess it's still not so.
I've seen what you mean. I have logged in today and I have done above for all the missing WebView symbols, so at least it makes some sense when typing code in IDE.
I've seen that a lot more components seem to have this problem. Wiki can auto generate them if the proper code for inserting the info is not missing. And that seems to be the problem.

I might be at it, now and then, for those I encounter missing when using them, but better would be when Benoit fixes it.
Should it maybe be reported as a bug, to get some results?

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top
1 guest and 0 members have just viewed this.