Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Qt C++ QWebView causes the GUI to run slowly.

Tags:

c++

qt

qwebview

When the page loads through QWebView I've noticed that other elements of the program are beginning to run slowly, specifically the GUI.

What is the best solution for addressing this problem?

like image 814
Outsider Avatar asked Nov 27 '25 13:11

Outsider


2 Answers

I can't say I've ever had any appreciable slowdown of the rest of a user interface when using QWebView, even on quite underpowered SBCs. I wonder if there's something else going on that's slowing you down.

Are you getting this problem with all pages you load, or just certain ones?

One idea: you can access the settings object (an instance of QWebSettings) for your QWebView using QWebView::settings(). I'd recommend disabling JS to start with (QWebSettings::setAttribute(JavascriptEnabled, false)), just to see if you're being slowed down by any scripts running behind the page you're trying to display.

like image 184
sam-w Avatar answered Nov 30 '25 03:11

sam-w


I have the same issue, and it's related to having multiple QWebViews visible (in my case 2-3) and having JavaScript-based elements that are slow to render (such as Raphael elements or a ckeditor document). Since QWebKit must be run from the main thread, any slowdowns in rendering the web page will slow down the rest of the GUI user interaction. I'm currently not aware of any way to solve this. It's disappointing that QWebView cannot be put into another thread.

like image 29
Vern Jensen Avatar answered Nov 30 '25 03:11

Vern Jensen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!