modeleditor: Keep some border around the diagram scene

Change-Id: I09aeaffa0a36048c8a6c8e7787750b08e07f08d5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Jochen Becher
2019-11-10 19:47:56 +01:00
parent be899de35c
commit c37ecdeaf1
2 changed files with 5 additions and 3 deletions

View File

@@ -88,7 +88,7 @@ public:
Q_UNUSED(option)
Q_UNUSED(widget)
QPen pen(QBrush(Qt::gray), 1.0, Qt::DotLine);
QPen pen(QBrush(Qt::lightGray), 1.0, Qt::DotLine);
painter->setPen(pen);
painter->drawLine(QLineF(0.0, 0.0, 20.0, 0.0));
painter->drawLine(QLineF(0.0, 0.0, 0.0, 20.0));

View File

@@ -151,8 +151,10 @@ void DiagramView::dropEvent(QDropEvent *event)
void DiagramView::onSceneRectChanged(const QRectF &sceneRect)
{
// TODO add some adjustment to all 4 sides?
setSceneRect(sceneRect);
// add some adjustment to all 4 sides
static const qreal ADJUSTMENT = 80;
QRectF rect = sceneRect.adjusted(-ADJUSTMENT, -ADJUSTMENT, ADJUSTMENT, ADJUSTMENT);
setSceneRect(rect);
}
} // namespace qmt