From 4970b093270fbf75eea5cd2c5f3e0fe52d0f09ca Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Mon, 8 Aug 2016 15:50:04 +0300 Subject: [PATCH 1/2] Show ToolBar action has been added to preview window --- include/lrglobal.h | 12 +++++++----- include/lrreportengine.h | 2 +- limereport/images/checked.png | Bin 0 -> 749 bytes limereport/images/not_checked.png | Bin 0 -> 666 bytes limereport/images/toolbar.png | Bin 0 -> 346 bytes limereport/lrglobal.h | 12 +++++++----- limereport/lrpreviewreportwindow.cpp | 22 +++++++++++++++++++++- limereport/lrpreviewreportwindow.h | 2 ++ limereport/lrpreviewreportwindow.ui | 22 +++++++++++++++++++++- limereport/lrreportengine.cpp | 8 +++++--- limereport/lrreportengine.h | 2 +- limereport/lrreportengine_p.h | 2 +- limereport/report.qrc | 3 +++ 13 files changed, 69 insertions(+), 18 deletions(-) create mode 100644 limereport/images/checked.png create mode 100644 limereport/images/not_checked.png create mode 100644 limereport/images/toolbar.png diff --git a/include/lrglobal.h b/include/lrglobal.h index be094a4..0894ee0 100644 --- a/include/lrglobal.h +++ b/include/lrglobal.h @@ -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: diff --git a/include/lrreportengine.h b/include/lrreportengine.h index f89db86..48ce408 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -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(); diff --git a/limereport/images/checked.png b/limereport/images/checked.png new file mode 100644 index 0000000000000000000000000000000000000000..e505891125522cfc6e324256d8788e5be070acf0 GIT binary patch literal 749 zcmV0FsKHZ3Z@VTyWVka*)&cojkv3^K3lvTnKwF9RXi zU3k+?(Nz*zk*h6C{6Za$KNDpTmuGxR)w-Er6~XrLj>6e0>CgZ zFi=KUK_ z4O>y=^@H@DBeF4P-P(y+_0uJ`;=;1?ZhQUO*YMlJ!=scFm~QT^isqS?fd&u~F(eosO@nMy z+iG!FHsC0|h@BOhFXq)cOFER%26q`9{$0bEHR9W=#~%VD>@VXeqos%*ML zvlTf~d6xW@t)2DYh<|8jb!({(_z1l4c?0`dA8Z4|g4pL)1D#J^--)(3yZl)reG9)! zPek6kc2bE(K_*Q%CjVt+k3toi)5b6|h9G-D&;-x=yn&0| fSY3cjt~mb&)L{wY$`*AS00000NkvXXu0mjfrA|(y literal 0 HcmV?d00001 diff --git a/limereport/images/not_checked.png b/limereport/images/not_checked.png new file mode 100644 index 0000000000000000000000000000000000000000..daf1aa32b2a80029a9e420d9bbdf688865968e33 GIT binary patch literal 666 zcmV;L0%iS)P)GVp}={`vKL~($v_-rt_W)XC%t_apA4*J?Gwc?>Rz9T)W?E0Ko%L zfGQRo^?R*^0Na5cpbzNsQ}e(CFa>Ni6G;=;1Wp4(K(8QC5kmm9R$8NX00$TW-WCgv z_mjZyoCaxRg!i7jpJM1fcAWH6|d}hM3??>#la0M^J*(9Zt{v}QX^BKdetfa6w72y6%W8SFG+bNWSV#lUfd|EcvlHlG z3mDPp_`7AN|L()9i`itp6bR{+`=l{hd1}|{n`bn7%2#9cZ&J<)(&}#;r97q4+d$a| z&lC&J-v5~CxSyH>O1_z@p=JspGMn-m@WSl;9aj|G>AkJ}?EnA(07*qoM6N<$f@RAm AU;qFB literal 0 HcmV?d00001 diff --git a/limereport/images/toolbar.png b/limereport/images/toolbar.png new file mode 100644 index 0000000000000000000000000000000000000000..06e630050ab2b52ce623b6aadf4cb4039ba39f1d GIT binary patch literal 346 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPN2a^aR-_lgoCZLdHiEBiObAE1aYF-J0b5UwyNotBh zd1gt5g1e`0KzJjcI8f0cPZ!4!i_=#pZR9;m z`MudMW1OF#dty{OMENooCGYk#>sCqCdM8+*x<$b@Qqw0gy zHPxelF{r5}E)(dwg;L literal 0 HcmV?d00001 diff --git a/limereport/lrglobal.h b/limereport/lrglobal.h index be094a4..0894ee0 100644 --- a/limereport/lrglobal.h +++ b/limereport/lrglobal.h @@ -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: diff --git a/limereport/lrpreviewreportwindow.cpp b/limereport/lrpreviewreportwindow.cpp index 53f78cb..788ab5b 100644 --- a/limereport/lrpreviewreportwindow.cpp +++ b/limereport/lrpreviewreportwindow.cpp @@ -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 + + + diff --git a/limereport/lrpreviewreportwindow.h b/limereport/lrpreviewreportwindow.h index 5efacdd..50243e1 100644 --- a/limereport/lrpreviewreportwindow.h +++ b/limereport/lrpreviewreportwindow.h @@ -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(); diff --git a/limereport/lrpreviewreportwindow.ui b/limereport/lrpreviewreportwindow.ui index 7618999..7db29c1 100644 --- a/limereport/lrpreviewreportwindow.ui +++ b/limereport/lrpreviewreportwindow.ui @@ -35,7 +35,7 @@ 0 0 800 - 21 + 20 @@ -44,6 +44,8 @@ + + @@ -254,6 +256,24 @@ One to one + + + false + + + false + + + + :/report/images/toolbar:/report/images/toolbar + + + Show Toolbar + + + Show toolbar + + diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index c52eef2..b924f43 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -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*))); diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index f89db86..48ce408 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -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(); diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index a88e6ca..ecadd87 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -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;} diff --git a/limereport/report.qrc b/limereport/report.qrc index ad0f243..0c3c2ea 100644 --- a/limereport/report.qrc +++ b/limereport/report.qrc @@ -165,5 +165,8 @@ images/FitWidth.png images/OneToOne.png images/logo_32x32.png + images/toolbar.png + images/not_checked.png + images/checked.png From 1320c6f8ee061db09311c5d98c6b7c6f32a1bbb7 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Mon, 8 Aug 2016 15:50:44 +0300 Subject: [PATCH 2/2] Spliting band has been fixed --- limereport/lrbanddesignintf.cpp | 17 +++++++++++++++-- limereport/lrbanddesignintf.h | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index 2cf1707..b961a0d 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -448,9 +448,11 @@ BaseDesignIntf* BandDesignIntf::cloneUpperPart(int height, QObject *owner, QGrap } else if (item->canBeSplitted(sliceHeight)){ upperItem = item->cloneUpperPart(sliceHeight,upperPart,upperPart); if (maxBottomgeometry().bottom()) maxBottom = upperItem->geometry().bottom(); + m_slicedItems.insert(upperItem->objectName(),upperItem); } else { 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; } +bool itemLessThen(QGraphicsItem* i1, QGraphicsItem* i2){ + return i1->pos().y()pos().y(); +} + BaseDesignIntf *BandDesignIntf::cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent) { BandDesignIntf* bottomPart = dynamic_cast(createSameTypeItem(owner,parent)); bottomPart->initFromItem(this); - foreach(QGraphicsItem* qgItem,childItems()){ + QList bandItems; + bandItems = childItems(); + std::sort(bandItems.begin(),bandItems.end(), itemLessThen); + + foreach(QGraphicsItem* qgItem, bandItems){ BaseDesignIntf* item = dynamic_cast(qgItem); if (item){ @@ -479,6 +489,9 @@ BaseDesignIntf *BandDesignIntf::cloneBottomPart(int height, QObject *owner, QGra BaseDesignIntf* tmpItem=item->cloneBottomPart(sliceHeight,bottomPart,bottomPart); 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()){ BaseDesignIntf* tmpItem = item->cloneItem(item->itemMode(),bottomPart,bottomPart); diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index 6b7fb06..d78b82d 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -268,6 +268,7 @@ private: bool m_startFromNewPage; bool m_printAlways; bool m_repeatOnEachRow; + QMap m_slicedItems; }; class DataBandDesignIntf : public BandDesignIntf{