Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove ScrollBars from QWebEngineView or QWebEnginePage

Is there a way to remove scrollbars from QWebEngineView or can i somehow get access to it's ScrollArea?

With webkit it was as easy as

WebView->page()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
WebView->page()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);

but i don't see any similar functionality within QWebEngine. I do not even see any scroll area within qwebengine sources.. Is there a something that i'm missing?

Update: I think i can try to force scrollbars disappear from some css settings that are passed with page for chromium

like image 696
Shf Avatar asked Sep 16 '15 15:09

Shf


2 Answers

Just set QWebEngineSettings::ShowScrollBars to false which is introduced in Qt 5.10

See QWebEngineSettings::WebAttribute

like image 195
MagicKyle Avatar answered Oct 26 '22 21:10

MagicKyle


Changing css style of the webpage worked. I've used

<style type="text/css">
body {
    overflow:hidden;
}
</style>

but bad luck for those, who do not have access for css of the webpage you are trying to show the way you want.

like image 43
Shf Avatar answered Oct 26 '22 21:10

Shf