PDA

View Full Version : QWebView Win XP: Scroll Bug - Text dissappears / wrong position



nikon
30th January 2014, 14:18
Hello Guys,

i asked the same question in another forum, but i hope no one takes offense by this "double post". It's just to contact maximum amount of people :P If there is a way to solve the problem i'll spread it in the other forum, so people can use the solution aswell.

I'm about to develop a small tool in Ordner to improve the usage of a website by saving some data and automizing some procedures (no, it's not a bot, it's really just a little browser tool).

I thought everything was done but then a received a message from a Windows XP user which i could verify afterwards:

Using a Simple call like:


webview = new QWebView(this);
QDir dir;
QUrl url = QUrl::fromLocalFile(dir.absolutePath().append("//test.htm"));
webview->load(url);


With a test.htm as:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css" media="screen">
#myid {
font-size: 11px;
height: 200px;
overflow: auto;
width: 100%;
}
</style>
</head>

Results in the following:
Due to the fact that the Div's height is busted the div creates an own Scrollbar. In case you put enough Linebreaks after the Div, the QWebView will also display a scrollbar and by scrolling down some serious crazy bugs appear: The text in the Div becomes somehow static, but only the "image of the text" and not the text itself, because you can select the text where it should be, but it's displayed somewhere else. If you remove just enough lines so that the div has no scrollbar, everything works fine.

Just in order to illustrate it, here are three pictures. One is taken before you start scrolling, the second screenshot shows the buggy situation in which the whole content is somehow "shifted" and the third one represents the fact, that you still can select the text where it should be.

I hope you may have an idea how to fix that.

I used QT 5.2.0 with mingw 32 bit under windows 7.

Thanks for your help in advance!

Nikon

Picture #1: Start-View without Scrolling
http://s14.directupload.net/images/140130/pptm2lq7.png
Picture #2: after scrolling
http://s7.directupload.net/images/140130/i2hirpgn.png
Picture #3: after scrolling with text selection
http://s7.directupload.net/images/140130/knbe7h6m.png

Added after 42 minutes:

You could also simply try to visit this page:
http://stackoverflow.com/questions/17060966/restore-scrollbar-position-of-qwebview-after-sethtml

with a qwebview and you'll see the bug aswell :/