mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-04 18:04:14 +02:00
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:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user