From 7af7a16840872f44c3309c56391aac7dbc08c472 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 3 Feb 2017 14:20:30 +0300 Subject: [PATCH] fix #59 setResultEditable(bool value) has been added --- include/lrreportengine.h | 2 ++ limereport/items/lrtextitem.cpp | 2 +- limereport/lrpreviewreportwindow.cpp | 5 +++++ limereport/lrpreviewreportwindow.h | 1 + limereport/lrreportengine.cpp | 27 ++++++++++++++++++++++++++- limereport/lrreportengine.h | 2 ++ limereport/lrreportengine_p.h | 4 ++++ 7 files changed, 41 insertions(+), 2 deletions(-) diff --git a/include/lrreportengine.h b/include/lrreportengine.h index 8164036..0d5b309 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -98,6 +98,8 @@ public: PreviewReportWidget *createPreviewWidget(QWidget *parent = 0); void setPreviewWindowTitle(const QString& title); void setPreviewWindowIcon(const QIcon& icon); + void setResultEditable(bool value); + bool resultIsEditable(); bool isBusy(); signals: void renderStarted(); diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index d8d77cd..cddcfee 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -645,7 +645,7 @@ bool TextItem::isNeedUpdateSize(RenderPass pass) const { Q_UNUSED(pass) - if (autoHeight() && autoWidth() || hasFollower()){ + if ((autoHeight() && autoWidth()) || hasFollower()){ initTextSizes(); } diff --git a/limereport/lrpreviewreportwindow.cpp b/limereport/lrpreviewreportwindow.cpp index 2d05ad5..b000547 100644 --- a/limereport/lrpreviewreportwindow.cpp +++ b/limereport/lrpreviewreportwindow.cpp @@ -166,6 +166,11 @@ void PreviewReportWindow::setMenuVisible(bool value) ui->menubar->setVisible(value); } +void PreviewReportWindow::setHideResultEditButton(bool value) +{ + ui->actionEdit_Mode->setVisible(value); +} + QSettings*PreviewReportWindow::settings() { if (m_settings){ diff --git a/limereport/lrpreviewreportwindow.h b/limereport/lrpreviewreportwindow.h index 26cf181..bc942be 100644 --- a/limereport/lrpreviewreportwindow.h +++ b/limereport/lrpreviewreportwindow.h @@ -65,6 +65,7 @@ public: void setToolBarVisible(bool value); void setStatusBarVisible(bool value); void setMenuVisible(bool value); + void setHideResultEditButton(bool value); QSettings* settings(); protected: void writeSetting(); diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index edb7ac4..2ea54d9 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -58,7 +58,8 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) : QObject(parent), m_fileName(""), m_settings(0), m_ownedSettings(false), m_printer(new QPrinter(QPrinter::HighResolution)), m_printerSelected(false), m_showProgressDialog(true), m_reportName(""), m_activePreview(0), - m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")), m_reportRendering(false) + m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")), + m_reportRendering(false), m_resultIsEditable(true) { m_datasources = new DataSourceManager(this); m_datasources->setReportSettings(&m_reportSettings); @@ -383,6 +384,8 @@ void ReportEnginePrivate::previewReport(PreviewHints hints) w->setToolBarVisible(!hints.testFlag(HidePreviewToolBar)); } + w->setHideResultEditButton(resultIsEditable()); + m_activePreview = w; connect(w,SIGNAL(destroyed(QObject*)), this, SLOT(slotPreviewWindowDestroed(QObject*))); qDebug()<<"render time ="<setPreviewWindowIcon(icon); } +void ReportEngine::setResultEditable(bool value) +{ + Q_D(ReportEngine); + d->setResultEditable(value); +} + +bool ReportEngine::resultIsEditable() +{ + Q_D(ReportEngine); + return d->resultIsEditable(); +} + bool ReportEngine::isBusy() { Q_D(ReportEngine); diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index 8164036..0d5b309 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -98,6 +98,8 @@ public: PreviewReportWidget *createPreviewWidget(QWidget *parent = 0); void setPreviewWindowTitle(const QString& title); void setPreviewWindowIcon(const QIcon& icon); + void setResultEditable(bool value); + bool resultIsEditable(); bool isBusy(); signals: void renderStarted(); diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index 2a6e230..85aff24 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -122,6 +122,9 @@ public: bool suppressFieldAndVarError() const; void setSuppressFieldAndVarError(bool suppressFieldAndVarError); bool isBusy(); + bool resultIsEditable() const; + void setResultEditable(bool value); + signals: void pagesLoadFinished(); void datasourceCollectionLoadFinished(const QString& collectionName); @@ -171,6 +174,7 @@ private: QPointer m_designerWindow; ReportSettings m_reportSettings; bool m_reportRendering; + bool m_resultIsEditable; }; }