mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-25 00:54:39 +03:00
commit
adcac14617
@ -11,6 +11,7 @@ CONFIG(release, debug|release){
|
|||||||
}
|
}
|
||||||
|
|
||||||
BUILD_DIR = $$PWD/build/$${QT_VERSION}
|
BUILD_DIR = $$PWD/build/$${QT_VERSION}
|
||||||
|
DEST_INCLUDE_DIR = $$PWD/include/
|
||||||
|
|
||||||
unix:!macx {
|
unix:!macx {
|
||||||
ARCH_DIR = $${OUT_PWD}/unix
|
ARCH_DIR = $${OUT_PWD}/unix
|
||||||
|
53
include/lrpreviewreportwidget.h
Normal file
53
include/lrpreviewreportwidget.h
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#ifndef LRPREVIEWREPORTWIDGET_H
|
||||||
|
#define LRPREVIEWREPORTWIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "lrglobal.h"
|
||||||
|
|
||||||
|
namespace LimeReport {
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class PreviewReportWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
class PreviewReportWidgetPrivate;
|
||||||
|
class ReportEnginePrivate;
|
||||||
|
|
||||||
|
class LIMEREPORT_EXPORT PreviewReportWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
friend class ReportEnginePrivate;
|
||||||
|
friend class PreviewReportWindow;
|
||||||
|
friend class PreviewReportWidgetPrivate;
|
||||||
|
public:
|
||||||
|
explicit PreviewReportWidget(ReportEnginePrivate *report, QWidget *parent = 0);
|
||||||
|
~PreviewReportWidget();
|
||||||
|
void initPreview();
|
||||||
|
void setErrorsMesagesVisible(bool visible);
|
||||||
|
void setErrorMessages(const QStringList &value);
|
||||||
|
void refreshPages();
|
||||||
|
public slots:
|
||||||
|
void slotZoomIn();
|
||||||
|
void slotZoomOut();
|
||||||
|
|
||||||
|
void slotFirstPage();
|
||||||
|
void slotPriorPage();
|
||||||
|
void slotNextPage();
|
||||||
|
void slotLastPage();
|
||||||
|
|
||||||
|
void slotPrint();
|
||||||
|
void slotPrintToPDF();
|
||||||
|
void slotPageNavigatorChanged(int value);
|
||||||
|
void slotSaveToFile();
|
||||||
|
signals:
|
||||||
|
void pageChanged(int page);
|
||||||
|
private slots:
|
||||||
|
void slotSliderMoved(int value);
|
||||||
|
void reportEngineDestroyed(QObject* object);
|
||||||
|
private:
|
||||||
|
Ui::PreviewReportWidget *ui;
|
||||||
|
PreviewReportWidgetPrivate* d_ptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace LimeReport
|
||||||
|
#endif // LRPREVIEWREPORTWIDGET_H
|
@ -37,6 +37,7 @@
|
|||||||
#include "lrglobal.h"
|
#include "lrglobal.h"
|
||||||
#include "lrdatasourcemanagerintf.h"
|
#include "lrdatasourcemanagerintf.h"
|
||||||
#include "lrscriptenginemanagerintf.h"
|
#include "lrscriptenginemanagerintf.h"
|
||||||
|
#include "lrpreviewreportwidget.h"
|
||||||
|
|
||||||
class QPrinter;
|
class QPrinter;
|
||||||
|
|
||||||
@ -75,7 +76,6 @@ public:
|
|||||||
void setShowProgressDialog(bool value);
|
void setShowProgressDialog(bool value);
|
||||||
IDataSourceManager* dataManager();
|
IDataSourceManager* dataManager();
|
||||||
IScriptEngineManager* scriptManager();
|
IScriptEngineManager* scriptManager();
|
||||||
|
|
||||||
bool loadFromFile(const QString& fileName);
|
bool loadFromFile(const QString& fileName);
|
||||||
bool loadFromByteArray(QByteArray *data);
|
bool loadFromByteArray(QByteArray *data);
|
||||||
bool loadFromString(const QString& data);
|
bool loadFromString(const QString& data);
|
||||||
@ -88,6 +88,7 @@ public:
|
|||||||
void setCurrentReportsDir(const QString& dirName);
|
void setCurrentReportsDir(const QString& dirName);
|
||||||
void setReportName(const QString& name);
|
void setReportName(const QString& name);
|
||||||
QString reportName();
|
QString reportName();
|
||||||
|
PreviewReportWidget *createPreviewWidget(QWidget *parent = 0);
|
||||||
signals:
|
signals:
|
||||||
void renderStarted();
|
void renderStarted();
|
||||||
void renderFinished();
|
void renderFinished();
|
||||||
|
@ -81,6 +81,8 @@ SOURCES += \
|
|||||||
$$REPORT_PATH/lrreportrender.cpp \
|
$$REPORT_PATH/lrreportrender.cpp \
|
||||||
$$REPORT_PATH/lrscriptenginemanager.cpp \
|
$$REPORT_PATH/lrscriptenginemanager.cpp \
|
||||||
$$REPORT_PATH/lrpreviewreportwindow.cpp \
|
$$REPORT_PATH/lrpreviewreportwindow.cpp \
|
||||||
|
$$REPORT_PATH/lrpreviewreportwidget.cpp \
|
||||||
|
$$REPORT_PATH/lrgraphicsviewzoom.cpp \
|
||||||
$$REPORT_PATH/lrvariablesholder.cpp \
|
$$REPORT_PATH/lrvariablesholder.cpp \
|
||||||
$$REPORT_PATH/lrgroupfunctions.cpp \
|
$$REPORT_PATH/lrgroupfunctions.cpp \
|
||||||
$$REPORT_PATH/lrsimplecrypt.cpp \
|
$$REPORT_PATH/lrsimplecrypt.cpp \
|
||||||
@ -157,6 +159,8 @@ HEADERS += \
|
|||||||
$$REPORT_PATH/bands/lrsubdetailband.h \
|
$$REPORT_PATH/bands/lrsubdetailband.h \
|
||||||
$$REPORT_PATH/lrreportrender.h \
|
$$REPORT_PATH/lrreportrender.h \
|
||||||
$$REPORT_PATH/lrpreviewreportwindow.h \
|
$$REPORT_PATH/lrpreviewreportwindow.h \
|
||||||
|
$$REPORT_PATH/lrpreviewreportwidget.h \
|
||||||
|
$$REPORT_PATH/lrgraphicsviewzoom.h \
|
||||||
$$REPORT_PATH/objectinspector/propertyItems/lrfontpropitem.h \
|
$$REPORT_PATH/objectinspector/propertyItems/lrfontpropitem.h \
|
||||||
$$REPORT_PATH/objectinspector/editors/lrfonteditor.h \
|
$$REPORT_PATH/objectinspector/editors/lrfonteditor.h \
|
||||||
$$REPORT_PATH/items/lrimageitem.h \
|
$$REPORT_PATH/items/lrimageitem.h \
|
||||||
@ -178,7 +182,8 @@ HEADERS += \
|
|||||||
$$REPORT_PATH/lrsimplecrypt.h \
|
$$REPORT_PATH/lrsimplecrypt.h \
|
||||||
$$REPORT_PATH/lraboutdialog.h \
|
$$REPORT_PATH/lraboutdialog.h \
|
||||||
$$REPORT_PATH/lrcallbackdatasourceintf.h \
|
$$REPORT_PATH/lrcallbackdatasourceintf.h \
|
||||||
$$REPORT_PATH/lrsettingdialog.h
|
$$REPORT_PATH/lrsettingdialog.h \
|
||||||
|
$$PWD/lrpreviewreportwidget_p.h
|
||||||
|
|
||||||
contains(CONFIG,zint){
|
contains(CONFIG,zint){
|
||||||
HEADERS += $$REPORT_PATH/items/lrbarcodeitem.h
|
HEADERS += $$REPORT_PATH/items/lrbarcodeitem.h
|
||||||
@ -191,6 +196,7 @@ FORMS += \
|
|||||||
$$REPORT_PATH/databrowser/lrvariabledialog.ui \
|
$$REPORT_PATH/databrowser/lrvariabledialog.ui \
|
||||||
$$REPORT_PATH/objectinspector/editors/ltextitempropertyeditor.ui \
|
$$REPORT_PATH/objectinspector/editors/ltextitempropertyeditor.ui \
|
||||||
$$REPORT_PATH/lrpreviewreportwindow.ui \
|
$$REPORT_PATH/lrpreviewreportwindow.ui \
|
||||||
|
$$REPORT_PATH/lrpreviewreportwidget.ui \
|
||||||
$$REPORT_PATH/items/lrtextitemeditor.ui \
|
$$REPORT_PATH/items/lrtextitemeditor.ui \
|
||||||
$$REPORT_PATH/lraboutdialog.ui \
|
$$REPORT_PATH/lraboutdialog.ui \
|
||||||
$$REPORT_PATH/lrsettingdialog.ui
|
$$REPORT_PATH/lrsettingdialog.ui
|
||||||
|
@ -23,31 +23,27 @@ EXTRA_FILES += \
|
|||||||
|
|
||||||
include(limereport.pri)
|
include(limereport.pri)
|
||||||
|
|
||||||
DEST_DIR = $$PWD/../include/
|
|
||||||
|
|
||||||
unix {
|
unix {
|
||||||
DESTDIR = $${BUILD_DIR}/$${BUILD_TYPE}/lib
|
DESTDIR = $${BUILD_DIR}/$${BUILD_TYPE}/lib
|
||||||
|
#QMAKE_POST_LINK += mkdir -p $$quote($${DESTDIR}/include) $$escape_expand(\\n\\t)
|
||||||
QMAKE_POST_LINK += mkdir -p $$quote($${DESTDIR}/include) $$escape_expand(\\n\\t)
|
|
||||||
|
|
||||||
#for(FILE,EXTRA_FILES){
|
|
||||||
# QMAKE_POST_LINK += $$quote($$QMAKE_COPY $${FILE} $${DEST_DIR}) $$escape_expand(\\n\\t)
|
|
||||||
#}
|
|
||||||
for(FILE,EXTRA_FILES){
|
for(FILE,EXTRA_FILES){
|
||||||
QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($${DESTDIR}/include/) $$escape_expand(\\n\\t)
|
QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($${DEST_INCLUDE_DIR}/include/) $$escape_expand(\\n\\t)
|
||||||
}
|
}
|
||||||
|
QMAKE_POST_LINK += $(COPY_DIR) $$quote($${DEST_INCLUDE_DIR}*) $$quote($${DEST_DIR})
|
||||||
}
|
}
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
EXTRA_FILES ~= s,/,\\,g
|
EXTRA_FILES ~= s,/,\\,g
|
||||||
DEST_DIR ~= s,/,\\,g
|
|
||||||
BUILD_DIR ~= s,/,\\,g
|
BUILD_DIR ~= s,/,\\,g
|
||||||
|
|
||||||
DESTDIR = $${BUILD_DIR}/$${BUILD_TYPE}/lib
|
DESTDIR = $${BUILD_DIR}/$${BUILD_TYPE}/lib
|
||||||
|
DEST_DIR = $$DESTDIR/include/
|
||||||
|
DEST_DIR ~= s,/,\\,g
|
||||||
|
DEST_INCLUDE_DIR ~= s,/,\\,g
|
||||||
|
|
||||||
for(FILE,EXTRA_FILES){
|
for(FILE,EXTRA_FILES){
|
||||||
QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($${DESTDIR}/include) $$escape_expand(\\n\\t)
|
QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($${DEST_INCLUDE_DIR}) $$escape_expand(\\n\\t)
|
||||||
}
|
}
|
||||||
|
QMAKE_POST_LINK += $(COPY_DIR) $$quote($${DEST_INCLUDE_DIR}*) $$quote($${DEST_DIR})
|
||||||
}
|
}
|
||||||
|
|
||||||
contains(CONFIG,zint){
|
contains(CONFIG,zint){
|
||||||
|
58
limereport/lrgraphicsviewzoom.cpp
Normal file
58
limereport/lrgraphicsviewzoom.cpp
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
#include "lrgraphicsviewzoom.h"
|
||||||
|
#include <QMouseEvent>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QtMath>
|
||||||
|
|
||||||
|
namespace LimeReport{
|
||||||
|
|
||||||
|
GraphicsViewZoomer::GraphicsViewZoomer(QGraphicsView* view)
|
||||||
|
: QObject(view), m_view(view)
|
||||||
|
{
|
||||||
|
m_view->viewport()->installEventFilter(this);
|
||||||
|
m_view->setMouseTracking(true);
|
||||||
|
m_modifiers = Qt::ControlModifier;
|
||||||
|
m_zoomFactorBase = 1.0015;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphicsViewZoomer::gentleZoom(double factor) {
|
||||||
|
m_view->scale(factor, factor);
|
||||||
|
m_view->centerOn(m_targetScenePos);
|
||||||
|
QPointF delta_viewport_pos = m_targetViewportPos - QPointF(m_view->viewport()->width() / 2.0,
|
||||||
|
m_view->viewport()->height() / 2.0);
|
||||||
|
QPointF viewport_center = m_view->mapFromScene(m_targetScenePos) - delta_viewport_pos;
|
||||||
|
m_view->centerOn(m_view->mapToScene(viewport_center.toPoint()));
|
||||||
|
emit zoomed();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphicsViewZoomer::setModifiers(Qt::KeyboardModifiers modifiers) {
|
||||||
|
m_modifiers = modifiers;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphicsViewZoomer::setZoomFactorBase(double value) {
|
||||||
|
m_zoomFactorBase = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GraphicsViewZoomer::eventFilter(QObject *object, QEvent *event) {
|
||||||
|
if (event->type() == QEvent::MouseMove) {
|
||||||
|
QMouseEvent* mouse_event = static_cast<QMouseEvent*>(event);
|
||||||
|
QPointF delta = m_targetViewportPos - mouse_event->pos();
|
||||||
|
if (qAbs(delta.x()) > 5 || qAbs(delta.y()) > 5) {
|
||||||
|
m_targetViewportPos = mouse_event->pos();
|
||||||
|
m_targetScenePos = m_view->mapToScene(mouse_event->pos());
|
||||||
|
}
|
||||||
|
} else if (event->type() == QEvent::Wheel) {
|
||||||
|
QWheelEvent* wheel_event = static_cast<QWheelEvent*>(event);
|
||||||
|
if (QApplication::keyboardModifiers() == m_modifiers) {
|
||||||
|
if (wheel_event->orientation() == Qt::Vertical) {
|
||||||
|
double angle = wheel_event->delta();
|
||||||
|
double factor = qPow(m_zoomFactorBase, angle);
|
||||||
|
gentleZoom(factor);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Q_UNUSED(object)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
} //namespace LimeReport
|
28
limereport/lrgraphicsviewzoom.h
Normal file
28
limereport/lrgraphicsviewzoom.h
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#ifndef GRAPHICSVIEWZOOM_H
|
||||||
|
#define GRAPHICSVIEWZOOM_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QGraphicsView>
|
||||||
|
|
||||||
|
namespace LimeReport {
|
||||||
|
|
||||||
|
class GraphicsViewZoomer : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
GraphicsViewZoomer(QGraphicsView* view);
|
||||||
|
void gentleZoom(double factor);
|
||||||
|
void setModifiers(Qt::KeyboardModifiers modifiers);
|
||||||
|
void setZoomFactorBase(double value);
|
||||||
|
private:
|
||||||
|
QGraphicsView* m_view;
|
||||||
|
Qt::KeyboardModifiers m_modifiers;
|
||||||
|
double m_zoomFactorBase;
|
||||||
|
QPointF m_targetScenePos, m_targetViewportPos;
|
||||||
|
bool eventFilter(QObject* object, QEvent* event);
|
||||||
|
signals:
|
||||||
|
void zoomed();
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace LimeReport
|
||||||
|
|
||||||
|
#endif // GRAPHICSVIEWZOOM_H
|
259
limereport/lrpreviewreportwidget.cpp
Normal file
259
limereport/lrpreviewreportwidget.cpp
Normal file
@ -0,0 +1,259 @@
|
|||||||
|
#include "lrpreviewreportwidget.h"
|
||||||
|
#include "ui_lrpreviewreportwidget.h"
|
||||||
|
|
||||||
|
#include <QPrinter>
|
||||||
|
#include <QPrintDialog>
|
||||||
|
#include <QScrollBar>
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
|
#include "lrpagedesignintf.h"
|
||||||
|
#include "lrreportrender.h"
|
||||||
|
#include "lrreportengine_p.h"
|
||||||
|
#include "lrpreviewreportwidget_p.h"
|
||||||
|
#include "serializators/lrxmlwriter.h"
|
||||||
|
|
||||||
|
namespace LimeReport {
|
||||||
|
|
||||||
|
bool PreviewReportWidgetPrivate::pageIsVisible(){
|
||||||
|
QGraphicsView* view = q_ptr->ui->graphicsView;
|
||||||
|
PageItemDesignIntf::Ptr page = m_reportPages.at(m_currentPage-1);
|
||||||
|
return page->mapToScene(page->rect()).boundingRect().intersects(
|
||||||
|
view->mapToScene(view->viewport()->geometry()).boundingRect()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
QRectF PreviewReportWidgetPrivate::calcPageShift(){
|
||||||
|
QGraphicsView *view = q_ptr->ui->graphicsView;
|
||||||
|
PageItemDesignIntf::Ptr page = m_reportPages.at(m_currentPage-1);
|
||||||
|
qreal pageHeight = page->mapToScene(page->boundingRect()).boundingRect().height();
|
||||||
|
qreal viewHeight = view->mapToScene(
|
||||||
|
0, view->viewport()->height()
|
||||||
|
).y() - view->mapToScene(0,0).y();
|
||||||
|
viewHeight = (pageHeight<viewHeight)?pageHeight:viewHeight;
|
||||||
|
QRectF pageStartPos = m_reportPages.at(m_currentPage-1)->mapRectToScene(
|
||||||
|
m_reportPages.at(m_currentPage-1)->rect()
|
||||||
|
);
|
||||||
|
return QRectF(0,pageStartPos.y(),0,viewHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreviewReportWidgetPrivate::setPages(ReportPages pages)
|
||||||
|
{
|
||||||
|
m_reportPages = pages;
|
||||||
|
if (!m_reportPages.isEmpty()){
|
||||||
|
m_previewPage->setPageItems(m_reportPages);
|
||||||
|
m_changingPage = true;
|
||||||
|
m_currentPage = 1;
|
||||||
|
if (pages.at(0)) pages.at(0)->setSelected(true);
|
||||||
|
m_changingPage = false;
|
||||||
|
q_ptr->initPreview();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PreviewReportWidget::PreviewReportWidget(ReportEnginePrivate *report, QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::PreviewReportWidget), d_ptr(new PreviewReportWidgetPrivate(this))
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
d_ptr->m_previewPage = report->createPreviewPage();
|
||||||
|
d_ptr->m_previewPage->setItemMode( LimeReport::PreviewMode );
|
||||||
|
d_ptr->m_report = report;
|
||||||
|
|
||||||
|
ui->errorsView->setVisible(false);
|
||||||
|
connect(ui->graphicsView->verticalScrollBar(),SIGNAL(valueChanged(int)), this, SLOT(slotSliderMoved(int)));
|
||||||
|
connect(d_ptr->m_report, SIGNAL(destroyed(QObject*)), this, SLOT(reportEngineDestroyed(QObject*)));
|
||||||
|
d_ptr->m_zoomer = new GraphicsViewZoomer(ui->graphicsView);
|
||||||
|
}
|
||||||
|
|
||||||
|
PreviewReportWidget::~PreviewReportWidget()
|
||||||
|
{
|
||||||
|
delete d_ptr->m_previewPage;
|
||||||
|
d_ptr->m_previewPage = 0;
|
||||||
|
delete d_ptr->m_zoomer;
|
||||||
|
delete d_ptr;
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreviewReportWidget::initPreview()
|
||||||
|
{
|
||||||
|
ui->graphicsView->setScene(d_ptr->m_previewPage);
|
||||||
|
ui->graphicsView->centerOn(0, 0);
|
||||||
|
ui->graphicsView->scale(0.5,0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreviewReportWidget::setErrorsMesagesVisible(bool visible)
|
||||||
|
{
|
||||||
|
ui->errorsView->setVisible(visible);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreviewReportWidget::slotZoomIn()
|
||||||
|
{
|
||||||
|
ui->graphicsView->scale(1.2,1.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreviewReportWidget::slotZoomOut()
|
||||||
|
{
|
||||||
|
ui->graphicsView->scale(1/1.2,1/1.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreviewReportWidget::slotFirstPage()
|
||||||
|
{
|
||||||
|
d_ptr->m_changingPage=true;
|
||||||
|
if ((!d_ptr->m_reportPages.isEmpty())&&(d_ptr->m_currentPage>1)){
|
||||||
|
d_ptr->m_currentPage=1;
|
||||||
|
ui->graphicsView->ensureVisible(d_ptr->calcPageShift(), 0, 0);
|
||||||
|
emit pageChanged(d_ptr->m_currentPage);
|
||||||
|
}
|
||||||
|
d_ptr->m_changingPage=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreviewReportWidget::slotPriorPage()
|
||||||
|
{
|
||||||
|
d_ptr->m_changingPage=true;
|
||||||
|
if ((!d_ptr->m_reportPages.isEmpty())&&(d_ptr->m_currentPage>1)){
|
||||||
|
d_ptr->m_currentPage--;
|
||||||
|
ui->graphicsView->ensureVisible(d_ptr->calcPageShift(), 0, 0);
|
||||||
|
emit pageChanged(d_ptr->m_currentPage);
|
||||||
|
}
|
||||||
|
d_ptr->m_changingPage=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreviewReportWidget::slotNextPage()
|
||||||
|
{
|
||||||
|
d_ptr->m_changingPage=true;
|
||||||
|
if ((!d_ptr->m_reportPages.isEmpty())&&(d_ptr->m_reportPages.count()>(d_ptr->m_currentPage))){
|
||||||
|
d_ptr->m_currentPage++;
|
||||||
|
ui->graphicsView->ensureVisible(d_ptr->calcPageShift(), 0, 0);
|
||||||
|
emit pageChanged(d_ptr->m_currentPage);
|
||||||
|
}
|
||||||
|
d_ptr->m_changingPage=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreviewReportWidget::slotLastPage()
|
||||||
|
{
|
||||||
|
d_ptr->m_changingPage=true;
|
||||||
|
if ((!d_ptr->m_reportPages.isEmpty())&&(d_ptr->m_reportPages.count()>(d_ptr->m_currentPage))){
|
||||||
|
d_ptr->m_currentPage=d_ptr->m_reportPages.count();
|
||||||
|
ui->graphicsView->ensureVisible(d_ptr->calcPageShift(), 0, 0);
|
||||||
|
emit pageChanged(d_ptr->m_currentPage);
|
||||||
|
}
|
||||||
|
d_ptr->m_changingPage=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreviewReportWidget::slotPrint()
|
||||||
|
{
|
||||||
|
QPrinter printer(QPrinter::HighResolution);
|
||||||
|
QPrintDialog dialog(&printer,QApplication::activeWindow());
|
||||||
|
if (dialog.exec()==QDialog::Accepted){
|
||||||
|
if (!d_ptr->m_reportPages.isEmpty())
|
||||||
|
ReportEnginePrivate::printReport(
|
||||||
|
d_ptr->m_reportPages,
|
||||||
|
printer,
|
||||||
|
PrintRange(dialog.printRange(),dialog.fromPage(),dialog.toPage())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreviewReportWidget::slotPrintToPDF()
|
||||||
|
{
|
||||||
|
QString fileName = QFileDialog::getSaveFileName(this,tr("PDF file name"),"","PDF(*.pdf)" );
|
||||||
|
if (!fileName.isEmpty()){
|
||||||
|
QPrinter printer;
|
||||||
|
printer.setOutputFileName(fileName);
|
||||||
|
printer.setOutputFormat(QPrinter::PdfFormat);
|
||||||
|
if (!d_ptr->m_reportPages.isEmpty()){
|
||||||
|
ReportEnginePrivate::printReport(d_ptr->m_reportPages,printer,PrintRange());
|
||||||
|
}
|
||||||
|
foreach(PageItemDesignIntf::Ptr pageItem, d_ptr->m_reportPages){
|
||||||
|
d_ptr->m_previewPage->reactivatePageItem(pageItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreviewReportWidget::slotPageNavigatorChanged(int value)
|
||||||
|
{
|
||||||
|
if (d_ptr->m_changingPage) return;
|
||||||
|
d_ptr->m_changingPage = true;
|
||||||
|
if ((!d_ptr->m_reportPages.isEmpty())&&(d_ptr->m_reportPages.count() >= value) && value>0){
|
||||||
|
d_ptr->m_currentPage = value;
|
||||||
|
ui->graphicsView->ensureVisible(d_ptr->calcPageShift(), 0, 0);
|
||||||
|
}
|
||||||
|
d_ptr->m_changingPage=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreviewReportWidget::slotSaveToFile()
|
||||||
|
{
|
||||||
|
QString fileName = QFileDialog::getSaveFileName(this,tr("Report file name"));
|
||||||
|
if (!fileName.isEmpty()){
|
||||||
|
QScopedPointer< ItemsWriterIntf > writer(new XMLWriter());
|
||||||
|
foreach (PageItemDesignIntf::Ptr page, d_ptr->m_reportPages){
|
||||||
|
writer->putItem(page.data());
|
||||||
|
}
|
||||||
|
writer->saveToFile(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreviewReportWidget::setErrorMessages(const QStringList &value)
|
||||||
|
{
|
||||||
|
foreach (QString line, value) {
|
||||||
|
ui->errorsView->append(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreviewReportWidget::refreshPages()
|
||||||
|
{
|
||||||
|
if (d_ptr->m_report){
|
||||||
|
try{
|
||||||
|
d_ptr->m_report->dataManager()->setDesignTime(false);
|
||||||
|
ReportPages pages = d_ptr->m_report->renderToPages();
|
||||||
|
d_ptr->m_report->dataManager()->setDesignTime(true);
|
||||||
|
if (pages.count()>0){
|
||||||
|
d_ptr->m_reportPages = pages;
|
||||||
|
if (!d_ptr->m_reportPages.isEmpty()){
|
||||||
|
d_ptr->m_previewPage->setPageItems(d_ptr->m_reportPages);
|
||||||
|
d_ptr->m_changingPage = true;
|
||||||
|
d_ptr->m_currentPage = 1;
|
||||||
|
if (pages.at(0)) pages.at(0)->setSelected(true);
|
||||||
|
d_ptr->m_changingPage = false;
|
||||||
|
}
|
||||||
|
ui->graphicsView->centerOn(0, 0);
|
||||||
|
}
|
||||||
|
} catch (ReportError &exception){
|
||||||
|
d_ptr->m_report->saveError(exception.what());
|
||||||
|
d_ptr->m_report->showError(exception.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreviewReportWidget::slotSliderMoved(int value)
|
||||||
|
{
|
||||||
|
if (ui->graphicsView->verticalScrollBar()->minimum()==value){
|
||||||
|
d_ptr->m_currentPage = 1;
|
||||||
|
} else if (ui->graphicsView->verticalScrollBar()->maximum()==value){
|
||||||
|
d_ptr->m_currentPage = d_ptr->m_reportPages.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!d_ptr->pageIsVisible()){
|
||||||
|
if (value>d_ptr->m_priorScrolValue){
|
||||||
|
d_ptr->m_currentPage++;
|
||||||
|
} else {
|
||||||
|
d_ptr->m_currentPage--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
d_ptr->m_changingPage = true;
|
||||||
|
emit pageChanged(d_ptr->m_currentPage);
|
||||||
|
|
||||||
|
d_ptr->m_changingPage = false;
|
||||||
|
d_ptr->m_priorScrolValue = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreviewReportWidget::reportEngineDestroyed(QObject *object)
|
||||||
|
{
|
||||||
|
if (object == d_ptr->m_report){
|
||||||
|
d_ptr->m_report = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
54
limereport/lrpreviewreportwidget.h
Normal file
54
limereport/lrpreviewreportwidget.h
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#ifndef LRPREVIEWREPORTWIDGET_H
|
||||||
|
#define LRPREVIEWREPORTWIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "lrglobal.h"
|
||||||
|
|
||||||
|
namespace LimeReport {
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class PreviewReportWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
class PreviewReportWidgetPrivate;
|
||||||
|
class ReportEnginePrivate;
|
||||||
|
|
||||||
|
class LIMEREPORT_EXPORT PreviewReportWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
friend class ReportEnginePrivate;
|
||||||
|
friend class PreviewReportWindow;
|
||||||
|
friend class PreviewReportWidgetPrivate;
|
||||||
|
public:
|
||||||
|
explicit PreviewReportWidget(ReportEnginePrivate *report, QWidget *parent = 0);
|
||||||
|
~PreviewReportWidget();
|
||||||
|
public slots:
|
||||||
|
void refreshPages();
|
||||||
|
void slotZoomIn();
|
||||||
|
void slotZoomOut();
|
||||||
|
|
||||||
|
void slotFirstPage();
|
||||||
|
void slotPriorPage();
|
||||||
|
void slotNextPage();
|
||||||
|
void slotLastPage();
|
||||||
|
|
||||||
|
void slotPrint();
|
||||||
|
void slotPrintToPDF();
|
||||||
|
void slotPageNavigatorChanged(int value);
|
||||||
|
void slotSaveToFile();
|
||||||
|
signals:
|
||||||
|
void pageChanged(int page);
|
||||||
|
private slots:
|
||||||
|
void slotSliderMoved(int value);
|
||||||
|
void reportEngineDestroyed(QObject* object);
|
||||||
|
private:
|
||||||
|
void initPreview();
|
||||||
|
void setErrorsMesagesVisible(bool visible);
|
||||||
|
void setErrorMessages(const QStringList &value);
|
||||||
|
private:
|
||||||
|
Ui::PreviewReportWidget *ui;
|
||||||
|
PreviewReportWidgetPrivate* d_ptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace LimeReport
|
||||||
|
#endif // LRPREVIEWREPORTWIDGET_H
|
39
limereport/lrpreviewreportwidget.ui
Normal file
39
limereport/lrpreviewreportwidget.ui
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>LimeReport::PreviewReportWidget</class>
|
||||||
|
<widget class="QWidget" name="LimeReport::PreviewReportWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>740</width>
|
||||||
|
<height>418</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QGraphicsView" name="graphicsView"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTextEdit" name="errorsView"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
33
limereport/lrpreviewreportwidget_p.h
Normal file
33
limereport/lrpreviewreportwidget_p.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#ifndef LRPREVIEWREPORTWIDGET_P_H
|
||||||
|
#define LRPREVIEWREPORTWIDGET_P_H
|
||||||
|
|
||||||
|
#include "lrpagedesignintf.h"
|
||||||
|
#include "lrreportrender.h"
|
||||||
|
#include "lrgraphicsviewzoom.h"
|
||||||
|
|
||||||
|
namespace LimeReport{
|
||||||
|
|
||||||
|
class PreviewReportWidget;
|
||||||
|
|
||||||
|
class PreviewReportWidgetPrivate
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PreviewReportWidgetPrivate(PreviewReportWidget* previewReportWidget): q_ptr(previewReportWidget),
|
||||||
|
m_currentPage(1), m_changingPage(false), m_priorScrolValue(0){}
|
||||||
|
bool pageIsVisible();
|
||||||
|
QRectF calcPageShift();
|
||||||
|
void setPages( ReportPages pages);
|
||||||
|
public:
|
||||||
|
PageDesignIntf* m_previewPage;
|
||||||
|
ReportPages m_reportPages;
|
||||||
|
ReportEnginePrivate* m_report;
|
||||||
|
GraphicsViewZoomer* m_zoomer;
|
||||||
|
int m_currentPage;
|
||||||
|
bool m_changingPage;
|
||||||
|
int m_priorScrolValue;
|
||||||
|
PreviewReportWidget* q_ptr;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif // LRPREVIEWREPORTWIDGET_P_H
|
@ -32,6 +32,8 @@
|
|||||||
#include "serializators/lrxmlreader.h"
|
#include "serializators/lrxmlreader.h"
|
||||||
#include "serializators/lrxmlwriter.h"
|
#include "serializators/lrxmlwriter.h"
|
||||||
#include "lrreportengine_p.h"
|
#include "lrreportengine_p.h"
|
||||||
|
#include "lrpreviewreportwidget.h"
|
||||||
|
#include "lrpreviewreportwidget_p.h"
|
||||||
|
|
||||||
#include <QPrinter>
|
#include <QPrinter>
|
||||||
#include <QPrintDialog>
|
#include <QPrintDialog>
|
||||||
@ -43,24 +45,22 @@ namespace LimeReport{
|
|||||||
|
|
||||||
PreviewReportWindow::PreviewReportWindow(ReportEnginePrivate *report,QWidget *parent, QSettings *settings, Qt::WindowFlags flags) :
|
PreviewReportWindow::PreviewReportWindow(ReportEnginePrivate *report,QWidget *parent, QSettings *settings, Qt::WindowFlags flags) :
|
||||||
QMainWindow(parent,flags),
|
QMainWindow(parent,flags),
|
||||||
ui(new Ui::PreviewReportWindow), m_currentPage(1), m_changingPage(false), m_settings(settings), m_ownedSettings(false),
|
ui(new Ui::PreviewReportWindow), m_settings(settings), m_ownedSettings(false)
|
||||||
m_priorScrolValue(0)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setWindowTitle("Lime Report Preview");
|
setWindowTitle("Lime Report Preview");
|
||||||
m_previewPage = report->createPreviewPage();
|
|
||||||
m_previewPage->setItemMode( LimeReport::PreviewMode );
|
|
||||||
m_pagesNavigator = new QSpinBox(this);
|
m_pagesNavigator = new QSpinBox(this);
|
||||||
m_pagesNavigator->setMaximum(10000000);
|
m_pagesNavigator->setMaximum(10000000);
|
||||||
m_pagesNavigator->setPrefix(tr("Page: "));
|
m_pagesNavigator->setPrefix(tr("Page: "));
|
||||||
m_pagesNavigator->setMinimumWidth(120);
|
m_pagesNavigator->setMinimumWidth(120);
|
||||||
ui->toolBar->insertWidget(ui->actionNextPage,m_pagesNavigator);
|
ui->toolBar->insertWidget(ui->actionNextPage,m_pagesNavigator);
|
||||||
m_simpleScene = new QGraphicsScene(this);
|
|
||||||
ui->actionShowMessages->setVisible(false);
|
ui->actionShowMessages->setVisible(false);
|
||||||
ui->errorsView->setVisible(false);
|
|
||||||
connect(m_pagesNavigator,SIGNAL(valueChanged(int)),this,SLOT(slotPageNavigatorChanged(int)));
|
connect(m_pagesNavigator,SIGNAL(valueChanged(int)),this,SLOT(slotPageNavigatorChanged(int)));
|
||||||
connect(ui->graphicsView->verticalScrollBar(),SIGNAL(valueChanged(int)), this, SLOT(slotSliderMoved(int)));
|
m_previewReportWidget = new PreviewReportWidget(report,this);
|
||||||
connect(ui->actionShowMessages, SIGNAL(triggered()), this, SLOT(slotShowErrors()));
|
setCentralWidget(m_previewReportWidget);
|
||||||
|
layout()->setContentsMargins(1,1,1,1);
|
||||||
|
connect(m_previewReportWidget,SIGNAL(pageChanged(int)), this,SLOT(slotPageChanged(int)) );
|
||||||
restoreSetting();
|
restoreSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ PreviewReportWindow::~PreviewReportWindow()
|
|||||||
{
|
{
|
||||||
if (m_ownedSettings)
|
if (m_ownedSettings)
|
||||||
delete m_settings;
|
delete m_settings;
|
||||||
delete m_previewPage;
|
//delete m_previewPage;
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,11 +111,7 @@ void PreviewReportWindow::initPreview(int pagesCount)
|
|||||||
m_pagesNavigator->setSuffix(tr(" of %1").arg(pagesCount));
|
m_pagesNavigator->setSuffix(tr(" of %1").arg(pagesCount));
|
||||||
m_pagesNavigator->setMinimum(1);
|
m_pagesNavigator->setMinimum(1);
|
||||||
m_pagesNavigator->setMaximum(pagesCount);
|
m_pagesNavigator->setMaximum(pagesCount);
|
||||||
ui->graphicsView->setScene(m_previewPage);
|
m_pagesNavigator->setValue(1);
|
||||||
ui->graphicsView->centerOn(0, 0);
|
|
||||||
ui->graphicsView->scale(0.5,0.5);
|
|
||||||
m_currentPage=1;
|
|
||||||
m_pagesNavigator->setValue(m_currentPage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewReportWindow::setSettings(QSettings* value)
|
void PreviewReportWindow::setSettings(QSettings* value)
|
||||||
@ -129,9 +125,7 @@ void PreviewReportWindow::setSettings(QSettings* value)
|
|||||||
|
|
||||||
void PreviewReportWindow::setErrorMessages(const QStringList &value){
|
void PreviewReportWindow::setErrorMessages(const QStringList &value){
|
||||||
ui->actionShowMessages->setVisible(true);
|
ui->actionShowMessages->setVisible(true);
|
||||||
foreach (QString line, value) {
|
m_previewReportWidget->setErrorMessages(value);
|
||||||
ui->errorsView->append(line);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QSettings*PreviewReportWindow::settings()
|
QSettings*PreviewReportWindow::settings()
|
||||||
@ -147,26 +141,20 @@ QSettings*PreviewReportWindow::settings()
|
|||||||
|
|
||||||
void PreviewReportWindow::setReportReader(ItemsReaderIntf::Ptr reader)
|
void PreviewReportWindow::setReportReader(ItemsReaderIntf::Ptr reader)
|
||||||
{
|
{
|
||||||
m_reader=reader;
|
// m_reader=reader;
|
||||||
if (!reader.isNull()){
|
// if (!reader.isNull()){
|
||||||
if (reader->first()) reader->readItem(m_previewPage->pageItem());
|
// if (reader->first()) reader->readItem(m_previewPage->pageItem());
|
||||||
int pagesCount = reader->firstLevelItemsCount();
|
// int pagesCount = reader->firstLevelItemsCount();
|
||||||
m_previewPage->pageItem()->setItemMode(PreviewMode);
|
// m_previewPage->pageItem()->setItemMode(PreviewMode);
|
||||||
initPreview(pagesCount);
|
// initPreview(pagesCount);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewReportWindow::setPages(ReportPages pages)
|
void PreviewReportWindow::setPages(ReportPages pages)
|
||||||
{
|
{
|
||||||
m_reportPages = pages;
|
m_previewReportWidget->d_ptr->setPages(pages);
|
||||||
if (!m_reportPages.isEmpty()){
|
if (!pages.isEmpty()){
|
||||||
//m_previewPage->setPageItem(m_reportPages.at(0));
|
initPreview(pages.count());
|
||||||
m_previewPage->setPageItems(m_reportPages);
|
|
||||||
m_changingPage = true;
|
|
||||||
initPreview(m_reportPages.count());
|
|
||||||
m_currentPage = 1;
|
|
||||||
if (pages.at(0)) pages.at(0)->setSelected(true);
|
|
||||||
m_changingPage = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,104 +203,37 @@ void PreviewReportWindow::moveEvent(QMoveEvent* e)
|
|||||||
|
|
||||||
void PreviewReportWindow::slotPrint()
|
void PreviewReportWindow::slotPrint()
|
||||||
{
|
{
|
||||||
QPrinter printer(QPrinter::HighResolution);
|
m_previewReportWidget->slotPrint();
|
||||||
QPrintDialog dialog(&printer,QApplication::activeWindow());
|
|
||||||
if (dialog.exec()==QDialog::Accepted){
|
|
||||||
if (!m_reportPages.isEmpty())
|
|
||||||
ReportEnginePrivate::printReport(
|
|
||||||
m_reportPages,
|
|
||||||
printer,
|
|
||||||
PrintRange(dialog.printRange(),dialog.fromPage(),dialog.toPage())
|
|
||||||
);
|
|
||||||
else ReportEnginePrivate::printReport(m_reader,printer);
|
|
||||||
foreach(PageItemDesignIntf::Ptr pageItem, m_reportPages){
|
|
||||||
m_previewPage->reactivatePageItem(pageItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewReportWindow::slotPriorPage()
|
void PreviewReportWindow::slotPriorPage()
|
||||||
{
|
{
|
||||||
m_changingPage=true;
|
m_previewReportWidget->slotPriorPage();
|
||||||
if ((!m_reportPages.isEmpty())&&(m_currentPage>1)){
|
|
||||||
m_currentPage--;
|
|
||||||
//m_previewPage->setPageItem(m_reportPages.at(m_currentPage-1));
|
|
||||||
ui->graphicsView->ensureVisible(
|
|
||||||
calcPageShift(m_reportPages.at(m_currentPage-1)), 0, 0
|
|
||||||
);
|
|
||||||
m_pagesNavigator->setValue(m_currentPage);
|
|
||||||
} else {
|
|
||||||
if (reader() && reader()->prior()){
|
|
||||||
m_previewPage->removeAllItems();
|
|
||||||
reader()->readItem(m_previewPage->pageItem());
|
|
||||||
m_currentPage--;
|
|
||||||
m_pagesNavigator->setValue(m_currentPage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_changingPage=false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewReportWindow::slotNextPage()
|
void PreviewReportWindow::slotNextPage()
|
||||||
{
|
{
|
||||||
m_changingPage=true;
|
m_previewReportWidget->slotNextPage();
|
||||||
if ((!m_reportPages.isEmpty())&&(m_reportPages.count()>(m_currentPage))){
|
|
||||||
m_currentPage++;
|
|
||||||
//m_previewPage->setPageItem(m_reportPages.at(m_currentPage-1));
|
|
||||||
ui->graphicsView->ensureVisible(
|
|
||||||
calcPageShift(m_reportPages.at(m_currentPage-1)), 0, 0
|
|
||||||
);
|
|
||||||
m_pagesNavigator->setValue(m_currentPage);
|
|
||||||
} else {
|
|
||||||
if (reader() && reader()->next()){
|
|
||||||
m_previewPage->removeAllItems();
|
|
||||||
reader()->readItem(m_previewPage->pageItem());
|
|
||||||
m_currentPage++;
|
|
||||||
m_pagesNavigator->setValue(m_currentPage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_changingPage=false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewReportWindow::slotZoomIn()
|
void PreviewReportWindow::slotZoomIn()
|
||||||
{
|
{
|
||||||
ui->graphicsView->scale(1.2,1.2);
|
m_previewReportWidget->slotZoomIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewReportWindow::slotZoomOut()
|
void PreviewReportWindow::slotZoomOut()
|
||||||
{
|
{
|
||||||
ui->graphicsView->scale(1/1.2,1/1.2);
|
m_previewReportWidget->slotZoomOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewReportWindow::slotPageNavigatorChanged(int value)
|
void PreviewReportWindow::slotPageNavigatorChanged(int value)
|
||||||
{
|
{
|
||||||
if (m_changingPage) return;
|
m_previewReportWidget->slotPageNavigatorChanged(value);
|
||||||
m_changingPage = true;
|
|
||||||
if ((!m_reportPages.isEmpty())&&(m_reportPages.count() >= value)){
|
|
||||||
m_currentPage = value;
|
|
||||||
//m_previewPage->setPageItem(m_reportPages.at(m_currentPage-1));
|
|
||||||
ui->graphicsView->ensureVisible(
|
|
||||||
calcPageShift(m_reportPages.at(m_currentPage-1)), 0, 0
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
if (reader()){
|
|
||||||
int direction = (m_currentPage>value)?-1:1;
|
|
||||||
while (m_currentPage != value){
|
|
||||||
if (direction == 1) reader()->next();
|
|
||||||
else reader()->prior();
|
|
||||||
m_currentPage += direction;
|
|
||||||
}
|
|
||||||
m_previewPage->removeAllItems();
|
|
||||||
reader()->readItem(m_previewPage->pageItem());
|
|
||||||
m_pagesNavigator->setValue(m_currentPage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_changingPage=false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewReportWindow::slotShowErrors()
|
void PreviewReportWindow::slotShowErrors()
|
||||||
{
|
{
|
||||||
ui->errorsView->setVisible(ui->actionShowMessages->isChecked());
|
m_previewReportWidget->setErrorsMesagesVisible(ui->actionShowMessages->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemsReaderIntf *PreviewReportWindow::reader()
|
ItemsReaderIntf *PreviewReportWindow::reader()
|
||||||
@ -320,127 +241,29 @@ ItemsReaderIntf *PreviewReportWindow::reader()
|
|||||||
return m_reader.data();
|
return m_reader.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PreviewReportWindow::pageIsVisible(PageItemDesignIntf::Ptr page)
|
|
||||||
{
|
|
||||||
return page->mapToScene(page->rect()).boundingRect().intersects(
|
|
||||||
ui->graphicsView->mapToScene(ui->graphicsView->viewport()->geometry()).boundingRect()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
QRectF PreviewReportWindow::calcPageShift(PageItemDesignIntf::Ptr page)
|
|
||||||
{
|
|
||||||
qreal pageHeight = page->mapToScene(page->boundingRect()).boundingRect().height();
|
|
||||||
qreal viewHeight = ui->graphicsView->mapToScene(
|
|
||||||
0,ui->graphicsView->viewport()->height()
|
|
||||||
).y()-ui->graphicsView->mapToScene(0,0).y();
|
|
||||||
viewHeight = (pageHeight<viewHeight)?pageHeight:viewHeight;
|
|
||||||
QRectF pageStartPos = m_reportPages.at(m_currentPage-1)->mapRectToScene(
|
|
||||||
m_reportPages.at(m_currentPage-1)->rect()
|
|
||||||
);
|
|
||||||
return QRectF(0,pageStartPos.y(),0,viewHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PreviewReportWindow::on_actionSaveToFile_triggered()
|
void PreviewReportWindow::on_actionSaveToFile_triggered()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getSaveFileName(this,tr("Report file name"));
|
m_previewReportWidget->slotSaveToFile();
|
||||||
if (!fileName.isEmpty()){
|
|
||||||
QScopedPointer< ItemsWriterIntf > writer(new XMLWriter());
|
|
||||||
foreach (PageItemDesignIntf::Ptr page, m_reportPages){
|
|
||||||
writer->putItem(page.data());
|
|
||||||
}
|
|
||||||
writer->saveToFile(fileName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewReportWindow::slotFirstPage()
|
void PreviewReportWindow::slotFirstPage()
|
||||||
{
|
{
|
||||||
m_changingPage=true;
|
m_previewReportWidget->slotFirstPage();
|
||||||
if ((!m_reportPages.isEmpty())&&(m_currentPage>1)){
|
|
||||||
m_currentPage=1;
|
|
||||||
//m_previewPage->setPageItem(m_reportPages.at(m_currentPage-1));
|
|
||||||
ui->graphicsView->ensureVisible(
|
|
||||||
calcPageShift(m_reportPages.at(m_currentPage-1)), 0, 0
|
|
||||||
);
|
|
||||||
m_pagesNavigator->setValue(m_currentPage);
|
|
||||||
} else {
|
|
||||||
if (reader() && reader()->prior()){
|
|
||||||
while (reader()->prior()) {
|
|
||||||
}
|
|
||||||
m_previewPage->removeAllItems();
|
|
||||||
reader()->readItem(m_previewPage->pageItem());
|
|
||||||
m_currentPage=1;
|
|
||||||
m_pagesNavigator->setValue(m_currentPage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_changingPage=false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewReportWindow::slotLastPage()
|
void PreviewReportWindow::slotLastPage()
|
||||||
{
|
{
|
||||||
m_changingPage=true;
|
m_previewReportWidget->slotLastPage();
|
||||||
if ((!m_reportPages.isEmpty())&&(m_reportPages.count()>(m_currentPage))){
|
|
||||||
m_currentPage=m_reportPages.count();
|
|
||||||
//m_previewPage->setPageItem(m_reportPages.at(m_currentPage-1));
|
|
||||||
ui->graphicsView->ensureVisible(
|
|
||||||
calcPageShift(m_reportPages.at(m_currentPage-1)), 0, 0
|
|
||||||
);
|
|
||||||
m_pagesNavigator->setValue(m_currentPage);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (reader() && reader()->next()){
|
|
||||||
m_currentPage++;
|
|
||||||
while (reader()->next()) {
|
|
||||||
m_currentPage++;
|
|
||||||
}
|
|
||||||
m_previewPage->removeAllItems();
|
|
||||||
reader()->readItem(m_previewPage->pageItem());
|
|
||||||
m_pagesNavigator->setValue(m_currentPage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_changingPage=false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewReportWindow::slotPrintToPDF()
|
void PreviewReportWindow::slotPrintToPDF()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getSaveFileName(this,tr("PDF file name"),"","PDF(*.pdf)" );
|
m_previewReportWidget->slotPrintToPDF();
|
||||||
qDebug()<<fileName;
|
|
||||||
if (!fileName.isEmpty()){
|
|
||||||
QPrinter printer;
|
|
||||||
printer.setOutputFileName(fileName);
|
|
||||||
printer.setOutputFormat(QPrinter::PdfFormat);
|
|
||||||
|
|
||||||
if (!m_reportPages.isEmpty()){
|
|
||||||
ReportEnginePrivate::printReport(m_reportPages,printer,PrintRange());
|
|
||||||
} else {
|
|
||||||
ReportEnginePrivate::printReport(m_reader,printer);
|
|
||||||
}
|
|
||||||
foreach(PageItemDesignIntf::Ptr pageItem, m_reportPages){
|
|
||||||
m_previewPage->reactivatePageItem(pageItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewReportWindow::slotSliderMoved(int value)
|
void PreviewReportWindow::slotPageChanged(int pageIndex)
|
||||||
{
|
{
|
||||||
if (ui->graphicsView->verticalScrollBar()->minimum()==value){
|
m_pagesNavigator->setValue(pageIndex);
|
||||||
m_currentPage = 1;
|
|
||||||
} else if (ui->graphicsView->verticalScrollBar()->maximum()==value){
|
|
||||||
m_currentPage = m_reportPages.count();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pageIsVisible(m_reportPages.at(m_currentPage-1))){
|
|
||||||
if (value>m_priorScrolValue){
|
|
||||||
m_currentPage++;
|
|
||||||
} else {
|
|
||||||
m_currentPage--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_changingPage = true;
|
|
||||||
m_pagesNavigator->setValue(m_currentPage);
|
|
||||||
m_changingPage = false;
|
|
||||||
m_priorScrolValue = value;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}// namespace LimeReport
|
}// namespace LimeReport
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "lrreportrender.h"
|
#include "lrreportrender.h"
|
||||||
#include "serializators/lrstorageintf.h"
|
#include "serializators/lrstorageintf.h"
|
||||||
#include "serializators/lrxmlreader.h"
|
#include "serializators/lrxmlreader.h"
|
||||||
|
#include "lrpreviewreportwidget.h"
|
||||||
|
|
||||||
namespace LimeReport {
|
namespace LimeReport {
|
||||||
|
|
||||||
@ -76,25 +77,20 @@ public slots:
|
|||||||
void slotFirstPage();
|
void slotFirstPage();
|
||||||
void slotLastPage();
|
void slotLastPage();
|
||||||
void slotPrintToPDF();
|
void slotPrintToPDF();
|
||||||
private slots:
|
void slotPageChanged(int pageIndex);
|
||||||
void slotSliderMoved(int value);
|
|
||||||
private:
|
private:
|
||||||
ItemsReaderIntf* reader();
|
ItemsReaderIntf* reader();
|
||||||
bool pageIsVisible(PageItemDesignIntf::Ptr page);
|
//bool pageIsVisible(PageItemDesignIntf::Ptr page);
|
||||||
QRectF calcPageShift(PageItemDesignIntf::Ptr page);
|
//QRectF calcPageShift(PageItemDesignIntf::Ptr page);
|
||||||
private:
|
private:
|
||||||
Ui::PreviewReportWindow *ui;
|
Ui::PreviewReportWindow *ui;
|
||||||
QSpinBox* m_pagesNavigator;
|
QSpinBox* m_pagesNavigator;
|
||||||
QSharedPointer<ItemsReaderIntf> m_reader;
|
QSharedPointer<ItemsReaderIntf> m_reader;
|
||||||
int m_currentPage;
|
|
||||||
PageDesignIntf* m_previewPage;
|
|
||||||
QGraphicsScene* m_simpleScene;
|
|
||||||
ReportPages m_reportPages;
|
|
||||||
QEventLoop m_eventLoop;
|
QEventLoop m_eventLoop;
|
||||||
bool m_changingPage;
|
bool m_changingPage;
|
||||||
QSettings* m_settings;
|
QSettings* m_settings;
|
||||||
bool m_ownedSettings;
|
bool m_ownedSettings;
|
||||||
int m_priorScrolValue;
|
PreviewReportWidget* m_previewReportWidget;
|
||||||
};
|
};
|
||||||
} //namespace LimeReport
|
} //namespace LimeReport
|
||||||
#endif // LRPREVIEWREPORTWINDOW_H
|
#endif // LRPREVIEWREPORTWINDOW_H
|
||||||
|
@ -27,12 +27,6 @@
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<widget class="QGraphicsView" name="graphicsView"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QTextEdit" name="errorsView"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenuBar" name="menubar">
|
<widget class="QMenuBar" name="menubar">
|
||||||
@ -41,7 +35,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>800</width>
|
||||||
<height>20</height>
|
<height>21</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuView">
|
<widget class="QMenu" name="menuView">
|
||||||
@ -232,8 +226,8 @@
|
|||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="report.qrc"/>
|
|
||||||
<include location="databrowser/lrdatabrowser.qrc"/>
|
<include location="databrowser/lrdatabrowser.qrc"/>
|
||||||
|
<include location="report.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
@ -42,62 +42,9 @@
|
|||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
|
|
||||||
namespace LimeReport {
|
namespace LimeReport {
|
||||||
|
|
||||||
//GraphicsViewZoom
|
|
||||||
GraphicsViewZoom::GraphicsViewZoom(QGraphicsView* view)
|
|
||||||
: QObject(view), m_view(view)
|
|
||||||
{
|
|
||||||
m_view->viewport()->installEventFilter(this);
|
|
||||||
m_view->setMouseTracking(true);
|
|
||||||
m_modifiers = Qt::ControlModifier;
|
|
||||||
m_zoomFactorBase = 1.0015;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GraphicsViewZoom::gentleZoom(double factor) {
|
|
||||||
m_view->scale(factor, factor);
|
|
||||||
m_view->centerOn(m_targetScenePos);
|
|
||||||
QPointF delta_viewport_pos = m_targetViewportPos - QPointF(m_view->viewport()->width() / 2.0,
|
|
||||||
m_view->viewport()->height() / 2.0);
|
|
||||||
QPointF viewport_center = m_view->mapFromScene(m_targetScenePos) - delta_viewport_pos;
|
|
||||||
m_view->centerOn(m_view->mapToScene(viewport_center.toPoint()));
|
|
||||||
emit zoomed();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GraphicsViewZoom::setModifiers(Qt::KeyboardModifiers modifiers) {
|
|
||||||
m_modifiers = modifiers;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GraphicsViewZoom::setZoomFactorBase(double value) {
|
|
||||||
m_zoomFactorBase = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GraphicsViewZoom::eventFilter(QObject *object, QEvent *event) {
|
|
||||||
if (event->type() == QEvent::MouseMove) {
|
|
||||||
QMouseEvent* mouse_event = static_cast<QMouseEvent*>(event);
|
|
||||||
QPointF delta = m_targetViewportPos - mouse_event->pos();
|
|
||||||
if (qAbs(delta.x()) > 5 || qAbs(delta.y()) > 5) {
|
|
||||||
m_targetViewportPos = mouse_event->pos();
|
|
||||||
m_targetScenePos = m_view->mapToScene(mouse_event->pos());
|
|
||||||
}
|
|
||||||
} else if (event->type() == QEvent::Wheel) {
|
|
||||||
QWheelEvent* wheel_event = static_cast<QWheelEvent*>(event);
|
|
||||||
if (QApplication::keyboardModifiers() == m_modifiers) {
|
|
||||||
if (wheel_event->orientation() == Qt::Vertical) {
|
|
||||||
double angle = wheel_event->delta();
|
|
||||||
double factor = qPow(m_zoomFactorBase, angle);
|
|
||||||
gentleZoom(factor);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Q_UNUSED(object)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReportDesignIntf
|
// ReportDesignIntf
|
||||||
//ReportDesignWidget* ReportDesignWidget::m_instance=0;
|
|
||||||
|
|
||||||
ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow *mainWindow, QWidget *parent) :
|
ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow *mainWindow, QWidget *parent) :
|
||||||
QWidget(parent), m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false)
|
QWidget(parent), m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false)
|
||||||
@ -128,7 +75,7 @@ ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow
|
|||||||
m_view->scale(0.5,0.5);
|
m_view->scale(0.5,0.5);
|
||||||
//m_instance=this;
|
//m_instance=this;
|
||||||
//m_view->viewport()->installEventFilter(this);
|
//m_view->viewport()->installEventFilter(this);
|
||||||
m_zoomer = new GraphicsViewZoom(m_view);
|
m_zoomer = new GraphicsViewZoomer(m_view);
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
m_defaultFont = QFont("Arial",10);
|
m_defaultFont = QFont("Arial",10);
|
||||||
#endif
|
#endif
|
||||||
@ -193,7 +140,9 @@ void ReportDesignWidget::loadState(QSettings* settings)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReportDesignWidget::~ReportDesignWidget()
|
ReportDesignWidget::~ReportDesignWidget()
|
||||||
{ /*m_instance=0;*/}
|
{
|
||||||
|
delete m_zoomer;
|
||||||
|
}
|
||||||
|
|
||||||
void ReportDesignWidget::setActivePage(PageDesignIntf *page)
|
void ReportDesignWidget::setActivePage(PageDesignIntf *page)
|
||||||
{
|
{
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "lrdatasourcemanager.h"
|
#include "lrdatasourcemanager.h"
|
||||||
#include "lrcollection.h"
|
#include "lrcollection.h"
|
||||||
#include "lrreportengine_p.h"
|
#include "lrreportengine_p.h"
|
||||||
|
#include "lrgraphicsviewzoom.h"
|
||||||
|
|
||||||
|
|
||||||
namespace LimeReport {
|
namespace LimeReport {
|
||||||
@ -47,24 +48,6 @@ class ReportEnginePrivate;
|
|||||||
class DataBrowser;
|
class DataBrowser;
|
||||||
class ReportDesignWindow;
|
class ReportDesignWindow;
|
||||||
|
|
||||||
|
|
||||||
class GraphicsViewZoom : public QObject {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
GraphicsViewZoom(QGraphicsView* view);
|
|
||||||
void gentleZoom(double factor);
|
|
||||||
void setModifiers(Qt::KeyboardModifiers modifiers);
|
|
||||||
void setZoomFactorBase(double value);
|
|
||||||
private:
|
|
||||||
QGraphicsView* m_view;
|
|
||||||
Qt::KeyboardModifiers m_modifiers;
|
|
||||||
double m_zoomFactorBase;
|
|
||||||
QPointF m_targetScenePos, m_targetViewportPos;
|
|
||||||
bool eventFilter(QObject* object, QEvent* event);
|
|
||||||
signals:
|
|
||||||
void zoomed();
|
|
||||||
};
|
|
||||||
|
|
||||||
class ReportDesignWidget : public QWidget
|
class ReportDesignWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -158,7 +141,7 @@ private:
|
|||||||
ReportEnginePrivate* m_report;
|
ReportEnginePrivate* m_report;
|
||||||
QGraphicsView *m_view;
|
QGraphicsView *m_view;
|
||||||
QMainWindow *m_mainWindow;
|
QMainWindow *m_mainWindow;
|
||||||
GraphicsViewZoom* m_zoomer;
|
GraphicsViewZoomer* m_zoomer;
|
||||||
QFont m_defaultFont;
|
QFont m_defaultFont;
|
||||||
int m_verticalGridStep;
|
int m_verticalGridStep;
|
||||||
int m_horizontalGridStep;
|
int m_horizontalGridStep;
|
||||||
|
@ -47,6 +47,8 @@
|
|||||||
#include "serializators/lrxmlreader.h"
|
#include "serializators/lrxmlreader.h"
|
||||||
#include "lrreportrender.h"
|
#include "lrreportrender.h"
|
||||||
#include "lrpreviewreportwindow.h"
|
#include "lrpreviewreportwindow.h"
|
||||||
|
#include "lrpreviewreportwidget.h"
|
||||||
|
#include "lrpreviewreportwidget_p.h"
|
||||||
|
|
||||||
namespace LimeReport{
|
namespace LimeReport{
|
||||||
|
|
||||||
@ -312,6 +314,22 @@ void ReportEnginePrivate::previewReport()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PreviewReportWidget* ReportEnginePrivate::createPreviewWidget(QWidget* parent){
|
||||||
|
|
||||||
|
PreviewReportWidget* widget = new PreviewReportWidget(this, parent);
|
||||||
|
try{
|
||||||
|
dataManager()->setDesignTime(false);
|
||||||
|
ReportPages pages = renderToPages();
|
||||||
|
dataManager()->setDesignTime(true);
|
||||||
|
if (pages.count()>0)
|
||||||
|
widget->d_ptr->setPages(pages);
|
||||||
|
} catch (ReportError &exception){
|
||||||
|
saveError(exception.what());
|
||||||
|
showError(exception.what());
|
||||||
|
}
|
||||||
|
return widget;
|
||||||
|
}
|
||||||
|
|
||||||
PageDesignIntf* ReportEnginePrivate::createPreviewScene(QObject* parent){
|
PageDesignIntf* ReportEnginePrivate::createPreviewScene(QObject* parent){
|
||||||
PageDesignIntf* result = 0;
|
PageDesignIntf* result = 0;
|
||||||
try {
|
try {
|
||||||
@ -595,6 +613,12 @@ void ReportEngine::designReport()
|
|||||||
d->designReport();
|
d->designReport();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PreviewReportWidget* ReportEngine::createPreviewWidget(QWidget *parent)
|
||||||
|
{
|
||||||
|
Q_D(ReportEngine);
|
||||||
|
return d->createPreviewWidget(parent);
|
||||||
|
}
|
||||||
|
|
||||||
void ReportEngine::setShowProgressDialog(bool value)
|
void ReportEngine::setShowProgressDialog(bool value)
|
||||||
{
|
{
|
||||||
Q_D(ReportEngine);
|
Q_D(ReportEngine);
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "lrglobal.h"
|
#include "lrglobal.h"
|
||||||
#include "lrdatasourcemanagerintf.h"
|
#include "lrdatasourcemanagerintf.h"
|
||||||
#include "lrscriptenginemanagerintf.h"
|
#include "lrscriptenginemanagerintf.h"
|
||||||
|
#include "lrpreviewreportwidget.h"
|
||||||
|
|
||||||
class QPrinter;
|
class QPrinter;
|
||||||
|
|
||||||
@ -75,7 +76,6 @@ public:
|
|||||||
void setShowProgressDialog(bool value);
|
void setShowProgressDialog(bool value);
|
||||||
IDataSourceManager* dataManager();
|
IDataSourceManager* dataManager();
|
||||||
IScriptEngineManager* scriptManager();
|
IScriptEngineManager* scriptManager();
|
||||||
|
|
||||||
bool loadFromFile(const QString& fileName);
|
bool loadFromFile(const QString& fileName);
|
||||||
bool loadFromByteArray(QByteArray *data);
|
bool loadFromByteArray(QByteArray *data);
|
||||||
bool loadFromString(const QString& data);
|
bool loadFromString(const QString& data);
|
||||||
@ -88,6 +88,7 @@ public:
|
|||||||
void setCurrentReportsDir(const QString& dirName);
|
void setCurrentReportsDir(const QString& dirName);
|
||||||
void setReportName(const QString& name);
|
void setReportName(const QString& name);
|
||||||
QString reportName();
|
QString reportName();
|
||||||
|
PreviewReportWidget *createPreviewWidget(QWidget *parent = 0);
|
||||||
signals:
|
signals:
|
||||||
void renderStarted();
|
void renderStarted();
|
||||||
void renderFinished();
|
void renderFinished();
|
||||||
|
@ -55,6 +55,7 @@ class ReportEnginePrivate : public QObject, public ICollectionContainer
|
|||||||
Q_DECLARE_PUBLIC(ReportEngine)
|
Q_DECLARE_PUBLIC(ReportEngine)
|
||||||
Q_PROPERTY(ACollectionProperty pages READ fakeCollectionReader())
|
Q_PROPERTY(ACollectionProperty pages READ fakeCollectionReader())
|
||||||
Q_PROPERTY(QObject* datasourcesManager READ dataManager())
|
Q_PROPERTY(QObject* datasourcesManager READ dataManager())
|
||||||
|
friend class PreviewReportWidget;
|
||||||
public:
|
public:
|
||||||
static void printReport(ItemsReaderIntf::Ptr reader, QPrinter &printer);
|
static void printReport(ItemsReaderIntf::Ptr reader, QPrinter &printer);
|
||||||
static void printReport(ReportPages pages, QPrinter &printer, const PrintRange &printRange);
|
static void printReport(ReportPages pages, QPrinter &printer, const PrintRange &printRange);
|
||||||
@ -93,7 +94,6 @@ public:
|
|||||||
bool isNeedToSave();
|
bool isNeedToSave();
|
||||||
QString lastError();
|
QString lastError();
|
||||||
ReportEngine * q_ptr;
|
ReportEngine * q_ptr;
|
||||||
PageDesignIntf *createPreviewScene(QObject *parent);
|
|
||||||
void emitSaveReport();
|
void emitSaveReport();
|
||||||
bool emitLoadReport();
|
bool emitLoadReport();
|
||||||
bool isSaved();
|
bool isSaved();
|
||||||
@ -102,6 +102,8 @@ public:
|
|||||||
void setReportName(const QString& reportName){ m_reportName=reportName;}
|
void setReportName(const QString& reportName){ m_reportName=reportName;}
|
||||||
QString reportName(){ return m_reportName;}
|
QString reportName(){ return m_reportName;}
|
||||||
bool hasActivePreview(){return m_activePreview;}
|
bool hasActivePreview(){return m_activePreview;}
|
||||||
|
PageDesignIntf *createPreviewScene(QObject *parent);
|
||||||
|
PreviewReportWidget *createPreviewWidget(QWidget *parent);
|
||||||
signals:
|
signals:
|
||||||
void pagesLoadFinished();
|
void pagesLoadFinished();
|
||||||
void datasourceCollectionLoadFinished(const QString& collectionName);
|
void datasourceCollectionLoadFinished(const QString& collectionName);
|
||||||
|
Loading…
Reference in New Issue
Block a user