Snap a moved multi-part selection to the editor grid too (bugtracker #112)

A selection of several parts is moved by ElementPrimitiveDecorator, which
snapped to a fixed 1-unit step at every zoom. That is the "selection is
big" half of #112: below 100 % one part landed on the 10 grid but a
multi-part selection did not, and at 100-400 % it ignored the grid too.

It now snaps to the editor's current grid, as a single part does; Ctrl
still gives the fine 1-unit step. Resizing and arrow-key moves are
unchanged.

Also from review: add rows just below each zoom threshold to
tst_elementviewgrid (each catches a moved threshold the old rows missed),
and use one grid_step in drawBackground() instead of identical x/y copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-10-02 21:09:24 +13:00
parent 86da56b866
commit a16bac8f84
3 changed files with 21 additions and 8 deletions
+8
View File
@@ -24,6 +24,14 @@ private slots:
QTest::newRow("400 %") << 4.0 << 5 << true << true;
QTest::newRow("800 %") << 8.0 << 2 << true << true;
QTest::newRow("1000 %") << 10.0 << 1 << true << true;
// Just below each threshold: the comparisons are strict (<), so a
// change to <= would move these rows into the next band.
QTest::newRow("99.9 %") << 0.999 << 10 << false << false;
QTest::newRow("399.9 %") << 3.999 << 10 << true << false;
QTest::newRow("401 %") << 4.01 << 5 << true << true;
QTest::newRow("799.9 %") << 7.999 << 5 << true << true;
QTest::newRow("999.9 %") << 9.999 << 2 << true << true;
}
void stepAtZoom()