21#include "KReportView.h"
22#include "KReportPage.h"
23#include "KReportRenderObjects.h"
24#include "KReportPreRenderer.h"
25#include "KReportRendererBase.h"
26#include "kreport_debug.h"
34#include <QGraphicsView>
35#include <QGraphicsScene>
52 void moveToPage(
int page)
54 if (page != currentPage && page >= 1 && page <= pageCount) {
56 reportPage->renderPage(currentPage);
60 QPointer<ORODocument> reportDocument;
61 QGraphicsView *reportView;
62 QGraphicsScene *reportScene;
63 KReportPage *reportPage;
68 KReportRendererFactory factory;
72KReportView::KReportView(
QWidget *parent)
73 :
QWidget(parent), d(new Private())
85 layout()->addWidget(d->reportView);
88 d->reportScene->setSceneRect(0,0,1000,2000);
89 d->reportView->setScene(d->reportScene);
91 d->reportScene->setBackgroundBrush(palette().brush(
QPalette::Dark));
94KReportView::~KReportView()
100void KReportView::moveToFirstPage()
105void KReportView::moveToLastPage()
107 d->moveToPage(d->pageCount);
110void KReportView::moveToNextPage()
112 d->moveToPage(d->currentPage + 1);
115void KReportView::moveToPreviousPage()
117 d->moveToPage(d->currentPage - 1);
127 return d->currentPage;
130int KReportView::pageCount()
const
137 d->reportDocument = doc;
140 delete d->reportPage;
145 d->reportPage =
new KReportPage(
this, d->reportDocument);
146 d->reportPage->setObjectName(QLatin1String(
"KReportPage"));
148 d->reportScene->setSceneRect(0,0,d->reportPage->rect().width() + 40, d->reportPage->rect().height() + 40);
149 d->reportScene->addItem(d->reportPage);
150 d->reportPage->setPos(20,20);
151 d->reportView->centerOn(0,0);
157 return d->reportView;
160void KReportView::refreshCurrentPage()
164 d->reportPage->renderPage(d->currentPage);
Provides a simple widget for viewing a rendered report on screen.
void moveToPage(int page)
Moves to page page (counted from 1)
Represents a single document containing one or more OROPage elements.
int pageCount() const
Return the total number of pages in the document.