Help/textbrowser: Keep text at the top visible when resizing and zooming

After resizing/zooming scroll to the position of the top element before
the resize. This allows us to remove the hack that delays jumping to the
anchor of an URL as well.

Fixes: QTCREATORBUG-4756
Change-Id: Ife29ba1cd0ad60448052b4d06a5dce7cc6bdf4ed
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2019-09-24 12:13:47 +02:00
parent 02fcc80f09
commit e20d90d9e3
2 changed files with 73 additions and 38 deletions

View File

@@ -95,14 +95,18 @@ public:
void setSource(const QUrl &name) override;
void withFixedTopPosition(const std::function<void()> &action);
protected:
void contextMenuEvent(QContextMenuEvent *event) override;
bool eventFilter(QObject *obj, QEvent *event) override;
void mousePressEvent(QMouseEvent *e) override;
void mouseReleaseEvent(QMouseEvent *e) override;
void resizeEvent(QResizeEvent *e) override;
private:
QString linkAt(const QPoint& pos);
QString linkAt(const QPoint &pos);
void scrollToTextPosition(int position);
int zoomCount;
bool forceFont;