Problems with setScrollBarPolicy in QwebView
-
Hi All,
There's an application running on an embedded device which uses QWebView(actually, a class derived from QWebView to be more precise). Now, in the constructor of that class the scrollbarpolicy is being set to "As needed"
@
page()->currentframe()->setScrollBarPolicy(Qt::Horizontal,ScrollBarAsNeeded);
page()->currentframe()->setScrollBarPolicy(Qt::Vertical,ScrollBarAsNeeded);
@So now when we try to load a page, the scrollbars show up(or dont show up) depending on the size of the web page. All fine up to here.
Now, we have an OSK (OnScreenKeyboard) kind of thing that comes up whenever a user activates an input control. This OSK covers the half screen.
Now as per the design requirement, we are required to hide the scrollbars when the OSK is up and showing.
For this I put some checks at places where the OSK gets to show up, to set the scrollbar policy to AlwaysOff. And when I am done with the OSK and close it ...at that place I am again setting the policy to AsNeeded.
The problem here is that when the OSK gets closed, the scroll bars still do not appear, even when the page is too big to fit in the viewport.The slightest mention of the scrollbar is done only at 3 places:
- Constructor
- When OSK is activated
- When OSK is closed
I am not able to understand what code I am missing which results in scrollbar not getting displayed, once it has been hidden and then tried to get displayed again.
Could anyone please be so kind to help me on this.
Not sure whether I am right, but I kind of doubt, is getting the current frame from the page, the right widget to set the scrollBarPolicy.
Sorry for the lengthy post, but I am working for the first time on Qt and QWebkit.[EDIT: code formatting, please use @-tags, Volker]
-
Not sure but it sounds like.. the policy is changed but the WebView has no need to check for the scrollbar policy until a page load or content change or widget resize.. So, the webview needs an update of some sort.. If you reload the page after, the scroll bars show up?
-
Hmm... sometimes it does and sometimes it does not. And since, on the change of OSK status, we do a resize of the widget, I think it should call the update method of the widget. So things should fall into place automatically. Nevertheless, to remove any doubts, I called the update method explicitly, but that too served no purpose.
By the way, much appreciation for your suggestions :-)