From 02fcc80f09f015b2595cb6e0bd22716f5089c0b6 Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Mon, 23 Sep 2019 12:53:02 +0200 Subject: [PATCH 1/2] Doc: Remote Linux does not store passwords anymore The possibility to store passwords was removed in Creator 4.9. Change-Id: I21e417041077f15fbb364b64f4a5c4e62e92f46a Reviewed-by: Christian Kandeler --- doc/src/linux-mobile/linuxdev.qdoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/src/linux-mobile/linuxdev.qdoc b/doc/src/linux-mobile/linuxdev.qdoc index 7f711192e03..eefce112f1a 100644 --- a/doc/src/linux-mobile/linuxdev.qdoc +++ b/doc/src/linux-mobile/linuxdev.qdoc @@ -66,6 +66,10 @@ authentication. If you do not have an SSH key, you can use the ssh-keygen tool to create it in \QC. For more information, see \l {Generating SSH Keys}. + \note \QC does not store passwords, so if you use password authentication, + you may need to enter the password on every connection to the device, + or, if caching is enabled, at every \QC restart. + To configure connections between \QC and an embedded Linux device and to specify build and run settings for the device: From e20d90d9e34482a7ac63489e4f46678123710663 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 24 Sep 2019 12:13:47 +0200 Subject: [PATCH 2/2] 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 --- src/plugins/help/textbrowserhelpviewer.cpp | 105 +++++++++++++-------- src/plugins/help/textbrowserhelpviewer.h | 6 +- 2 files changed, 73 insertions(+), 38 deletions(-) diff --git a/src/plugins/help/textbrowserhelpviewer.cpp b/src/plugins/help/textbrowserhelpviewer.cpp index 02afab8d4de..6eee633d7f5 100644 --- a/src/plugins/help/textbrowserhelpviewer.cpp +++ b/src/plugins/help/textbrowserhelpviewer.cpp @@ -99,12 +99,14 @@ void TextBrowserHelpViewer::scaleDown() void TextBrowserHelpViewer::resetScale() { - if (m_textBrowser->zoomCount != 0) { - m_textBrowser->forceFont = true; - m_textBrowser->zoomOut(m_textBrowser->zoomCount); - m_textBrowser->forceFont = false; - } - m_textBrowser->zoomCount = 0; + m_textBrowser->withFixedTopPosition([this] { + if (m_textBrowser->zoomCount != 0) { + m_textBrowser->forceFont = true; + m_textBrowser->zoomOut(m_textBrowser->zoomCount); + m_textBrowser->forceFont = false; + } + m_textBrowser->zoomCount = 0; + }); } qreal TextBrowserHelpViewer::scale() const @@ -114,18 +116,20 @@ qreal TextBrowserHelpViewer::scale() const void TextBrowserHelpViewer::setScale(qreal scale) { - m_textBrowser->forceFont = true; - if (scale > 10) - scale = 10; - else if (scale < -5) - scale = -5; - int diff = int(scale) - m_textBrowser->zoomCount; - if (diff > 0) - m_textBrowser->zoomIn(diff); - else if (diff < 0) - m_textBrowser->zoomOut(-diff); - m_textBrowser->zoomCount = int(scale); - m_textBrowser->forceFont = false; + m_textBrowser->withFixedTopPosition([this, &scale] { + m_textBrowser->forceFont = true; + if (scale > 10) + scale = 10; + else if (scale < -5) + scale = -5; + int diff = int(scale) - m_textBrowser->zoomCount; + if (diff > 0) + m_textBrowser->zoomIn(diff); + else if (diff < 0) + m_textBrowser->zoomOut(-diff); + m_textBrowser->zoomCount = int(scale); + m_textBrowser->forceFont = false; + }); } QString TextBrowserHelpViewer::title() const @@ -145,13 +149,11 @@ void TextBrowserHelpViewer::setSource(const QUrl &url) slotLoadStarted(); m_textBrowser->setSource(url); - QTimer::singleShot(0, this, [this, url]() { - if (!url.fragment().isEmpty()) - m_textBrowser->scrollToAnchor(url.fragment()); - if (QScrollBar *hScrollBar = m_textBrowser->horizontalScrollBar()) - hScrollBar->setValue(0); - slotLoadFinished(); - }); + if (!url.fragment().isEmpty()) + m_textBrowser->scrollToAnchor(url.fragment()); + if (QScrollBar *hScrollBar = m_textBrowser->horizontalScrollBar()) + hScrollBar->setValue(0); + slotLoadFinished(); } void TextBrowserHelpViewer::setHtml(const QString &html) @@ -330,24 +332,46 @@ QString TextBrowserHelpWidget::linkAt(const QPoint &pos) return anchor; } +void TextBrowserHelpWidget::withFixedTopPosition(const std::function &action) +{ + const int topTextPosition = cursorForPosition({width() / 2, 0}).position(); + action(); + scrollToTextPosition(topTextPosition); +} + +void TextBrowserHelpWidget::scrollToTextPosition(int position) +{ + QTextCursor tc(document()); + tc.setPosition(position); + const int dy = cursorRect(tc).top(); + if (verticalScrollBar()) { + verticalScrollBar()->setValue( + std::min(verticalScrollBar()->value() + dy, verticalScrollBar()->maximum())); + } +} + void TextBrowserHelpWidget::scaleUp() { - if (zoomCount < 10) { - zoomCount++; - forceFont = true; - zoomIn(); - forceFont = false; - } + withFixedTopPosition([this] { + if (zoomCount < 10) { + zoomCount++; + forceFont = true; + zoomIn(); + forceFont = false; + } + }); } void TextBrowserHelpWidget::scaleDown() { - if (zoomCount > -5) { - zoomCount--; - forceFont = true; - zoomOut(); - forceFont = false; - } + withFixedTopPosition([this] { + if (zoomCount > -5) { + zoomCount--; + forceFont = true; + zoomOut(); + forceFont = false; + } + }); } void TextBrowserHelpWidget::contextMenuEvent(QContextMenuEvent *event) @@ -429,6 +453,13 @@ void TextBrowserHelpWidget::mouseReleaseEvent(QMouseEvent *e) QTextBrowser::mouseReleaseEvent(e); } +void TextBrowserHelpWidget::resizeEvent(QResizeEvent *e) +{ + const int topTextPosition = cursorForPosition({width() / 2, 0}).position(); + QTextBrowser::resizeEvent(e); + scrollToTextPosition(topTextPosition); +} + void TextBrowserHelpWidget::setSource(const QUrl &name) { QTextBrowser::setSource(name); diff --git a/src/plugins/help/textbrowserhelpviewer.h b/src/plugins/help/textbrowserhelpviewer.h index 52d5b7ce2b1..715df1718e1 100644 --- a/src/plugins/help/textbrowserhelpviewer.h +++ b/src/plugins/help/textbrowserhelpviewer.h @@ -95,14 +95,18 @@ public: void setSource(const QUrl &name) override; + void withFixedTopPosition(const std::function &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;