From 237f214fae8c24355379e976d466d669866a9351 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 23 Jan 2017 10:43:57 +0100 Subject: [PATCH] [escher] Adjust tab width to their content Change-Id: I564ff70c9067f4fa5fab332809b2be4cac127f40 --- escher/include/escher/tab_view_cell.h | 1 + escher/src/tab_view.cpp | 17 +++++++++++++---- escher/src/tab_view_cell.cpp | 4 ++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/escher/include/escher/tab_view_cell.h b/escher/include/escher/tab_view_cell.h index 09fefa3e2..c64659b16 100644 --- a/escher/include/escher/tab_view_cell.h +++ b/escher/include/escher/tab_view_cell.h @@ -11,6 +11,7 @@ public: void setName(const char * name); void setActive(bool active); void setSelected(bool selected); + KDSize minimalSizeForOptimalDisplay() override; protected: #if ESCHER_VIEW_LOGGING const char * className() const override; diff --git a/escher/src/tab_view.cpp b/escher/src/tab_view.cpp index 98fc789b2..049958ae5 100644 --- a/escher/src/tab_view.cpp +++ b/escher/src/tab_view.cpp @@ -68,14 +68,23 @@ View * TabView::subviewAtIndex(int index) { } void TabView::layoutSubviews() { - // Simple layout: all tabs have the same length - KDCoordinate tabLength = m_frame.width()/m_numberOfTabs; + KDCoordinate emptyWidth = bounds().width(); for (int i=0; i