Andrei Micu
Andrei Micu

Reputation: 3249

Disabling QGraphicsWebView scrollbars

I want to disable the scrollbars in a QGraphicsWebView. It says in the documentation:

"... if the Web page contents is larger than that, scrollbars will be shown if not disabled explicitly."

I can't seem to find a way to disable the scrollbars.
I need to disable the scrollbars because I want to implement scrolling on drag and I don't want them to be shown.

Upvotes: 2

Views: 453

Answers (2)

Dan Milburn
Dan Milburn

Reputation: 5738

You can set the scrollbar behaviour on QWebFrame. What you probably want is something like:

QWebFrame* frame = webView->page()->mainFrame();
frame->setScrollBarPolicy( Qt::Horizontal, Qt::ScrollBarAlwaysOff );
frame->setScrollBarPolicy( Qt::Vertical, Qt::ScrollBarAlwaysOff );

Upvotes: 6

Paul Fenney
Paul Fenney

Reputation: 1743

The page itself needs to have appropriate CSS to prevent the scrollbars from appearing, e.g. body {overflow: hidden}.

If you don't have control over the page contents, resizesToContents might be the property you're looking for.

Upvotes: 1

Related Questions