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

View File

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

View File

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

View File

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

View File

@ -147,7 +147,7 @@ public:
}
void clearReport();
bool printReport(QPrinter *printer=0);
bool printReport(QPrinter* printer=0);
bool printReport(QMap<QString, QPrinter*>printers, bool printToAllPrinters);
bool printPages(ReportPages pages, QPrinter *printer);
void printToFile(const QString& fileName);