Changeset View
Changeset View
Standalone View
Standalone View
src/renderer/KReportPage.cpp
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | 54 | KReportPage::KReportPage(QWidget *parent, ORODocument *document) | |||
---|---|---|---|---|---|
55 | : QObject(parent), QGraphicsRectItem() | 55 | : QObject(parent), QGraphicsRectItem() | ||
56 | , d(new Private(document)) | 56 | , d(new Private(document)) | ||
57 | { | 57 | { | ||
58 | Q_ASSERT(document); | 58 | Q_ASSERT(document); | ||
59 | 59 | | |||
60 | int pageWidth; | 60 | int pageWidth; | ||
61 | int pageHeight; | 61 | int pageHeight; | ||
62 | 62 | | |||
63 | QString pageSize = d->reportDocument->pageLayout().pageSize().name(); | | |||
64 | | ||||
65 | pageWidth = d->reportDocument->pageLayout().fullRectPixels(KReportPrivate::dpiX()).width(); | 63 | pageWidth = d->reportDocument->pageLayout().fullRectPixels(KReportPrivate::dpiX()).width(); | ||
66 | pageHeight = d->reportDocument->pageLayout().fullRectPixels(KReportPrivate::dpiX()).height(); | 64 | pageHeight = d->reportDocument->pageLayout().fullRectPixels(KReportPrivate::dpiX()).height(); | ||
67 | 65 | | |||
68 | //TODO remove after check | 66 | if ((d->reportDocument->pageLayout().orientation() == QPageLayout::Portrait && (pageWidth > pageHeight)) || | ||
69 | #if 0 | 67 | (d->reportDocument->pageLayout().orientation() == QPageLayout::Landscape && (pageWidth < pageHeight))) { | ||
70 | if (pageSize == QLatin1String("Custom")) { | 68 | int tmp = pageWidth; | ||
71 | // if this is custom sized sheet of paper we will just use those values | 69 | pageWidth = pageHeight; | ||
72 | 70 | pageHeight = tmp; | |||
73 | } else { | | |||
74 | // lookup the correct size information for the specified size paper | | |||
75 | pageWidth = d->reportDocument->pageOptions().pixelSize().width(); | | |||
76 | pageHeight = d->reportDocument->pageOptions().pixelSize().height(); | | |||
77 | } | 71 | } | ||
78 | #endif | | |||
79 | 72 | | |||
80 | setRect(0, 0, pageWidth, pageHeight); | 73 | setRect(0, 0, pageWidth, pageHeight); | ||
81 | //kreportDebug() << "PAGE IS " << pageWidth << "x" << pageHeight; | 74 | //kreportDebug() << "PAGE IS " << pageWidth << "x" << pageHeight; | ||
82 | d->pixmap = QPixmap(pageWidth, pageHeight); | 75 | d->pixmap = QPixmap(pageWidth, pageHeight); | ||
83 | d->renderer = d->factory.createInstance(QLatin1String("screen")); | 76 | d->renderer = d->factory.createInstance(QLatin1String("screen")); | ||
84 | connect(d->reportDocument, SIGNAL(updated(int)), this, SLOT(pageUpdated(int))); | 77 | connect(d->reportDocument, SIGNAL(updated(int)), this, SLOT(pageUpdated(int))); | ||
85 | 78 | | |||
86 | d->renderTimer.setSingleShot(true); | 79 | d->renderTimer.setSingleShot(true); | ||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |