Skip to content

Commit

Permalink
#1756 Remove qan::TableGroupItem::polishLayout().
Browse files Browse the repository at this point in the history
Polish table item layout code. Still WIP, but working.

Signed-off-by: cneben <[email protected]>
  • Loading branch information
cneben committed Sep 5, 2024
1 parent 3d973a2 commit 7c010b2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
23 changes: 1 addition & 22 deletions src/qanTableGroupItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -447,28 +441,13 @@ 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);
}

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()";
Expand Down
7 changes: 0 additions & 7 deletions src/qanTableGroupItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 7c010b2

Please sign in to comment.