0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-25 00:54:39 +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); QString extractClassName(QString className);
enum RenderPass {FirstPass, SecondPass}; enum RenderPass {FirstPass, SecondPass};
enum ArrangeType {AsNeeded, Force}; enum ArrangeType {AsNeeded, Force};
enum PreviewHint{ShowAllPreviewBars=0, enum PreviewHint{ShowAllPreviewBars = 0,
HidePreviewToolBar=1, HidePreviewToolBar = 1,
HidePreviewMenuBar=2, HidePreviewMenuBar = 2,
HidePreviewStatusBar=4, HidePreviewStatusBar = 4,
HideAllPreviewBar=7}; HideAllPreviewBar = 7,
PreviewBarsUserSetting = 8};
Q_DECLARE_FLAGS(PreviewHints, PreviewHint) Q_DECLARE_FLAGS(PreviewHints, PreviewHint)
Q_FLAGS(PreviewHints)
class ReportError : public std::runtime_error{ class ReportError : public std::runtime_error{
public: public:

View File

@ -71,7 +71,7 @@ public:
bool printReport(QPrinter *printer=0); bool printReport(QPrinter *printer=0);
void printToFile(const QString& fileName); void printToFile(const QString& fileName);
bool printToPDF(const QString& fileName); bool printToPDF(const QString& fileName);
void previewReport(PreviewHints hints = ShowAllPreviewBars); void previewReport(PreviewHints hints = PreviewBarsUserSetting);
void designReport(); void designReport();
void setShowProgressDialog(bool value); void setShowProgressDialog(bool value);
IDataSourceManager* dataManager(); 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); QString extractClassName(QString className);
enum RenderPass {FirstPass, SecondPass}; enum RenderPass {FirstPass, SecondPass};
enum ArrangeType {AsNeeded, Force}; enum ArrangeType {AsNeeded, Force};
enum PreviewHint{ShowAllPreviewBars=0, enum PreviewHint{ShowAllPreviewBars = 0,
HidePreviewToolBar=1, HidePreviewToolBar = 1,
HidePreviewMenuBar=2, HidePreviewMenuBar = 2,
HidePreviewStatusBar=4, HidePreviewStatusBar = 4,
HideAllPreviewBar=7}; HideAllPreviewBar = 7,
PreviewBarsUserSetting = 8};
Q_DECLARE_FLAGS(PreviewHints, PreviewHint) Q_DECLARE_FLAGS(PreviewHints, PreviewHint)
Q_FLAGS(PreviewHints)
class ReportError : public std::runtime_error{ class ReportError : public std::runtime_error{
public: 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_previewReportWidget, SIGNAL(scalePercentChanged(int)), this, SLOT(slotScalePercentChanged(int)));
connect(m_scalePercent, SIGNAL(currentIndexChanged(QString)), this, SLOT(scaleComboboxChanged(QString))); connect(m_scalePercent, SIGNAL(currentIndexChanged(QString)), this, SLOT(scaleComboboxChanged(QString)));
restoreSetting(); restoreSetting();
selectStateIcon();
} }
void PreviewReportWindow::writeSetting() void PreviewReportWindow::writeSetting()
@ -138,7 +139,8 @@ void PreviewReportWindow::setErrorMessages(const QStringList &value){
void PreviewReportWindow::setToolBarVisible(bool value) void PreviewReportWindow::setToolBarVisible(bool value)
{ {
ui->toolBar->setVisible(value); ui->toolBar->setHidden(value);
selectStateIcon();
} }
void PreviewReportWindow::setStatusBarVisible(bool value) void PreviewReportWindow::setStatusBarVisible(bool value)
@ -224,6 +226,15 @@ void PreviewReportWindow::moveEvent(QMoveEvent* e)
#endif #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() void PreviewReportWindow::slotPrint()
{ {
m_previewReportWidget->print(); m_previewReportWidget->print();
@ -327,4 +338,13 @@ void PreviewReportWindow::on_actionShowMessages_toggled(bool value)
m_previewReportWidget->setErrorsMesagesVisible(value); m_previewReportWidget->setErrorsMesagesVisible(value);
} }
void PreviewReportWindow::on_actionShow_Toolbar_triggered()
{
setToolBarVisible(!ui->toolBar->isHidden());
writeSetting();
}
}// namespace LimeReport }// namespace LimeReport

View File

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

View File

@ -35,7 +35,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>800</width>
<height>21</height> <height>20</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuView"> <widget class="QMenu" name="menuView">
@ -44,6 +44,8 @@
</property> </property>
<addaction name="actionZoomIn"/> <addaction name="actionZoomIn"/>
<addaction name="actionZoomOut"/> <addaction name="actionZoomOut"/>
<addaction name="separator"/>
<addaction name="actionShow_Toolbar"/>
</widget> </widget>
<widget class="QMenu" name="menuReport"> <widget class="QMenu" name="menuReport">
<property name="title"> <property name="title">
@ -254,6 +256,24 @@
<string>One to one</string> <string>One to one</string>
</property> </property>
</action> </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> </widget>
<resources> <resources>
<include location="report.qrc"/> <include location="report.qrc"/>

View File

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

View File

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

View File

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

View File

@ -165,5 +165,8 @@
<file>images/FitWidth.png</file> <file>images/FitWidth.png</file>
<file>images/OneToOne.png</file> <file>images/OneToOne.png</file>
<file alias="/images/logo32">images/logo_32x32.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> </qresource>
</RCC> </RCC>