mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-08 21:14:14 +02:00
Zoom to content: count only visible items
itemsBoundingRect() also counts hidden items. The text of a single-line wire, and the wire texts hidden by "one text per potential", are never positioned again and can sit far outside the drawing, so Zoom to content zoomed out to include them. On photovoltaique.qet 14 such texts reach x = -729 and the zoom covered 2421x924 instead of 1135x648. Add Diagram::visibleItemsBoundingRect() and use it for Zoom to content, the scene rect and the borderless export. Zoom to content now goes through zoomToRect(), which re-centres after the scroll bars appear; before, the view could stay scrolled to the top-left with part of the content cut off. Fixes #1281 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -479,8 +479,9 @@ void DiagramView::zoomFit()
|
||||
*/
|
||||
void DiagramView::zoomContent()
|
||||
{
|
||||
fitInView(m_diagram -> itemsBoundingRect(), Qt::KeepAspectRatio);
|
||||
adjustGridToZoom();
|
||||
const QRectF content = m_diagram->visibleItemsBoundingRect();
|
||||
if (!content.isNull())
|
||||
zoomToRect(content);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user