From d0e2e71e10d6207a5821fffa854ae586ad55e8bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Fri, 27 Dec 2019 14:20:50 +0100 Subject: [PATCH] [escher] TableCell: fix layoutSubviews --- escher/src/table_cell.cpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/escher/src/table_cell.cpp b/escher/src/table_cell.cpp index af970b305..e2d9f73cf 100644 --- a/escher/src/table_cell.cpp +++ b/escher/src/table_cell.cpp @@ -48,21 +48,29 @@ void TableCell::layoutSubviews(bool force) { if (label) { switch (m_layout) { case Layout::Vertical: + { + KDCoordinate x = k_separatorThickness+labelMargin(); + KDCoordinate y = k_separatorThickness+Metric::TableCellLabelTopMargin; label->setFrame(KDRect( - k_separatorThickness+labelMargin(), - k_separatorThickness+Metric::TableCellLabelTopMargin, - width-2*k_separatorThickness-labelMargin(), - minCoordinate(labelSize.height(), height)), + x, + y, + width-2*x, + minCoordinate(labelSize.height(), height-2*y)), force); break; + } default: + { + KDCoordinate x = k_separatorThickness+labelMargin(); + KDCoordinate y = k_separatorThickness; label->setFrame(KDRect( - k_separatorThickness+labelMargin(), + x, k_separatorThickness, - minCoordinate(labelSize.width(), width), - height - 2*k_separatorThickness), + minCoordinate(labelSize.width(), width-2*x), + height - 2*y), force); break; + } } } View * accessory = accessoryView(); @@ -70,13 +78,16 @@ void TableCell::layoutSubviews(bool force) { KDSize accessorySize = accessory->minimalSizeForOptimalDisplay(); switch (m_layout) { case Layout::Vertical: + { + KDCoordinate x = k_separatorThickness+k_accessoryMargin; accessory->setFrame(KDRect( - k_separatorThickness+k_accessoryMargin, + x, height-k_separatorThickness-accessorySize.height()-k_accessoryBottomMargin, - width-2*k_separatorThickness - k_accessoryMargin, + width-2*x, accessorySize.height()), force); break; + } default: // In some cases, the accessory view cannot take all the size it can KDCoordinate wantedX = width-accessorySize.width()-k_separatorThickness-k_accessoryMargin;