From c9434ab5a2a4e24c8fd1ea85435fb64f8d88ac94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 27 Oct 2016 10:24:50 +0200 Subject: [PATCH] [apps/calculation] Reinitiate the scrolling when reloading the pretty print view Change-Id: I1975e46cc63109d47223018ca0e09bdc40274573 --- apps/calculation/history_view_cell.cpp | 1 + apps/calculation/pretty_print_view.cpp | 4 ++++ apps/calculation/pretty_print_view.h | 1 + 3 files changed, 6 insertions(+) diff --git a/apps/calculation/history_view_cell.cpp b/apps/calculation/history_view_cell.cpp index b6e2c06f4..e446eb1d6 100644 --- a/apps/calculation/history_view_cell.cpp +++ b/apps/calculation/history_view_cell.cpp @@ -54,6 +54,7 @@ void HistoryViewCell::reloadCell() { m_result.setBackgroundColor(Palette::CellBackgroundColor); m_prettyPrint.setBackgroundColor(backgroundColor); } + m_prettyPrint.reloadCell(); TableViewCell::reloadCell(); layoutSubviews(); } diff --git a/apps/calculation/pretty_print_view.cpp b/apps/calculation/pretty_print_view.cpp index 9c4bf53f5..a34e9da88 100644 --- a/apps/calculation/pretty_print_view.cpp +++ b/apps/calculation/pretty_print_view.cpp @@ -34,6 +34,10 @@ KDSize PrettyPrintView::minimalSizeForOptimalDisplay() { return m_expressionView.minimalSizeForOptimalDisplay(); } +void PrettyPrintView::reloadCell() { + setContentOffset({0, 0}); +} + bool PrettyPrintView::handleEvent(Ion::Events::Event event) { switch (event) { case Ion::Events::Event::RIGHT_ARROW: diff --git a/apps/calculation/pretty_print_view.h b/apps/calculation/pretty_print_view.h index 3230d43f5..f7d78e197 100644 --- a/apps/calculation/pretty_print_view.h +++ b/apps/calculation/pretty_print_view.h @@ -13,6 +13,7 @@ public: void setBackgroundColor(KDColor backgroundColor); bool handleEvent(Ion::Events::Event event) override; KDSize minimalSizeForOptimalDisplay() override; + void reloadCell(); private: ExpressionView m_expressionView; KDCoordinate m_manualScrolling;