qt5.Webview component - how to replicate qt5.WebKit.HitTest method
Posted
#1
(In Topic #1177)
Trainee

Thank you
Posted
Trainee

Posted
Administrator



Hi, a bit late maybe, but nevertheless. I get your pain, I used to have some nice fancy stuff going in qt4 webkit (quite a while ago). Recently I came in need of using webview and since qt5.webkit is slowly being out-phased on several distro's (hasn't been maintained for years and there seem to be security concerns) I decided to have a look at qt5.webview.ask4nix said
if I click inside the Webview element of the gb.qt5.Webview, how can I replicate the behaviour of WebView.HitTest in the older qt5.Webkit component?
Thank you
I can say, that is a whole other beast and compared to qt5.webkit it's like you have no options. But apparently you do, just takes time to figure out as it is yet another on documented component where it is up to us to figure it out
I can help you with one thing, as I wanted to open a link on a webpage in another form, but didn't know how to detect and intercept it. So here is some sample code to figure out a link was clicked and to get the actual url of the link clicked. I will use a qt5.webview control named WebView1 in code below:
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!
- 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!
Posted
Trainee

For years I used Zim Wiki as my go-to personal information manager. But it doesn't do all the things I would like it to do, so I began writing my own (not surprisingly called ask4nix) in Gambas back in about 2015. I started with something based on Moviga Notes by Jornmo which I found on the old forum hosted by Scholzy. Since then I've developed it to manage multiple notebooks, a rather nice and intuitive tagging system (IMHO), attachments and embedded images, and links within and between notebooks. The notes themselves are stored as html and plain text files, and I use an sqlite database simply for holding note metadata and indexing. If the sqlite database becomes corrupted (possible, but unlikely), it can be quickly rebuilt from the content of each note folder. I currently use both my own html editor and an enhanced version of the one by ShordiSoft on Gambas Farm. Both are based on the qt5-webkit. I messed around with the qt5-webview briefly, but given the lack of documentation on it and other more pressing tasks, I decided to take the path of least resistance and continue to code in Gambas 3.18 (Debian Bookworm) which still contains the qt-webkit. I then package my ask4nix app as an appimage, which runs quite well in the likes of Mint, Fedora, Endeavour OS, Manjaro and hopefully Debian Trixie when it's released. I know that sooner or later I will have to bite the bullet and code the html editor with either the qt5-Webview or qt5-TextEdit. But that will have to wait until I have a bit more free time and I can find more complete documentation for the qt5-webview or some example of how to use it at an html editor (I'm just a rank amateur when it comes to coding)
Posted
Administrator



Up to bookworm the dependencies for qtwebkit are available on Debian. As of Trixie it is no longer possible to build the gb.qt.webkit packages as dependencies are no longer available. It will leak down to Ubuntu/LinuxMint future versions as well, as they are based of debian repositories, and it's also happening in other distro's, as you mentioned before.ask4nix said
I then package my ask4nix app as an appimage, which runs quite well in the likes of Mint, Fedora, Endeavour OS, Manjaro and hopefully Debian Trixie when it's released.
So, it is NOT a matter of Gambas, but of distro. The latest OSB repositories, should have webkit packages for ALL distro's that have the available dependencies to build the gb.webkit package, like bookworm.
But I'm afraid webkit is gonna go in future distro's and that is a shame as webview component is rather meager compared to webkit.
It's called progress, losing possibilities and choices. :shock:
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!
- 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!
Posted
Trainee

The AppImage contains all the dependencies needed to run, but has some minor (annoying) inconsistencies in interface font sizes between different distros (even with the same desktop - in my case KDE Plasma ). I can tweak it a bit by providing runtime options for interface fonts, but it's still not the best. However, I can live with that for the moment.
As for a replacement for the old qt-webkit, in addition to the current qt-webview, I think that the TextEdit and GridView/TableView controls are multi-line and html aware. I'm not sure if they might also be 'not-so-easy-to-code' alternatives.
Posted
Administrator



I'm running 3.19.6 on all my systems and will stay there for a while. Besides for myself I also make applications for a company I work for, and that is the main reason I never go with the latest Gambas version, as updates can unexpectedly cripple production environments by introducing new bugs. I even advise people using Gambas in company situations not use latest stable, so stuff keeps working.ask4nix said
Yes, I currently dual boot Manjaro and EndeavourOS, and I might move to Debian Trixie when it is released. None of these provide support for the qt-webkit. So I code in a Debian Bookwork KDE virtual machine (Gambas 3.18), then move the project to a Mint 21 (Gambas 3.19) virtual machine to create the AppImage. Both have Gambas updates set on hold. I know this goes against the best advice on the forum, but for the moment I have no practical alternative.
So, the advise of 'running the latest version is the best advise' would certainly NOT be my opinion for company environments. For own hobby programming it's okay and for testing company software in, that you run in a lower version of Gambas, it's okay too IMHO.
I know, that is because many factors have an influence on how things show on the screen, underlying toolkits, window managers, font types etc all influence the rendering of the end result.ask4nix said
The AppImage contains all the dependencies needed to run, but has some minor (annoying) inconsistencies in interface font sizes between different distros (even with the same desktop - in my case KDE Plasma ). I can tweak it a bit by providing runtime options for interface fonts, but it's still not the best. However, I can live with that for the moment.
No idea what you are trying to achieve here, but you can put html in there, that is true. Another thing is gb.form.htmlview. But it can only show local html files. There is no mechanisms of retrieving a webpage for example, you will have to do that yourself and then show the local downloaded html file. It would give you the freedom of coding the underlying retrieval of html pages and show the in the form.htmlview.ask4nix said
As for a replacement for the old qt-webkit, in addition to the current qt-webview, I think that the TextEdit and GridView/TableView controls are multi-line and html aware. I'm not sure if they might also be 'not-so-easy-to-code' alternatives.
All the best…
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!
- 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!
Posted
Banned
1 guest and 0 members have just viewed this.


