forked from qt-creator/qt-creator
FormEditor: Return correct bounding rect for rendered QPicture
The bounding rect is calculated by union of all child item boundings rect of all FormEditorItems. Change-Id: I908e9d08b581671436bc7334b3b7eb0a5cd25aa8 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -512,8 +512,13 @@ QPicture FormEditorWidget::renderToPicture() const
|
|||||||
QPainter painter{&picture};
|
QPainter painter{&picture};
|
||||||
|
|
||||||
const QTransform viewportTransform = m_graphicsView->viewportTransform();
|
const QTransform viewportTransform = m_graphicsView->viewportTransform();
|
||||||
const QRectF boundingRect = rootItemRect();
|
auto items = m_formEditorView->scene()->allFormEditorItems();
|
||||||
|
|
||||||
|
QRectF boundingRect;
|
||||||
|
for (auto &item : items)
|
||||||
|
boundingRect |= item->childrenBoundingRect();
|
||||||
|
|
||||||
|
picture.setBoundingRect(boundingRect.toRect());
|
||||||
m_graphicsView->render(&painter, boundingRect, viewportTransform.mapRect(boundingRect.toRect()));
|
m_graphicsView->render(&painter, boundingRect, viewportTransform.mapRect(boundingRect.toRect()));
|
||||||
|
|
||||||
return picture;
|
return picture;
|
||||||
|
Reference in New Issue
Block a user