Add jumping to a folio cell such as B13 from Ctrl+G (#1034)

Typing a cell reference into the "Atteindre un élément" popup now offers
"Case B13"; Enter zooms the view onto that cell with one cell of margin.
The cell is read the way the border labels it: row letter(s) then column
number, honouring the "columns start at 0" setting and multi-letter rows
(AA, AB...). Cells outside the folio are not offered.

BorderTitleBlock::cellRect() is the reverse of convertPosition(); a
round trip over every cell of a 30x23 folio, under both column-numbering
settings, returned the same cell for all 1380.

When an element is labelled exactly like the cell (K1), the element stays
first so Enter keeps its old meaning; the cell is listed after it.

DiagramView::zoomToRect() re-centres from a queued call: zooming in makes
the scroll bars appear, and the viewport resize that follows is anchored
under the mouse (setResizeAnchor(AnchorUnderMouse)), which otherwise
scrolls the view away from the cell straight after the zoom.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G2d2Zi8BfrYRPX88zhaoFG
This commit is contained in:
ispyisail
2026-09-26 07:37:38 +12:00
parent 5f0b015186
commit ce0e7e6867
6 changed files with 111 additions and 2 deletions
+17
View File
@@ -385,6 +385,23 @@ void DiagramView::zoomReset()
adjustGridToZoom();
}
/**
@brief DiagramView::zoomToRect
Adjust zoom to fit \a rect, in scene coordinate, in the view.
@param rect
*/
void DiagramView::zoomToRect(const QRectF &rect)
{
fitInView(rect, Qt::KeepAspectRatio);
//Zooming in makes the scroll bars appear, which resizes the viewport
//from a queued call; that resize is anchored under the mouse and
//would scroll away from rect, so center again once it has run.
QMetaObject::invokeMethod(this, [this, rect]() {
centerOn(rect.center());
}, Qt::QueuedConnection);
adjustGridToZoom();
}
/**
Copie les elements selectionnes du schema dans le presse-papier puis les supprime
Copies the selected elements from the diagram to the clipboard and then deletes them