Add adjustable background frame to the element editor

Adds a toggleable, visual-only background frame to help proportion an
element's drawing against a representative folio surface, instead of
guessing against a bare grid. Follows the exact precedent of the
existing hotspot indicator (ElementScene::drawForeground()): drawn by
ElementView::drawBackground(), centered on the same origin, and never
written to the saved .elmt file.

- "Afficher le cadre de fond" toggles the frame on/off.
- "Taille du cadre de fond..." opens a small width/height dialog to
  resize it, defaulting to a representative folio's drawable area
  derived from BorderProperties::defaultProperties() (columns_count *
  columns_width by rows_count * rows_height).
- Both the visibility and the last-used size persist via QSettings,
  the same way the existing grid-dot rendering prefs
  (elementeditor/grid_pointsize_min/max) already do.

Implements the scope proposed in discussion #604.
This commit is contained in:
ispyisail
2026-08-03 11:15:50 +12:00
parent 834495387b
commit a245411f9f
4 changed files with 109 additions and 0 deletions
+13
View File
@@ -598,6 +598,19 @@ void ElementView::drawBackground(QPainter *p, const QRectF &r) {
}
}
}
if (m_scene->backgroundFrameVisible()) {
const QSizeF frame_size = m_scene->backgroundFrameSize();
const QRectF frame_rect(-frame_size.width() / 2.0, -frame_size.height() / 2.0,
frame_size.width(), frame_size.height());
QPen frame_pen(Qt::blue);
frame_pen.setCosmetic(true);
frame_pen.setStyle(Qt::DashLine);
p -> setPen(frame_pen);
p -> setBrush(Qt::NoBrush);
p -> drawRect(frame_rect);
}
p -> restore();
}