The patch fixes wrong positioning for StandardDocumentationView. Steps to reproduce:
- Place such test code into editor:
#include <QWebView> #include <QLabel> #include <QDebug> void test() { QWebView v; v.setUrl(QUrl("https://www.kdevelop.org/")); QLabel l; l.setText("label_text"); qDebug() << "debug_message"; }
- Move cursor to any method and call context help.
- Help view will be shown with wrong position.
- Recall context help for previous place.
- Help view will be shown with right position.
- At any help view show we will see fast scrollbar "jumping" from initial (0) to some final position.
The cause of the problem is:
- Some page is loaded and loadFinished() signal is emitted, then QWebView sets right position inside page.
- After loadFinished() emitting, page JS code finishes it's work and changes font settings (size). This leads to page contents "moving" inside view widget and as a result we have wrong position.
To fix this, first, we disable view painter updates during load to avoid content "flickering" and also to hide font size "jumping". Secondly, we reset position inside page after loading with using standard QWebFrame method scrollToAnchor().