From 7c010b24bb963192b88e68dd0310f8151486094f Mon Sep 17 00:00:00 2001 From: cneben Date: Thu, 5 Sep 2024 12:27:18 +0200 Subject: [PATCH] #1756 Remove qan::TableGroupItem::polishLayout(). Polish table item layout code. Still WIP, but working. Signed-off-by: cneben --- src/qanTableGroupItem.cpp | 23 +---------------------- src/qanTableGroupItem.h | 7 ------- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/src/qanTableGroupItem.cpp b/src/qanTableGroupItem.cpp index 00ea6002..59451fe6 100644 --- a/src/qanTableGroupItem.cpp +++ b/src/qanTableGroupItem.cpp @@ -412,10 +412,6 @@ void TableGroupItem::layoutTable() { if (!isEnabled()) return; // Note 20240830: prevent spurious layouts during serialization (see hlg::TableGroup::serializeFromJson()). - // Adapt to a new (width, height), keep previous rows/columns ratio - // New position is: - // x = previousX * (actualWidth / previousWidth) - // y = previousY * (actualHeight / previousHeight) const auto tableContainer = getContainer(); if (tableContainer == nullptr) return; @@ -432,12 +428,10 @@ void TableGroupItem::layoutTable() qWarning() << "TableGroupItem::layoutTable(): " << getGroup()->getLabel() << " tableWidth=" << tableWidth << "tableHeight=" << tableHeight; + // Project normalized sx/sy coordinates to table item container CS. for (const auto verticalBorder: _verticalBorders) { if (verticalBorder == nullptr) continue; - // FIXME #1756 - //const auto previousX = verticalBorder->x(); - //verticalBorder->setX((previousX / _previousSize.width()) * tableWidth); verticalBorder->setX(verticalBorder->getSx() * tableWidth); verticalBorder->setY(0.); verticalBorder->setHeight(tableHeight); @@ -447,9 +441,6 @@ void TableGroupItem::layoutTable() if (horizontalBorder == nullptr) continue; horizontalBorder->setX(0.); - // FIXME #1756 - //const auto previousY = horizontalBorder->y(); - //horizontalBorder->setY((previousY / _previousSize.height()) * tableHeight); horizontalBorder->setY(horizontalBorder->getSy() * tableHeight); horizontalBorder->setWidth(tableWidth); } @@ -457,18 +448,6 @@ void TableGroupItem::layoutTable() layoutCells(); } -void TableGroupItem::polishTable() -{ - // FIXME #1756 no longer necessary ???? - - if (!isEnabled()) - return; // Note 20240830: prevent spurious layouts during serialization (see hlg::TableGroup::serializeFromJson()). - const auto tableContainer = getContainer(); - if (tableContainer == nullptr) - return; - layoutCells(); -} - void TableGroupItem::layoutCells() { //qWarning() << "qan::TableGroupItem::layoutCells()"; diff --git a/src/qanTableGroupItem.h b/src/qanTableGroupItem.h index f607d2f6..f4c550f9 100644 --- a/src/qanTableGroupItem.h +++ b/src/qanTableGroupItem.h @@ -96,13 +96,6 @@ public slots: //! Layout current cell after a table geometry change. void layoutTable(); - /*! Layout cells and polish table (ie activate necessary bindings for table resizing). - * This method could be used _after_ serialization of a table when - * group content item is still unsure: it is safer than a complete - * call to layoutTable(). Note: call layoutCells(). - */ - void polishTable(); - //! Layout table cells, triggered when table style change. void layoutCells();