Showing the report designer from a console application has been fixed

This commit is contained in:
Arin Alexander 2020-01-09 21:22:58 +03:00
parent bac1b85170
commit e9e98292f2
6 changed files with 26 additions and 7 deletions

View File

@ -127,7 +127,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
LIMEREPORT_VERSION_MAJOR = 1
LIMEREPORT_VERSION_MINOR = 5
LIMEREPORT_VERSION_RELEASE = 27
LIMEREPORT_VERSION_RELEASE = 28
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"

View File

@ -47,6 +47,7 @@ int main(int argc, char *argv[])
QObject::connect(&report, SIGNAL(currentDefaultDesignerLanguageChanged(QLocale::Language)),
&manager, SLOT(currentDefaultLanguageChanged(QLocale::Language)));
report.setShowDesignerModal(false);
report.designReport();
return a.exec();
}

View File

@ -208,6 +208,9 @@ public:
bool showPreparedPages(PreviewHints hints = PreviewBarsUserSetting);
bool prepareReportPages();
bool printPreparedPages();
bool showDesignerModal() const;
void setShowDesignerModal(bool showDesignerModal);
signals:
void cleared();
void renderStarted();
@ -241,6 +244,7 @@ protected:
private:
Q_DECLARE_PRIVATE(ReportEngine)
static QSettings* m_settings;
bool m_showDesignerModal;
};
} // namespace LimeReport

View File

@ -738,7 +738,7 @@ QGraphicsScene* ReportEngine::createPreviewScene(QObject* parent){
return d->createPreviewScene(parent);
}
void ReportEnginePrivate::designReport()
void ReportEnginePrivate::designReport(bool showModal)
{
ReportDesignWindowInterface* designerWindow = getDesignerWindow();
if (designerWindow){
@ -747,7 +747,7 @@ void ReportEnginePrivate::designReport()
#ifdef Q_OS_WIN
designerWindow->setWindowModality(Qt::ApplicationModal);
#endif
if (QApplication::activeWindow()==0){
if (!showModal){
designerWindow->show();;
} else {
designerWindow->showModal();
@ -1373,7 +1373,7 @@ QString ReportEnginePrivate::lastError()
}
ReportEngine::ReportEngine(QObject *parent)
: QObject(parent), d_ptr(new ReportEnginePrivate())
: QObject(parent), d_ptr(new ReportEnginePrivate()), m_showDesignerModal(true)
{
Q_D(ReportEngine);
d->q_ptr=this;
@ -1469,7 +1469,7 @@ void ReportEngine::designReport()
Q_D(ReportEngine);
if (m_settings)
d->setSettings(m_settings);
d->designReport();
d->designReport(showDesignerModal());
}
ReportDesignWindowInterface* ReportEngine::getDesignerWindow()
@ -1760,7 +1760,7 @@ void ReportEngine::cancelPrinting()
}
ReportEngine::ReportEngine(ReportEnginePrivate &dd, QObject *parent)
:QObject(parent),d_ptr(&dd)
:QObject(parent), d_ptr(&dd), m_showDesignerModal(true)
{
Q_D(ReportEngine);
d->q_ptr=this;
@ -1770,6 +1770,16 @@ ReportEngine::ReportEngine(ReportEnginePrivate &dd, QObject *parent)
connect(d, SIGNAL(renderFinished()), this, SIGNAL(renderFinished()));
}
bool ReportEngine::showDesignerModal() const
{
return m_showDesignerModal;
}
void ReportEngine::setShowDesignerModal(bool showDesignerModal)
{
m_showDesignerModal = showDesignerModal;
}
ScriptEngineManager*LimeReport::ReportEnginePrivate::scriptManager(){
ScriptEngineManager::instance().setContext(scriptContext());
ScriptEngineManager::instance().setDataManager(dataManager());

View File

@ -208,6 +208,9 @@ public:
bool showPreparedPages(PreviewHints hints = PreviewBarsUserSetting);
bool prepareReportPages();
bool printPreparedPages();
bool showDesignerModal() const;
void setShowDesignerModal(bool showDesignerModal);
signals:
void cleared();
void renderStarted();
@ -241,6 +244,7 @@ protected:
private:
Q_DECLARE_PRIVATE(ReportEngine)
static QSettings* m_settings;
bool m_showDesignerModal;
};
} // namespace LimeReport

View File

@ -179,7 +179,7 @@ public:
void previewReport(QPrinter* printer, PreviewHints hints = PreviewBarsUserSetting);
ReportDesignWindowInterface* getDesignerWindow();
void designReport();
void designReport(bool showModal);
void setSettings(QSettings* value);
void setShowProgressDialog(bool value){m_showProgressDialog = value;}
bool isShowProgressDialog() const {return m_showProgressDialog;}