qt.webview vs qt.webkit
Posted
#1
(In Topic #1510)
Administrator



But since Trixie (debian 13) will no longer deliver the depended libraries, qt.webkit is no longer on Trixie and neither is the gb-qt-webkit.
For me that was the reason to pick qt.webview component. Less rich in options and quite a different beast to ride.
Today, I was working at the GambOS Software Center. And in there I use qt.webview. It works just fine and I'm pleased with the result. But when I was working on starting the application with elevated rights (it has to install software after all
Now, I've made software before that does this, so it should be a routine. Well, you know how it goes, application launches fine as is, but with elavated right it just wouldn't. I coded, recoded, tested again and again. Nothing worked.
Then I decided to replace my main form with an empty test form. And guess what, it worked (and had worked all that time :shock: ). So, something on my main form was causing trouble.
So, I used the test form to step by step rebuild the form. Add splitter, run appliaction elevated, add ListView, run application elevated, add panel and so on. All kept working untill the very last control I placed. You can guess what that was, yes the webview. Without it all runs fine elevated, with it it will not start.
I then replaced qt.webview webview control with qt.webkit webview control. No code changed. When running this with elevated right all works just fine. This took me the better half of a day, wasting my time…
You can try it, make an application with a qt.webview webview control. Start it as root from terminal and see what happens. Next replace with webview of qt.webkit and try again. I used GambOSLearning as example as it used qt.webview to show you what I mean (see below)
Seems like qt.webview can't load some plugin when running with elevated rights :?
I've tried on my system (Gambas 3.18.4) and on a VM with Gambas 3.19.6+bpo (for GambOS) and both will not work with the qt.webview.
How is this on your system? Do you have the same?
To me it seems like an upstream (qt) bug.
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
Regular

gbWilly said
I the past I always used qt.webkit, a great component to use as a webviewer with a ton of options.
But since Trixie (debian 13) will no longer deliver the depended libraries, qt.webkit is no longer on Trixie and neither is the gb-qt-webkit.
For me that was the reason to pick qt.webview component. Less rich in options and quite a different beast to ride.
Today, I was working at the GambOS Software Center. And in there I use qt.webview. It works just fine and I'm pleased with the result. But when I was working on starting the application with elevated rights (it has to install software after all), all hell broke loose…
![]()
Now, I've made software before that does this, so it should be a routine. Well, you know how it goes, application launches fine as is, but with elavated right it just wouldn't. I coded, recoded, tested again and again. Nothing worked.
Then I decided to replace my main form with an empty test form. And guess what, it worked (and had worked all that time :shock: ). So, something on my main form was causing trouble.
So, I used the test form to step by step rebuild the form. Add splitter, run appliaction elevated, add ListView, run application elevated, add panel and so on. All kept working untill the very last control I placed. You can guess what that was, yes the webview. Without it all runs fine elevated, with it it will not start.
I then replaced qt.webview webview control with qt.webkit webview control. No code changed. When running this with elevated right all works just fine. This took me the better half of a day, wasting my time…![]()
You can try it, make an application with a qt.webview webview control. Start it as root from terminal and see what happens. Next replace with webview of qt.webkit and try again. I used GambOSLearning as example as it used qt.webview to show you what I mean (see below)
elevated.png
Seems like qt.webview can't load some plugin when running with elevated rights :?
I've tried on my system (Gambas 3.18.4) and on a VM with Gambas 3.19.6+bpo (for GambOS) and both will not work with the qt.webview.
How is this on your system? Do you have the same?
To me it seems like an upstream (qt) bug.
I can do some testing tomorrow…it was a holiday here today and I ate way too much food
Posted
Banned
Can't you use desktop.runasroot to do the installing?
Posted
Banned
like this…
Code (gambas)
- '' Install a package from it's name.
- Print "Process already running"
pkexec will open the root password requester to install.
$hProc.Value should be non zero if error occurs.
Program runs as user 1000 so WebView can still use user 1000 environment.
Posted
Administrator



I'm actually using pkexec to start the whole application with elevated rights. The solution I use, I have used before and works perfect for applications that need to do elevated work (so to speak). Before this I used gksudo and that worked fine as well.BruceSteers said
You can use apt from a program as a normal user with pkexec… (pkexec is what Desktop.RunasRoot() uses)
IMHO an application should be able to launch with elevated rights. Synaptic Package Manager is an example of such an application that runs this way and there are more like this. I have build a Configuration Manager that I use to make sure client systems (@the job) are configured the same way for each role they play. It takes me a few click to get a system configured for a specific use after installing it. It means installing specific stuff for the situation, modified configuration files etc. Software takes care of all these processes according to the kind of system I select in Configuration Manager.
But even if writing an application not specifically target to be used elevated, a sudo start it in terminal should work. I have an editor that isn't written specifically to run with elevated rights (in code I mean), but I can sudo start it when needing to edit stuff a regular user can't edit. That should frankly be how it should work.
So, if underlying qt plugins give trouble I see it as a bug in QT (not even in Gambas). I haven't tried gtk3.webview, maybe there the underlying libraries will do the job and it will start. But anyway, qt.webkit can handle it and I'll stick to that for now. Maybe I'll try form.htmlview in a next edition, as it's all local stuff that needs to be shown. For now I wanna start focusing on iso making as I have a working solution with qt5.webkit
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
but i think you'll find synaptic runs an internal process/term for it's apt commands.
when you first run it it does "apt update" so it asks for password then to elevate it's term process.
But it's not launching "itself" with elevated rights, just it's internal terminal that it runs the apt commands through.
That's what i was suggesting.
It's better that way for many reasons. things like Settings.class will use different dir for superuser.
plus other problems (as you are experiencing)
You're just better off running the whole program as normal user and just elevated internal processes.
I don't sudo my editor i just ask for password if needed when saving as root.
Kate (KDEs editor) does it like that now too and no longer allows to be run as root.
but it's your program.
Posted
Regular

gbWilly said
I'm actually using pkexec to start the whole application with elevated rights. The solution I use, I have used before and works perfect for applications that need to do elevated work (so to speak). Before this I used gksudo and that worked fine as well.BruceSteers said
You can use apt from a program as a normal user with pkexec… (pkexec is what Desktop.RunasRoot() uses)
IMHO an application should be able to launch with elevated rights. Synaptic Package Manager is an example of such an application that runs this way and there are more like this. I have build a Configuration Manager that I use to make sure client systems (@the job) are configured the same way for each role they play. It takes me a few click to get a system configured for a specific use after installing it. It means installing specific stuff for the situation, modified configuration files etc. Software takes care of all these processes according to the kind of system I select in Configuration Manager.
But even if writing an application not specifically target to be used elevated, a sudo start it in terminal should work. I have an editor that isn't written specifically to run with elevated rights (in code I mean), but I can sudo start it when needing to edit stuff a regular user can't edit. That should frankly be how it should work.
So, if underlying qt plugins give trouble I see it as a bug in QT (not even in Gambas). I haven't tried gtk3.webview, maybe there the underlying libraries will do the job and it will start. But anyway, qt.webkit can handle it and I'll stick to that for now. Maybe I'll try form.htmlview in a next edition, as it's all local stuff that needs to be shown. For now I wanna start focusing on iso making as I have a working solution with qt5.webkit
Maybe I'm doing something wrong but I can't run any Gambas executable from the terminal as root. Here are some of the results:
gb.gui with NOTHING on the form and no code:
same error as gb.gtk3.webview
gb.gtk3.webview :
"Gtk-WARNING **: 11:15:33.886: cannot open display:"
gb.qt5.webview, gb.qt5.webkit AND gb.qt6.webview gave the same error:
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.
Aborted
Posted
Administrator



In Synaptic I can install something and wait 10 minutes and install again, without a password being asked again, same is in my way of handling it.BruceSteers said
but i think you'll find synaptic runs an internal process/term for it's apt commands.
when you first run it it does "apt update" so it asks for password then to elevate it's term process.
But it's not launching "itself" with elevated rights, just it's internal terminal that it runs the apt commands through.
That's what i was suggesting.
Your suggestion is not the same as it would require to run your code for each individual application installed or removed, so it would require reentering password several times over if you want to install/remove more than one. It's a fine piece of code, don't get me wrong, but just not for my requirements and how I want to see it happening.
And, as I already said, it's working, just not with qt.webview, but with qt.webkit. And I plan on looking into modifying it to form.htmlview, as it is all local html files that need to be viewed. But that will be for a next release as I have already created the new Gambos file repo, with latest GambOS applications and a newly packaged Gambas 3.19.6+bpo (a few backports, like duplicate classes from 3.20
I started this post as I just wanted to know if maybe, on other desktops, qt.webview has the same issue. It could be a library version thingy for example and might run just fine on a newer distro's with more recent libraries. It was just out of curiosity and to simply know.
"No longer allows" is key here. Yet another choice taken for sake of security, health, comfort, ease of use or whatever other crap they come up with as excuse. I hate the loss of choice.BruceSteers said
Kate (KDEs editor) does it like that now too and no longer allows to be run as root.
But it also implies it used to be possible in Kate. I still do use it regularly, with both gambas and non gambas applications. Did you never run your file browser with sudo, just to browse to a configuration file to double click on it, so editor opens it with elevated rights? Really handy for a quick edit as superuser of some obscure configuration file deep in the system.
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
Administrator



No idea, I create .deb packages and install them, so my end result is in "/usr/bin", a known path when running sudo.rj71 said
Maybe I'm doing something wrong but I can't run any Gambas executable from the terminal as root. Here are some of the results:
Maybe when making an executable you need to give the complete path when running it from terminal.
Code
sudo /path/to/executable/mytest.gambas
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
Regular

gbWilly said
No idea, I create .deb packages and install them, so my end result is in "/usr/bin", a known path when running sudo.rj71 said
Maybe I'm doing something wrong but I can't run any Gambas executable from the terminal as root. Here are some of the results:
Maybe when making an executable you need to give the complete path when running it from terminal.Just a guess, didn't try myself.Code
sudo /path/to/executable/mytest.gambas
I always use the full path when starting a gambas app from the terminal. I actually don't know any other way to do it.
1 guest and 0 members have just viewed this.



