+ int minX = 0;
+ int minY = 0;
+ int maxX = m_frameWidth;
+ int maxY = m_frameHeight;
+ if (!cropImage->isChecked()) {
+ m_scene->removeItem(m_startViewport);
+ m_scene->removeItem(m_endViewport);
+ QRect boundingRect = m_scene->itemsBoundingRect().toRect();
+ if (boundingRect.left() < 0) minX = boundingRect.left();
+ if (boundingRect.top() < 0) minY = boundingRect.top();
+ if (boundingRect.right() > maxX) maxX = boundingRect.right();
+ if (boundingRect.bottom() > maxY) maxY = boundingRect.bottom();
+ if (minX < 0) {
+ maxX = maxX - minX;
+ }
+ if (minY < 0) {
+ maxY = maxY - minY;
+ }
+ }
+
+ QImage pix(maxX, maxY, QImage::Format_ARGB32);