Added hiding (saving, printing, ...) buttons in the Render Report window

This commit is contained in:
Segey 2019-04-10 16:23:50 +03:00
parent a0ab774a2a
commit 64fc4e5b4b
6 changed files with 117 additions and 1 deletions

View File

@ -100,6 +100,12 @@ public:
void setPreviewWindowIcon(const QIcon& icon);
void setResultEditable(bool value);
bool resultIsEditable();
void setSaveToFileVisible(bool value);
bool saveToFileIsVisible();
void setPrintToPdfVisible(bool value);
bool printToPdfIsVisible();
void setPrintVisible(bool value);
bool printIsVisible();
bool isBusy();
void setPassPharse(QString& passPharse);
Qt::LayoutDirection previewLayoutDirection();

View File

@ -176,6 +176,26 @@ void PreviewReportWindow::setHideResultEditButton(bool value)
ui->actionEdit_Mode->setVisible(value);
}
void PreviewReportWindow::setHidePrintButton(bool value)
{
ui->actionPrint->setVisible(value);
}
void PreviewReportWindow::setHideSaveToFileButton(bool value)
{
ui->actionSaveToFile->setVisible(value);
}
void PreviewReportWindow::setHidePrintToPdfButton(bool value)
{
ui->actionPrint_To_PDF->setVisible(value);
}
void PreviewReportWindow::setEnablePrintMenu(bool value)
{
ui->menuReport->setEnabled(value);
}
QSettings*PreviewReportWindow::settings()
{
if (m_settings){

View File

@ -67,6 +67,10 @@ public:
void setStatusBarVisible(bool value);
void setMenuVisible(bool value);
void setHideResultEditButton(bool value);
void setHidePrintButton(bool value);
void setHideSaveToFileButton(bool value);
void setHidePrintToPdfButton(bool value);
void setEnablePrintMenu(bool value);
QSettings* settings();
ScaleType previewScaleType() const;
void setPreviewScaleType(const ScaleType &previewScaleType, int percent = 0);

View File

@ -64,7 +64,8 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) :
m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")),
m_reportRendering(false), m_resultIsEditable(true), m_passPhrase("HjccbzHjlbyfCkjy"),
m_fileWatcher( new QFileSystemWatcher( this ) ), m_previewLayoutDirection(Qt::LayoutDirectionAuto),
m_previewScaleType(FitWidth), m_previewScalePercent(0)
m_previewScaleType(FitWidth), m_previewScalePercent(0), m_saveToFileVisible(true), m_printToPdfVisible(true),
m_printVisible(true)
{
#ifdef HAVE_STATIC_BUILD
initResources();
@ -394,6 +395,10 @@ void ReportEnginePrivate::previewReport(PreviewHints hints)
}
w->setHideResultEditButton(resultIsEditable());
w->setHidePrintButton(printIsVisible());
w->setHideSaveToFileButton(saveToFileIsVisible());
w->setHidePrintToPdfButton(printToPdfIsVisible());
w->setEnablePrintMenu(printIsVisible() || printToPdfIsVisible());
m_activePreview = w;
@ -786,6 +791,36 @@ void ReportEnginePrivate::setResultEditable(bool value)
m_resultIsEditable = value;
}
bool ReportEnginePrivate::saveToFileIsVisible() const
{
return m_saveToFileVisible;
}
void ReportEnginePrivate::setSaveToFileVisible(bool value)
{
m_saveToFileVisible = value;
}
bool ReportEnginePrivate::printToPdfIsVisible() const
{
return m_printToPdfVisible;
}
void ReportEnginePrivate::setPrintToPdfVisible(bool value)
{
m_printToPdfVisible = value;
}
bool ReportEnginePrivate::printIsVisible() const
{
return m_printVisible;
}
void ReportEnginePrivate::setPrintVisible(bool value)
{
m_printVisible = value;
}
bool ReportEnginePrivate::suppressFieldAndVarError() const
{
return m_reportSettings.suppressAbsentFieldsAndVarsWarnings();
@ -948,6 +983,42 @@ bool ReportEngine::resultIsEditable()
return d->resultIsEditable();
}
void ReportEngine::setSaveToFileVisible(bool value)
{
Q_D(ReportEngine);
d->setSaveToFileVisible(value);
}
bool ReportEngine::saveToFileIsVisible()
{
Q_D(ReportEngine);
return d->saveToFileIsVisible();
}
void ReportEngine::setPrintToPdfVisible(bool value)
{
Q_D(ReportEngine);
d->setPrintToPdfVisible(value);
}
bool ReportEngine::printToPdfIsVisible()
{
Q_D(ReportEngine);
return d->printToPdfIsVisible();
}
void ReportEngine::setPrintVisible(bool value)
{
Q_D(ReportEngine);
d->setPrintVisible(value);
}
bool ReportEngine::printIsVisible()
{
Q_D(ReportEngine);
return d->printIsVisible();
}
bool ReportEngine::isBusy()
{
Q_D(ReportEngine);

View File

@ -100,6 +100,12 @@ public:
void setPreviewWindowIcon(const QIcon& icon);
void setResultEditable(bool value);
bool resultIsEditable();
void setSaveToFileVisible(bool value);
bool saveToFileIsVisible();
void setPrintToPdfVisible(bool value);
bool printToPdfIsVisible();
void setPrintVisible(bool value);
bool printIsVisible();
bool isBusy();
void setPassPharse(QString& passPharse);
Qt::LayoutDirection previewLayoutDirection();

View File

@ -126,6 +126,12 @@ public:
bool isBusy();
bool resultIsEditable() const;
void setResultEditable(bool value);
bool saveToFileIsVisible() const;
void setSaveToFileVisible(bool value);
bool printToPdfIsVisible() const;
void setPrintToPdfVisible(bool value);
bool printIsVisible() const;
void setPrintVisible(bool value);
void setPassPhrase(const QString &passPhrase);
void reorderPages(const QList<PageDesignIntf *> &reorderedPages);
@ -192,6 +198,9 @@ private:
Qt::LayoutDirection m_previewLayoutDirection;
ScaleType m_previewScaleType;
int m_previewScalePercent;
bool m_saveToFileVisible;
bool m_printToPdfVisible;
bool m_printVisible;
};
}