createPreviewScene(QObject *parent = 0); from now return QGraphicsScene*

This commit is contained in:
Arin Alexander 2019-03-11 22:12:35 +03:00
parent 5f56f36a49
commit ee77ad5e5f
5 changed files with 22 additions and 14 deletions

View File

@ -42,6 +42,7 @@
#include "lrreportdesignwindowintrerface.h" #include "lrreportdesignwindowintrerface.h"
class QPrinter; class QPrinter;
class QGraphicsScene;
namespace LimeReport { namespace LimeReport {
@ -83,7 +84,7 @@ public:
bool printReport(QMap<QString, QPrinter*> printers, bool printToAllPrinters = false); bool printReport(QMap<QString, QPrinter*> printers, bool printToAllPrinters = false);
bool printPages(ReportPages pages, QPrinter *printer); bool printPages(ReportPages pages, QPrinter *printer);
void printToFile(const QString& fileName); void printToFile(const QString& fileName);
PageDesignIntf *createPreviewScene(QObject *parent = 0); QGraphicsScene* createPreviewScene(QObject *parent = 0);
bool printToPDF(const QString& fileName); bool printToPDF(const QString& fileName);
bool exportReport(QString exporterName, const QString &fileName = "", const QMap<QString, QVariant>& params = QMap<QString, QVariant>()); bool exportReport(QString exporterName, const QString &fileName = "", const QMap<QString, QVariant>& params = QMap<QString, QVariant>());
void previewReport(PreviewHints hints = PreviewBarsUserSetting); void previewReport(PreviewHints hints = PreviewBarsUserSetting);

View File

@ -1767,17 +1767,21 @@ void PageDesignIntf::removeAllItems()
m_commandsList.clear(); m_commandsList.clear();
} }
void PageDesignIntf::setItemMode(BaseDesignIntf::ItemMode state) void PageDesignIntf::setItemMode(BaseDesignIntf::ItemMode mode)
{ {
m_itemMode = state; if (m_itemMode != mode){
// foreach(QGraphicsItem * item, items()) { m_itemMode = mode;
// BaseDesignIntf *reportItem = dynamic_cast<BaseDesignIntf *>(item); if (m_currentPage) {
m_currentPage->setItemMode(mode);
// if (reportItem) { } else {
// reportItem->setItemMode(itemMode()); foreach(QGraphicsItem * item, items()) {
// } BaseDesignIntf *reportItem = dynamic_cast<BaseDesignIntf *>(item);
// } if (reportItem) {
if (m_currentPage) m_currentPage->setItemMode(state); reportItem->setItemMode(itemMode());
}
}
}
}
} }
BaseDesignIntf* PageDesignIntf::reportItemByName(const QString &name) BaseDesignIntf* PageDesignIntf::reportItemByName(const QString &name)

View File

@ -36,6 +36,7 @@
#include <QFileSystemWatcher> #include <QFileSystemWatcher>
#include <QPluginLoader> #include <QPluginLoader>
#include <QFileDialog> #include <QFileDialog>
#include <QGraphicsScene>
#include "time.h" #include "time.h"
@ -593,6 +594,7 @@ PageDesignIntf* ReportEnginePrivate::createPreviewScene(QObject* parent){
ReportPages pages = renderToPages(); ReportPages pages = renderToPages();
result = new PageDesignIntf(parent); result = new PageDesignIntf(parent);
result->setPageItems(pages); result->setPageItems(pages);
result->setItemMode(PrintMode);
} catch (ReportError &exception){ } catch (ReportError &exception){
saveError(exception.what()); saveError(exception.what());
showError(exception.what()); showError(exception.what());
@ -719,7 +721,7 @@ void ReportEnginePrivate::cancelRender()
m_reportRendering = false; m_reportRendering = false;
} }
PageDesignIntf* ReportEngine::createPreviewScene(QObject* parent){ QGraphicsScene* ReportEngine::createPreviewScene(QObject* parent){
Q_D(ReportEngine); Q_D(ReportEngine);
return d->createPreviewScene(parent); return d->createPreviewScene(parent);
} }

View File

@ -42,6 +42,7 @@
#include "lrreportdesignwindowintrerface.h" #include "lrreportdesignwindowintrerface.h"
class QPrinter; class QPrinter;
class QGraphicsScene;
namespace LimeReport { namespace LimeReport {
@ -83,7 +84,7 @@ public:
bool printReport(QMap<QString, QPrinter*> printers, bool printToAllPrinters = false); bool printReport(QMap<QString, QPrinter*> printers, bool printToAllPrinters = false);
bool printPages(ReportPages pages, QPrinter *printer); bool printPages(ReportPages pages, QPrinter *printer);
void printToFile(const QString& fileName); void printToFile(const QString& fileName);
PageDesignIntf *createPreviewScene(QObject *parent = 0); QGraphicsScene* createPreviewScene(QObject *parent = 0);
bool printToPDF(const QString& fileName); bool printToPDF(const QString& fileName);
bool exportReport(QString exporterName, const QString &fileName = "", const QMap<QString, QVariant>& params = QMap<QString, QVariant>()); bool exportReport(QString exporterName, const QString &fileName = "", const QMap<QString, QVariant>& params = QMap<QString, QVariant>());
void previewReport(PreviewHints hints = PreviewBarsUserSetting); void previewReport(PreviewHints hints = PreviewBarsUserSetting);