Commits
231 231 | graphicsImage=grabCanvas->grabImageFromCanvas(format); |
232 232 | } else { |
233 233 | graphicsImage = produceScreenImage(format, qcanvases, width, height, |
234 234 | gridRows, gridCols, wasCanceled); |
235 235 | } |
236 236 | } else { |
237 237 | // High resolution, or format size larger than widget. |
238 238 | graphicsImage = produceHighResImage(format, qcanvases, width, height, gridRows, gridCols, wasCanceled); |
239 239 | } |
240 240 | |
241 - | QWidget* pageHeader = grabPlotter->pageHeaderWidget(); |
242 - | |
243 - | auto haveHeader = pageHeader->isVisible(); |
244 - | |
245 241 | // Page image |
246 242 | QSize pageSize(graphicsImage.size()); |
247 - | if ( haveHeader ) { |
248 - | pageSize.rheight() += pageHeader->height(); |
249 - | } |
250 243 | QImage pageImage(pageSize,graphicsImage.format()); |
251 244 | |
252 245 | // Paint page |
253 246 | QPainter pagePainter(&pageImage); |
254 - | // Paint header |
255 - | if ( haveHeader ) { |
256 - | // For an unknown reason, page header widget's width |
257 - | // is 6 pixels shorter than graphics image's width |
258 - | QSize headerSize(pageSize.width(),pageHeader->height()); |
259 - | QImage headerImage(headerSize,graphicsImage.format()); |
260 - | headerImage.fill(Qt::white); |
261 - | QPoint headerTopLeft(0,0); |
262 - | pageHeader->render(&headerImage,headerTopLeft,pageHeader->rect()); |
263 - | QRect headerRectDest(headerTopLeft,headerSize); |
264 - | pagePainter.drawImage(headerRectDest,headerImage); |
265 - | } |
266 247 | // Paint graphics |
267 - | QPoint graphicsTopLeftDest = haveHeader ? QPoint(0,pageHeader->height()) : QPoint(0,0); |
248 + | QPoint graphicsTopLeftDest(0,0); |
268 249 | QRect graphicsRectDest(graphicsTopLeftDest,graphicsImage.size()); |
269 250 | pagePainter.drawImage(graphicsRectDest,graphicsImage); |
270 251 | |
271 252 | // Set DPI. |
272 253 | if(!wasCanceled && format.dpi > 0) { |
273 254 | // convert dpi to dpm |
274 255 | int dpm = QPOptions::round((format.dpi / 2.54) * 100); |
275 256 | pageImage.setDotsPerMeterX(dpm); |
276 257 | pageImage.setDotsPerMeterY(dpm); |
277 258 | } |