From 199ff9e63dd0fafd9693e6e470ec91a9eebd7ef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 7 Nov 2016 13:36:01 +0100 Subject: [PATCH] [escher] Re layout subviews of menu list view when changing the text of the cell Change-Id: I9d21ffbc7967687f8701f0258501148b5b39fdc0 --- apps/probability/law/law_controller.cpp | 3 +-- escher/include/escher/menu_list_cell.h | 2 +- escher/src/menu_list_cell.cpp | 5 +++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/probability/law/law_controller.cpp b/apps/probability/law/law_controller.cpp index f6656b86d..3e1f76b1b 100644 --- a/apps/probability/law/law_controller.cpp +++ b/apps/probability/law/law_controller.cpp @@ -63,8 +63,7 @@ int Probability::LawController::reusableCellCount() { void Probability::LawController::willDisplayCellForIndex(TableViewCell * cell, int index) { MenuListCell * myCell = (MenuListCell *)cell; - myCell->textView()->setText(m_messages[index]); - myCell->textView()->setAlignment(0., 0.5); + myCell->setText(m_messages[index]); } KDCoordinate Probability::LawController::cellHeight() { diff --git a/escher/include/escher/menu_list_cell.h b/escher/include/escher/menu_list_cell.h index e0df272c4..b98e289fd 100644 --- a/escher/include/escher/menu_list_cell.h +++ b/escher/include/escher/menu_list_cell.h @@ -10,8 +10,8 @@ class MenuListCell : public TableViewCell { public: MenuListCell(char * label = nullptr); - PointerTextView * textView(); virtual View * contentView() const; + void setText(const char * text); void drawRect(KDContext * ctx, KDRect rect) const override; void reloadCell() override; int numberOfSubviews() const override; diff --git a/escher/src/menu_list_cell.cpp b/escher/src/menu_list_cell.cpp index e2b9c22ef..d76236d95 100644 --- a/escher/src/menu_list_cell.cpp +++ b/escher/src/menu_list_cell.cpp @@ -41,8 +41,9 @@ void MenuListCell::reloadCell() { m_pointerTextView.setBackgroundColor(backgroundColor); } -PointerTextView * MenuListCell::textView() { - return &m_pointerTextView; +void MenuListCell::setText(const char * text) { + m_pointerTextView.setText(text); + layoutSubviews(); } View * MenuListCell::contentView() const {