Folio-wide crosshair under the mouse (Display menu)

A new option in the Display menu, off by default and kept in the
settings: two thin lines cross the whole folio, inside its border,
through the grid point under the mouse, so that one sees at a glance
whether symbols and terminals are in line, also while dragging them.

They are drawn by the view in drawForeground(), on screen only: no item
is added to the folio, so nothing of them is saved, exported or
printed. Only the strips the lines leave and enter are repainted, and
they go when the mouse leaves the view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DaTweety
2026-10-19 13:20:00 +02:00
parent 4fee464919
commit 3738b3c1d8
7 changed files with 321 additions and 0 deletions
+14
View File
@@ -590,6 +590,19 @@ void QETDiagramEditor::setUpActions()
}
});
//A crosshair across the whole folio under the mouse, to see
//whether symbols and terminals are in line
m_crosshair = new QAction(tr("Folio-wide crosshair"), this);
ShortcutManager::instance().registerAction(m_crosshair, "diagrameditor.crosshair", tr("Diagram editors"), QKeySequence());
m_crosshair->setStatusTip(tr("Show two lines across the whole folio under the mouse, to see whether parts are in line"));
m_crosshair->setCheckable(true);
m_crosshair->setChecked(DiagramView::crosshairShown());
connect(m_crosshair, &QAction::triggered, [this](bool checked) {
DiagramView::setCrosshairShown(checked);
for (DiagramView *view : findChildren<DiagramView *>())
view->viewport()->update();
});
//Snap step for dragged texts, as a fraction of the folio grid
m_text_grid_menu = new QMenu(tr("Text grid"), this);
m_text_grid_menu->setIcon(QET::Icons::Grid);
@@ -1703,6 +1716,7 @@ void QETDiagramEditor::setUpMenu()
menu_affichage -> addAction(m_mode_visualise);
menu_affichage -> addSeparator();
menu_affichage -> addAction(m_draw_grid);
menu_affichage -> addAction(m_crosshair);
menu_affichage -> addMenu(m_text_grid_menu);
menu_affichage -> addAction(m_draw_guides);
menu_affichage -> addAction(m_cell_rulers);