From 2e3a904b9bbb15d89a5d6d2d7409ca5ca28e568a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 26 Dec 2019 14:30:05 +0100 Subject: [PATCH] [escher] TableCell: fix layoutSubview to avoid letting subviews overflow bounds() --- escher/src/table_cell.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/escher/src/table_cell.cpp b/escher/src/table_cell.cpp index 40e70235b..db63a14b3 100644 --- a/escher/src/table_cell.cpp +++ b/escher/src/table_cell.cpp @@ -2,6 +2,8 @@ #include #include +static inline KDCoordinate minCoordinate(KDCoordinate x, KDCoordinate y) { return x < y ? x : y; } + TableCell::TableCell(Layout layout) : HighlightCell(), m_layout(layout) @@ -50,14 +52,14 @@ void TableCell::layoutSubviews(bool force) { k_separatorThickness+k_labelMargin, k_separatorThickness+Metric::TableCellLabelTopMargin, width-2*k_separatorThickness-k_labelMargin, - labelSize.height()), + minCoordinate(labelSize.height(), height)), force); break; default: label->setFrame(KDRect( k_separatorThickness+k_labelMargin, k_separatorThickness, - labelSize.width(), + minCoordinate(labelSize.width(), width), height - 2*k_separatorThickness), force); break; @@ -90,7 +92,7 @@ void TableCell::layoutSubviews(bool force) { accessory->setFrame(KDRect( minX, k_separatorThickness, - accessorySize.width(), + minCoordinate(accessorySize.width(), width - minX), height-2*k_separatorThickness), force); }