0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-25 00:54:39 +03:00

Merge branch 'master' into 1.4

Conflicts:
	limereport/lrpreviewreportwindow.cpp
	limereport/lrpreviewreportwindow.h
	limereport/report.qrc
This commit is contained in:
Arin Alex 2016-08-08 15:53:39 +03:00
commit 4370182106
15 changed files with 84 additions and 20 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

@ -77,7 +77,7 @@ public:
void printToFile(const QString& fileName); void printToFile(const QString& fileName);
PageDesignIntf *createPreviewScene(QObject *parent = 0); PageDesignIntf *createPreviewScene(QObject *parent = 0);
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

@ -448,9 +448,11 @@ BaseDesignIntf* BandDesignIntf::cloneUpperPart(int height, QObject *owner, QGrap
} else if (item->canBeSplitted(sliceHeight)){ } else if (item->canBeSplitted(sliceHeight)){
upperItem = item->cloneUpperPart(sliceHeight,upperPart,upperPart); upperItem = item->cloneUpperPart(sliceHeight,upperPart,upperPart);
if (maxBottom<upperItem->geometry().bottom()) maxBottom = upperItem->geometry().bottom(); if (maxBottom<upperItem->geometry().bottom()) maxBottom = upperItem->geometry().bottom();
m_slicedItems.insert(upperItem->objectName(),upperItem);
} else { } else {
item->cloneEmpty(sliceHeight,upperPart,upperPart); //for table item->cloneEmpty(sliceHeight,upperPart,upperPart); //for table
qgItem->setPos(item->pos().x(),item->pos().y()+((height+1)-item->geometry().top())); moveItemsDown(item->pos().y(),(height+1)-item->geometry().top());
//qgItem->setPos(item->pos().x(),item->pos().y()+((height+1)-item->geometry().top()));
} }
} }
} }
@ -460,12 +462,20 @@ BaseDesignIntf* BandDesignIntf::cloneUpperPart(int height, QObject *owner, QGrap
return upperPart; return upperPart;
} }
bool itemLessThen(QGraphicsItem* i1, QGraphicsItem* i2){
return i1->pos().y()<i2->pos().y();
}
BaseDesignIntf *BandDesignIntf::cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent) BaseDesignIntf *BandDesignIntf::cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent)
{ {
BandDesignIntf* bottomPart = dynamic_cast<BandDesignIntf*>(createSameTypeItem(owner,parent)); BandDesignIntf* bottomPart = dynamic_cast<BandDesignIntf*>(createSameTypeItem(owner,parent));
bottomPart->initFromItem(this); bottomPart->initFromItem(this);
foreach(QGraphicsItem* qgItem,childItems()){ QList<QGraphicsItem*> bandItems;
bandItems = childItems();
std::sort(bandItems.begin(),bandItems.end(), itemLessThen);
foreach(QGraphicsItem* qgItem, bandItems){
BaseDesignIntf* item = dynamic_cast<BaseDesignIntf*>(qgItem); BaseDesignIntf* item = dynamic_cast<BaseDesignIntf*>(qgItem);
if (item){ if (item){
@ -479,6 +489,9 @@ BaseDesignIntf *BandDesignIntf::cloneBottomPart(int height, QObject *owner, QGra
BaseDesignIntf* tmpItem=item->cloneBottomPart(sliceHeight,bottomPart,bottomPart); BaseDesignIntf* tmpItem=item->cloneBottomPart(sliceHeight,bottomPart,bottomPart);
tmpItem->setPos(tmpItem->pos().x(),0); tmpItem->setPos(tmpItem->pos().x(),0);
if (tmpItem->pos().y()<0) tmpItem->setPos(tmpItem->pos().x(),0); if (tmpItem->pos().y()<0) tmpItem->setPos(tmpItem->pos().x(),0);
qreal sizeOffset = (m_slicedItems.value(tmpItem->objectName())->height()+tmpItem->height()) - item->height();
qreal bottomOffset = (height - m_slicedItems.value(tmpItem->objectName())->pos().y())-m_slicedItems.value(tmpItem->objectName())->height();
moveItemsDown(item->pos().y()+item->height(), sizeOffset + bottomOffset);
} }
else if (item->isSplittable()){ else if (item->isSplittable()){
BaseDesignIntf* tmpItem = item->cloneItem(item->itemMode(),bottomPart,bottomPart); BaseDesignIntf* tmpItem = item->cloneItem(item->itemMode(),bottomPart,bottomPart);

View File

@ -268,6 +268,7 @@ private:
bool m_startFromNewPage; bool m_startFromNewPage;
bool m_printAlways; bool m_printAlways;
bool m_repeatOnEachRow; bool m_repeatOnEachRow;
QMap<QString,BaseDesignIntf*> m_slicedItems;
}; };
class DataBandDesignIntf : public BandDesignIntf{ class DataBandDesignIntf : public BandDesignIntf{

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

@ -83,6 +83,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()
@ -151,7 +152,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)
@ -242,6 +244,14 @@ void PreviewReportWindow::showEvent(QShowEvent *)
m_fontEditor->setVisible(ui->actionEdit_Mode->isChecked()); m_fontEditor->setVisible(ui->actionEdit_Mode->isChecked());
m_textAlignmentEditor->setVisible(ui->actionEdit_Mode->isChecked()); m_textAlignmentEditor->setVisible(ui->actionEdit_Mode->isChecked());
} }
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()
{ {
@ -368,4 +378,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

@ -73,6 +73,7 @@ protected:
void resizeEvent(QResizeEvent *e); void resizeEvent(QResizeEvent *e);
void moveEvent(QMoveEvent *e); void moveEvent(QMoveEvent *e);
void showEvent(QShowEvent *); void showEvent(QShowEvent *);
void selectStateIcon();
public slots: public slots:
void slotPrint(); void slotPrint();
void slotPriorPage(); void slotPriorPage();
@ -95,6 +96,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">
@ -256,6 +258,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

@ -376,9 +376,11 @@ void ReportEnginePrivate::previewReport(PreviewHints hints)
w->setErrorMessages(dataManager()->errorsList()); w->setErrorMessages(dataManager()->errorsList());
} }
if (!hints.testFlag(PreviewBarsUserSetting)){
w->setMenuVisible(!hints.testFlag(HidePreviewMenuBar)); w->setMenuVisible(!hints.testFlag(HidePreviewMenuBar));
w->setStatusBarVisible(!hints.testFlag(HidePreviewStatusBar)); w->setStatusBarVisible(!hints.testFlag(HidePreviewStatusBar));
w->setToolBarVisible(!hints.testFlag(HidePreviewToolBar)); 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

@ -77,7 +77,7 @@ public:
void printToFile(const QString& fileName); void printToFile(const QString& fileName);
PageDesignIntf *createPreviewScene(QObject *parent = 0); PageDesignIntf *createPreviewScene(QObject *parent = 0);
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

@ -86,7 +86,7 @@ public:
bool printPages(ReportPages pages, QPrinter *printer, PrintRange printRange = PrintRange()); bool printPages(ReportPages pages, QPrinter *printer, PrintRange printRange = PrintRange());
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

@ -167,5 +167,8 @@
<file alias="/images/logo32">images/logo_32x32.png</file> <file alias="/images/logo32">images/logo_32x32.png</file>
<file alias="/images/addPage">images/addPage1.png</file> <file alias="/images/addPage">images/addPage1.png</file>
<file alias="/images/deletePage">images/deletePage1.png</file> <file alias="/images/deletePage">images/deletePage1.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>