Known Qt bug? Editable QWebPage jumps incorrect distance with page up/down



  • I am using Qt 4.7.4 on Windows. The problem is that as soon as you do page()->setContentEditable(true) in your QWebView control, then the control no longer scrolls correctly when you use the Page Up and Page Down keys. It jumps much too far in the document with each keypress.

    You can replicate this just using the "previewer" example that ships with Qt just by adding this line somewhere in mainwindow.cpp:
    centralWidget->webView->page()->setContentEditable(true);

    Load up a long enough html page. Without this line above (or with "false" instead of "true") the html page will scroll correctly with page up/down. However as soon as that line above is added the scrolling is no longer a "page worth" of content.

    Has anyone else experienced this, and more importantly do they have a fix/workaround?

    Many thanks for your help.



  • I will add while this was improved in Qt 4.8, a major flaw in it still exists for Page Down (still as of 4.8.3). Page Up works correctly.

    The flaw is that if your caret is not on the top line at the time you hit page down, then the web page scrolls 1.x pages, where x is the distance from the top of the view to the caret location. So if you put the caret halfway down the screen and hit Page Down, it will scroll 1.5 screens worth, meaning you completely miss half a screen of content.

    Testing fail...


  • Moderators

    Do you have a "bug report":http://bugreports.qt-project.org/ for this?

    Complaining here will not get anything fixed.



  • As per the thread title, I thought I would try asking the question first as to whether this was a known issue and anyone had a workaround. Given that no-one else has replied I'm guessing the answer to that is no.

    I figured out a filthy workaround today (involving using an event filter to suppress the original Page Down keypress, then posting mouse down/release event messages for the top left of the window before then refiring a keypress message). It works but it shouldn't be necessary. I guess it is the bug report black hole route then...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.