50 const double docWidth = bbox.width();
51 const double docHeight = bbox.width() * (newHeight / newWidth);
52 double docY = bbox.top();
53 if (
alignment.testFlag(Qt::AlignBottom)) {
54 docY = bbox.bottom() - docHeight;
55 }
else if (
alignment.testFlag(Qt::AlignVCenter)) {
56 docY = (bbox.bottom()*0.5) - (docHeight*0.5);
58 newBox = QRectF(bbox.left(), docY, docWidth, docHeight);
60 const double docWidth = bbox.height() * (newWidth / newHeight);
61 const double docHeight = bbox.height();
62 double docX = bbox.left();
64 docX = bbox.right() - docWidth;
65 }
else if (
alignment.testFlag(Qt::AlignHCenter)) {
66 docX = (bbox.right()*0.5) - (docWidth*0.5);
68 newBox = QRectF(docX, bbox.top(), docWidth, docHeight);
70 const double newTop = (
topPadding/newHeight) * newBox.height();
71 const double newBottom = (
bottomPadding/newHeight) * newBox.height();
72 const double newLeft = (
leftPadding/newWidth) * newBox.width();
73 const double newRight = (
rightPadding/newWidth) * newBox.width();
74 return newBox.adjusted(-newLeft, -newTop, newRight, newBottom);