0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 00:33:02 +03:00

Show ToolBar action has been added to preview window

This commit is contained in:
Arin Alex 2016-08-08 15:50:04 +03:00
parent 7ce974090e
commit 4970b09327
13 changed files with 69 additions and 18 deletions

View File

@ -80,12 +80,14 @@ namespace Const{
QString extractClassName(QString className);
enum RenderPass {FirstPass, SecondPass};
enum ArrangeType {AsNeeded, Force};
enum PreviewHint{ShowAllPreviewBars=0,
HidePreviewToolBar=1,
HidePreviewMenuBar=2,
HidePreviewStatusBar=4,
HideAllPreviewBar=7};
enum PreviewHint{ShowAllPreviewBars = 0,
HidePreviewToolBar = 1,
HidePreviewMenuBar = 2,
HidePreviewStatusBar = 4,
HideAllPreviewBar = 7,
PreviewBarsUserSetting = 8};
Q_DECLARE_FLAGS(PreviewHints, PreviewHint)
Q_FLAGS(PreviewHints)
class ReportError : public std::runtime_error{
public:

View File

@ -71,7 +71,7 @@ public:
bool printReport(QPrinter *printer=0);
void printToFile(const QString& fileName);
bool printToPDF(const QString& fileName);
void previewReport(PreviewHints hints = ShowAllPreviewBars);
void previewReport(PreviewHints hints = PreviewBarsUserSetting);
void designReport();
void setShowProgressDialog(bool value);
IDataSourceManager* dataManager();

Binary file not shown.

After

Width:  |  Height:  |  Size: 749 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

View File

@ -80,12 +80,14 @@ namespace Const{
QString extractClassName(QString className);
enum RenderPass {FirstPass, SecondPass};
enum ArrangeType {AsNeeded, Force};
enum PreviewHint{ShowAllPreviewBars=0,
HidePreviewToolBar=1,
HidePreviewMenuBar=2,
HidePreviewStatusBar=4,
HideAllPreviewBar=7};
enum PreviewHint{ShowAllPreviewBars = 0,
HidePreviewToolBar = 1,
HidePreviewMenuBar = 2,
HidePreviewStatusBar = 4,
HideAllPreviewBar = 7,
PreviewBarsUserSetting = 8};
Q_DECLARE_FLAGS(PreviewHints, PreviewHint)
Q_FLAGS(PreviewHints)
class ReportError : public std::runtime_error{
public:

View File

@ -70,6 +70,7 @@ PreviewReportWindow::PreviewReportWindow(ReportEnginePrivate *report,QWidget *pa
connect(m_previewReportWidget, SIGNAL(scalePercentChanged(int)), this, SLOT(slotScalePercentChanged(int)));
connect(m_scalePercent, SIGNAL(currentIndexChanged(QString)), this, SLOT(scaleComboboxChanged(QString)));
restoreSetting();
selectStateIcon();
}
void PreviewReportWindow::writeSetting()
@ -138,7 +139,8 @@ void PreviewReportWindow::setErrorMessages(const QStringList &value){
void PreviewReportWindow::setToolBarVisible(bool value)
{
ui->toolBar->setVisible(value);
ui->toolBar->setHidden(value);
selectStateIcon();
}
void PreviewReportWindow::setStatusBarVisible(bool value)
@ -224,6 +226,15 @@ void PreviewReportWindow::moveEvent(QMoveEvent* e)
#endif
}
void PreviewReportWindow::selectStateIcon()
{
if (ui->toolBar->isHidden()){
ui->actionShow_Toolbar->setIcon(QIcon(":/report/images/not_checked.png"));
} else {
ui->actionShow_Toolbar->setIcon(QIcon(":/report/images/checked.png"));
}
}
void PreviewReportWindow::slotPrint()
{
m_previewReportWidget->print();
@ -327,4 +338,13 @@ void PreviewReportWindow::on_actionShowMessages_toggled(bool value)
m_previewReportWidget->setErrorsMesagesVisible(value);
}
void PreviewReportWindow::on_actionShow_Toolbar_triggered()
{
setToolBarVisible(!ui->toolBar->isHidden());
writeSetting();
}
}// namespace LimeReport

View File

@ -69,6 +69,7 @@ protected:
void closeEvent(QCloseEvent *);
void resizeEvent(QResizeEvent *e);
void moveEvent(QMoveEvent *e);
void selectStateIcon();
public slots:
void slotPrint();
void slotPriorPage();
@ -89,6 +90,7 @@ private slots:
void scaleComboboxChanged(QString text);
void slotScalePercentChanged(int percent);
void on_actionShowMessages_toggled(bool value);
void on_actionShow_Toolbar_triggered();
private:
ItemsReaderIntf* reader();

View File

@ -35,7 +35,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>21</height>
<height>20</height>
</rect>
</property>
<widget class="QMenu" name="menuView">
@ -44,6 +44,8 @@
</property>
<addaction name="actionZoomIn"/>
<addaction name="actionZoomOut"/>
<addaction name="separator"/>
<addaction name="actionShow_Toolbar"/>
</widget>
<widget class="QMenu" name="menuReport">
<property name="title">
@ -254,6 +256,24 @@
<string>One to one</string>
</property>
</action>
<action name="actionShow_Toolbar">
<property name="checkable">
<bool>false</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="icon">
<iconset resource="report.qrc">
<normaloff>:/report/images/toolbar</normaloff>:/report/images/toolbar</iconset>
</property>
<property name="text">
<string>Show Toolbar</string>
</property>
<property name="toolTip">
<string>Show toolbar</string>
</property>
</action>
</widget>
<resources>
<include location="report.qrc"/>

View File

@ -328,9 +328,11 @@ void ReportEnginePrivate::previewReport(PreviewHints hints)
w->setErrorMessages(dataManager()->errorsList());
}
w->setMenuVisible(!hints.testFlag(HidePreviewMenuBar));
w->setStatusBarVisible(!hints.testFlag(HidePreviewStatusBar));
w->setToolBarVisible(!hints.testFlag(HidePreviewToolBar));
if (!hints.testFlag(PreviewBarsUserSetting)){
w->setMenuVisible(!hints.testFlag(HidePreviewMenuBar));
w->setStatusBarVisible(!hints.testFlag(HidePreviewStatusBar));
w->setToolBarVisible(!hints.testFlag(HidePreviewToolBar));
}
m_activePreview = w;
connect(w,SIGNAL(destroyed(QObject*)), this, SLOT(slotPreviewWindowDestroed(QObject*)));

View File

@ -71,7 +71,7 @@ public:
bool printReport(QPrinter *printer=0);
void printToFile(const QString& fileName);
bool printToPDF(const QString& fileName);
void previewReport(PreviewHints hints = ShowAllPreviewBars);
void previewReport(PreviewHints hints = PreviewBarsUserSetting);
void designReport();
void setShowProgressDialog(bool value);
IDataSourceManager* dataManager();

View File

@ -80,7 +80,7 @@ public:
bool printReport(QPrinter *printer=0);
void printToFile(const QString& fileName);
bool printToPDF(const QString& fileName);
void previewReport(PreviewHints hints = ShowAllPreviewBars);
void previewReport(PreviewHints hints = PreviewBarsUserSetting);
void designReport();
void setSettings(QSettings* value);
void setShowProgressDialog(bool value){m_showProgressDialog = value;}

View File

@ -165,5 +165,8 @@
<file>images/FitWidth.png</file>
<file>images/OneToOne.png</file>
<file alias="/images/logo32">images/logo_32x32.png</file>
<file alias="/images/toolbar">images/toolbar.png</file>
<file>images/not_checked.png</file>
<file>images/checked.png</file>
</qresource>
</RCC>