@ -24,3 +24,4 @@ script:
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
|
@ -1,8 +1,5 @@
|
||||
LimeReport v1.3.10 [![Build Status](https://travis-ci.org/newsages/LimeReport.svg?branch=master)](https://travis-ci.org/newsages/LimeReport)
|
||||
LimeReport v1.3.10 [![Build Status](https://api.travis-ci.org/fralx/LimeReport.svg?branch=master)](https://travis-ci.org/fralx/LimeReport)
|
||||
-----------
|
||||
-----------
|
||||
|
||||
|
||||
|
||||
##Features
|
||||
* Multi-platform support
|
||||
|
@ -1,15 +1,6 @@
|
||||
include(../common.pri)
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4){
|
||||
QT += widgets printsupport
|
||||
DEFINES += HAVE_QT5
|
||||
}
|
||||
|
||||
macx{
|
||||
CONFIG += app_bundle
|
||||
}
|
||||
|
||||
TARGET = LRDemo
|
||||
TEMPLATE = app
|
||||
|
||||
@ -27,8 +18,12 @@ RESOURCES += \
|
||||
r1.qrc
|
||||
|
||||
EXTRA_DIR += $$PWD/demo_reports
|
||||
DEST_DIR = $${BUILD_DIR}/$${BUILD_TYPE}/demo
|
||||
REPORTS_DIR = $${DEST_DIR}/demo_reports
|
||||
DEST_DIR = $${BUILD_DIR}/$${BUILD_TYPE}/demo_r1
|
||||
REPORTS_DIR = $${DEST_DIR}
|
||||
|
||||
macx{
|
||||
CONFIG += app_bundle
|
||||
}
|
||||
|
||||
unix:{
|
||||
LIBS += -L$${BUILD_DIR}/$${BUILD_TYPE}/lib -llimereport
|
||||
@ -36,7 +31,8 @@ unix:{
|
||||
LIBS += -L$${BUILD_DIR}/$${BUILD_TYPE}/lib -lQtZint
|
||||
}
|
||||
DESTDIR = $$DEST_DIR
|
||||
QMAKE_POST_LINK += mkdir -p $$quote($$REPORTS_DIR) | $$QMAKE_COPY $$quote($$EXTRA_DIR)/* $$quote($$REPORTS_DIR) $$escape_expand(\n\t)
|
||||
# QMAKE_POST_LINK += mkdir -p $$quote($$REPORTS_DIR) |
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR) $$quote($$REPORTS_DIR) $$escape_expand(\n\t)
|
||||
linux{
|
||||
#Link share lib to ../lib rpath
|
||||
QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN
|
||||
@ -56,6 +52,11 @@ win32 {
|
||||
DESTDIR = $$DEST_DIR
|
||||
RC_FILE += mainicon.rc
|
||||
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR) $$quote($$REPORTS_DIR) $$escape_expand(\\n\\t)
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR\\*) $$quote($$REPORTS_DIR\\demo_reports) $$escape_expand(\\n\\t)
|
||||
contains(CONFIG,zint){
|
||||
LIBS += -L$${BUILD_DIR}/$${BUILD_TYPE}/lib -lQtZint
|
||||
}
|
||||
LIBS += -L$${BUILD_DIR}/$${BUILD_TYPE}/lib -llimereport
|
||||
}
|
||||
|
||||
|
||||
|
62
demo_r2/demo_r2.pro
Normal file
@ -0,0 +1,62 @@
|
||||
include(../common.pri)
|
||||
QT += core gui
|
||||
|
||||
TARGET = LRDemo
|
||||
TEMPLATE = app
|
||||
|
||||
SOURCES += main.cpp\
|
||||
mainwindow.cpp
|
||||
|
||||
HEADERS += mainwindow.h
|
||||
|
||||
FORMS += mainwindow.ui
|
||||
|
||||
INCLUDEPATH += $$PWD/../include
|
||||
DEPENDPATH += $$PWD/../include
|
||||
|
||||
RESOURCES += \
|
||||
demo_r2.qrc
|
||||
|
||||
EXTRA_DIR += $$PWD/demo_reports
|
||||
DEST_DIR = $${BUILD_DIR}/$${BUILD_TYPE}/demo_r2
|
||||
REPORTS_DIR = $${DEST_DIR}
|
||||
|
||||
macx{
|
||||
CONFIG += app_bundle
|
||||
}
|
||||
|
||||
unix:{
|
||||
LIBS += -L$${BUILD_DIR}/$${BUILD_TYPE}/lib -llimereport
|
||||
contains(CONFIG,zint){
|
||||
LIBS += -L$${BUILD_DIR}/$${BUILD_TYPE}/lib -lQtZint
|
||||
}
|
||||
DESTDIR = $$DEST_DIR
|
||||
# QMAKE_POST_LINK += mkdir -p $$quote($$REPORTS_DIR) |
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR) $$quote($$REPORTS_DIR) $$escape_expand(\n\t)
|
||||
linux{
|
||||
#Link share lib to ../lib rpath
|
||||
QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN
|
||||
QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN/lib
|
||||
QMAKE_LFLAGS += -Wl,--rpath=\\\$\$ORIGIN/../lib
|
||||
QMAKE_LFLAGS_RPATH += #. .. ./libs
|
||||
}
|
||||
target.path = $${DEST_DIR}
|
||||
INSTALLS = target
|
||||
}
|
||||
|
||||
win32 {
|
||||
EXTRA_DIR ~= s,/,\\,g
|
||||
DEST_DIR ~= s,/,\\,g
|
||||
REPORTS_DIR ~= s,/,\\,g
|
||||
|
||||
DESTDIR = $$DEST_DIR
|
||||
RC_FILE += mainicon.rc
|
||||
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR\\*) $$quote($$REPORTS_DIR\\demo_reports) $$escape_expand(\\n\\t)
|
||||
contains(CONFIG,zint){
|
||||
LIBS += -L$${BUILD_DIR}/$${BUILD_TYPE}/lib -lQtZint
|
||||
}
|
||||
LIBS += -L$${BUILD_DIR}/$${BUILD_TYPE}/lib -llimereport
|
||||
}
|
||||
|
||||
|
21
demo_r2/demo_r2.qrc
Normal file
@ -0,0 +1,21 @@
|
||||
<RCC>
|
||||
<qresource prefix="/images">
|
||||
<file>images/lr.png</file>
|
||||
<file>images/logo.png</file>
|
||||
<file alias="/images/folder.png">images/folder3.png</file>
|
||||
<file alias="/images/report.png">images/new_leaf1.png</file>
|
||||
<file>images/logo1.png</file>
|
||||
<file>images/design.png</file>
|
||||
<file>images/PDF.png</file>
|
||||
<file>images/ZoomIn.png</file>
|
||||
<file>images/ZoomOut.png</file>
|
||||
<file>images/First.png</file>
|
||||
<file>images/Last.png</file>
|
||||
<file>images/Next.png</file>
|
||||
<file>images/Prev.png</file>
|
||||
<file>images/Print.png</file>
|
||||
<file>images/FitWidth.png</file>
|
||||
<file>images/FitPage.png</file>
|
||||
<file>images/OneToOne.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
227
demo_r2/demo_reports/categories.lrxml
Normal file
@ -0,0 +1,227 @@
|
||||
<Report>
|
||||
<object Type="Object" ClassName="LimeReport::ReportEnginePrivate">
|
||||
<objectName Type="QString"></objectName>
|
||||
<pages Type="Collection">
|
||||
<item Type="Object" ClassName="LimeReport::PageDesignIntf">
|
||||
<objectName Type="QString">page1</objectName>
|
||||
<sceneRect Type="QRect" x="-50" y="-50" width="2200" height="3070"/>
|
||||
<bspTreeDepth Value="5" Type="int"/>
|
||||
<font pointSize="9" italic="0" Type="QFont" bold="0" family="Sans Serif" underline="0"/>
|
||||
<sortCacheEnabled Value="0" Type="bool"/>
|
||||
<stickyFocus Value="0" Type="bool"/>
|
||||
<minimumRenderSize Value="0" Type="qreal"/>
|
||||
<pageItem Type="Object" ClassName="PageItem">
|
||||
<objectName Type="QString">ReportPage1</objectName>
|
||||
<geometry Type="QRect" x="0" y="0" width="2100" height="2970"/>
|
||||
<children Type="Collection">
|
||||
<item Type="Object" ClassName="Data">
|
||||
<objectName Type="QString">DataBand1</objectName>
|
||||
<geometry Type="QRect" x="50" y="50" width="2000" height="100"/>
|
||||
<children Type="Collection">
|
||||
<item Type="Object" ClassName="ImageItem">
|
||||
<objectName Type="QString">ImageItem1</objectName>
|
||||
<geometry Type="QRect" x="54" y="22" width="200" height="50"/>
|
||||
<children Type="Collection"/>
|
||||
<zOrder Value="0" Type="qreal"/>
|
||||
<borders Value="0" Type="enumAndFlags"/>
|
||||
<parentName Type="QString">DataBand1</parentName>
|
||||
<borderLineSize Value="1" Type="int"/>
|
||||
<isVisible Value="1" Type="bool"/>
|
||||
<itemLocation Value="0" Type="enumAndFlags"/>
|
||||
<stretchToMaxHeight Value="0" Type="bool"/>
|
||||
<itemAlign Value="4" Type="enumAndFlags"/>
|
||||
<image Type="QImage"></image>
|
||||
<opacity Value="100" Type="int"/>
|
||||
<datasource Type="QString">category</datasource>
|
||||
<field Type="QString">Picture</field>
|
||||
<autoSize Value="1" Type="bool"/>
|
||||
<scale Value="1" Type="bool"/>
|
||||
<keepAspectRatio Value="1" Type="bool"/>
|
||||
<center Value="1" Type="bool"/>
|
||||
</item>
|
||||
</children>
|
||||
<zOrder Value="0" Type="qreal"/>
|
||||
<borders Value="0" Type="enumAndFlags"/>
|
||||
<parentName Type="QString">ReportPage1</parentName>
|
||||
<borderLineSize Value="1" Type="int"/>
|
||||
<isVisible Value="1" Type="bool"/>
|
||||
<autoHeight Value="1" Type="bool"/>
|
||||
<bandIndex Value="0" Type="int"/>
|
||||
<keepBottomSpace Value="0" Type="bool"/>
|
||||
<parentBand Type="QString"></parentBand>
|
||||
<backgroundColor Value="#ffffff" Type="QColor"/>
|
||||
<printIfEmpty Value="0" Type="bool"/>
|
||||
<datasource Type="QString">category</datasource>
|
||||
<keepSubdetailTogether Value="0" Type="bool"/>
|
||||
<splittable Value="0" Type="bool"/>
|
||||
<keepFooterTogether Value="0" Type="bool"/>
|
||||
<sliceLastRow Value="0" Type="bool"/>
|
||||
<columnsCount Value="1" Type="int"/>
|
||||
<columnsFillDirection Value="0" Type="enumAndFlags"/>
|
||||
<startNewPage Value="0" Type="bool"/>
|
||||
</item>
|
||||
<item Type="Object" ClassName="SubDetail">
|
||||
<objectName Type="QString">SubDetailBand1</objectName>
|
||||
<geometry Type="QRect" x="50" y="154" width="2000" height="100"/>
|
||||
<children Type="Collection">
|
||||
<item Type="Object" ClassName="TextItem">
|
||||
<objectName Type="QString">TextItem1</objectName>
|
||||
<geometry Type="QRect" x="66" y="22" width="614" height="50"/>
|
||||
<children Type="Collection"/>
|
||||
<zOrder Value="0" Type="qreal"/>
|
||||
<borders Value="0" Type="enumAndFlags"/>
|
||||
<parentName Type="QString">SubDetailBand1</parentName>
|
||||
<borderLineSize Value="1" Type="int"/>
|
||||
<isVisible Value="1" Type="bool"/>
|
||||
<itemLocation Value="0" Type="enumAndFlags"/>
|
||||
<stretchToMaxHeight Value="0" Type="bool"/>
|
||||
<itemAlign Value="4" Type="enumAndFlags"/>
|
||||
<content Type="QString">$D{products.ProductName}</content>
|
||||
<margin Value="4" Type="int"/>
|
||||
<alignment Value="33" Type="enumAndFlags"/>
|
||||
<autoWidth Value="0" Type="enumAndFlags"/>
|
||||
<autoHeight Value="1" Type="bool"/>
|
||||
<font pointSize="10" italic="0" Type="QFont" bold="0" family="Arial" underline="0"/>
|
||||
<backgroundOpacity Value="100" Type="int"/>
|
||||
<backgroundMode Value="0" Type="enumAndFlags"/>
|
||||
<backgroundColor Value="#ffffff" Type="QColor"/>
|
||||
<fontColor Value="#000000" Type="QColor"/>
|
||||
<angle Value="0" Type="enumAndFlags"/>
|
||||
<foregroundOpacity Value="100" Type="int"/>
|
||||
<trimValue Value="1" Type="bool"/>
|
||||
<allowHTML Value="0" Type="bool"/>
|
||||
</item>
|
||||
<item Type="Object" ClassName="TextItem">
|
||||
<objectName Type="QString">TextItem2</objectName>
|
||||
<geometry Type="QRect" x="688" y="22" width="250" height="50"/>
|
||||
<children Type="Collection"/>
|
||||
<zOrder Value="0" Type="qreal"/>
|
||||
<borders Value="0" Type="enumAndFlags"/>
|
||||
<parentName Type="QString">SubDetailBand1</parentName>
|
||||
<borderLineSize Value="1" Type="int"/>
|
||||
<isVisible Value="1" Type="bool"/>
|
||||
<itemLocation Value="0" Type="enumAndFlags"/>
|
||||
<stretchToMaxHeight Value="0" Type="bool"/>
|
||||
<itemAlign Value="4" Type="enumAndFlags"/>
|
||||
<content Type="QString">$D{products.UnitPrice}</content>
|
||||
<margin Value="4" Type="int"/>
|
||||
<alignment Value="33" Type="enumAndFlags"/>
|
||||
<autoWidth Value="0" Type="enumAndFlags"/>
|
||||
<autoHeight Value="0" Type="bool"/>
|
||||
<font pointSize="10" italic="0" Type="QFont" bold="0" family="Arial" underline="0"/>
|
||||
<backgroundOpacity Value="100" Type="int"/>
|
||||
<backgroundMode Value="0" Type="enumAndFlags"/>
|
||||
<backgroundColor Value="#ffffff" Type="QColor"/>
|
||||
<fontColor Value="#000000" Type="QColor"/>
|
||||
<angle Value="0" Type="enumAndFlags"/>
|
||||
<foregroundOpacity Value="100" Type="int"/>
|
||||
<trimValue Value="1" Type="bool"/>
|
||||
<allowHTML Value="0" Type="bool"/>
|
||||
</item>
|
||||
</children>
|
||||
<zOrder Value="0" Type="qreal"/>
|
||||
<borders Value="0" Type="enumAndFlags"/>
|
||||
<parentName Type="QString">ReportPage1</parentName>
|
||||
<borderLineSize Value="1" Type="int"/>
|
||||
<isVisible Value="1" Type="bool"/>
|
||||
<autoHeight Value="1" Type="bool"/>
|
||||
<bandIndex Value="1" Type="int"/>
|
||||
<keepBottomSpace Value="0" Type="bool"/>
|
||||
<parentBand Type="QString">DataBand1</parentBand>
|
||||
<backgroundColor Value="#ffffff" Type="QColor"/>
|
||||
<printIfEmpty Value="0" Type="bool"/>
|
||||
<datasource Type="QString">products</datasource>
|
||||
<splittable Value="0" Type="bool"/>
|
||||
<columnsCount Value="1" Type="int"/>
|
||||
<columnsFillDirection Value="0" Type="enumAndFlags"/>
|
||||
</item>
|
||||
<item Type="Object" ClassName="TextItem">
|
||||
<objectName Type="QString">TextItem3</objectName>
|
||||
<geometry Type="QRect" x="516" y="84" width="1248" height="1248"/>
|
||||
<children Type="Collection"/>
|
||||
<zOrder Value="-0.1" Type="qreal"/>
|
||||
<borders Value="0" Type="enumAndFlags"/>
|
||||
<parentName Type="QString">ReportPage1</parentName>
|
||||
<borderLineSize Value="1" Type="int"/>
|
||||
<isVisible Value="1" Type="bool"/>
|
||||
<itemLocation Value="1" Type="enumAndFlags"/>
|
||||
<stretchToMaxHeight Value="0" Type="bool"/>
|
||||
<itemAlign Value="4" Type="enumAndFlags"/>
|
||||
<content Type="QString">Lime Report Demo</content>
|
||||
<margin Value="4" Type="int"/>
|
||||
<alignment Value="36" Type="enumAndFlags"/>
|
||||
<autoWidth Value="0" Type="enumAndFlags"/>
|
||||
<autoHeight Value="0" Type="bool"/>
|
||||
<font pointSize="64" italic="0" Type="QFont" bold="1" family="DejaVu Sans" underline="0"/>
|
||||
<backgroundOpacity Value="100" Type="int"/>
|
||||
<backgroundMode Value="1" Type="enumAndFlags"/>
|
||||
<backgroundColor Value="#ffffff" Type="QColor"/>
|
||||
<fontColor Value="#719849" Type="QColor"/>
|
||||
<angle Value="5" Type="enumAndFlags"/>
|
||||
<foregroundOpacity Value="20" Type="int"/>
|
||||
<trimValue Value="1" Type="bool"/>
|
||||
<allowHTML Value="0" Type="bool"/>
|
||||
</item>
|
||||
</children>
|
||||
<zOrder Value="0" Type="qreal"/>
|
||||
<borders Value="0" Type="enumAndFlags"/>
|
||||
<parentName Type="QString"></parentName>
|
||||
<borderLineSize Value="1" Type="int"/>
|
||||
<isVisible Value="1" Type="bool"/>
|
||||
<topMargin Value="5" Type="int"/>
|
||||
<bottomMargin Value="5" Type="int"/>
|
||||
<rightMargin Value="5" Type="int"/>
|
||||
<leftMargin Value="5" Type="int"/>
|
||||
<pageOrientation Value="0" Type="enumAndFlags"/>
|
||||
<pageSize Value="0" Type="enumAndFlags"/>
|
||||
<gridStep Value="2" Type="int"/>
|
||||
</pageItem>
|
||||
</item>
|
||||
</pages>
|
||||
<datasourcesManager Type="Object" ClassName="LimeReport::DataSourceManager">
|
||||
<objectName Type="QString">datasources</objectName>
|
||||
<connections Type="Collection">
|
||||
<item Type="Object" ClassName="LimeReport::ConnectionDesc">
|
||||
<objectName Type="QString"></objectName>
|
||||
<name Type="QString">northwind</name>
|
||||
<driver Type="QString">QSQLITE</driver>
|
||||
<databaseName Type="QString">./demo_reports/northwind.db</databaseName>
|
||||
<userName Type="QString"></userName>
|
||||
<password Value="" Type="QString"/>
|
||||
<host Type="QString"></host>
|
||||
<autoconnect Value="1" Type="bool"/>
|
||||
</item>
|
||||
</connections>
|
||||
<queries Type="Collection">
|
||||
<item Type="Object" ClassName="LimeReport::QueryDesc">
|
||||
<objectName Type="QString"></objectName>
|
||||
<queryName Type="QString">category</queryName>
|
||||
<queryText Type="QString">Select * from categories</queryText>
|
||||
<connectionName Type="QString">northwind</connectionName>
|
||||
</item>
|
||||
</queries>
|
||||
<subqueries Type="Collection">
|
||||
<item Type="Object" ClassName="LimeReport::SubQueryDesc">
|
||||
<objectName Type="QString"></objectName>
|
||||
<queryName Type="QString">products</queryName>
|
||||
<queryText Type="QString">Select * from products where CategoryID = $D{category.CategoryID}</queryText>
|
||||
<connectionName Type="QString">northwind</connectionName>
|
||||
<master Type="QString">category</master>
|
||||
</item>
|
||||
</subqueries>
|
||||
<subproxies Type="Collection"/>
|
||||
<variables Type="Collection">
|
||||
<item Type="Object" ClassName="LimeReport::VarDesc">
|
||||
<objectName Type="QString"></objectName>
|
||||
<name Type="QString">TestName</name>
|
||||
<value Type="QString">TestValue</value>
|
||||
</item>
|
||||
<item Type="Object" ClassName="LimeReport::VarDesc">
|
||||
<objectName Type="QString"></objectName>
|
||||
<name Type="QString">line_groupbandheader1</name>
|
||||
<value Value="6" Type="int"/>
|
||||
</item>
|
||||
</variables>
|
||||
</datasourcesManager>
|
||||
</object>
|
||||
</Report>
|
211
demo_r2/demo_reports/change_item_from_script.lrxml
Normal file
@ -0,0 +1,211 @@
|
||||
<Report>
|
||||
<object ClassName="LimeReport::ReportEnginePrivate" Type="Object">
|
||||
<objectName Type="QString"></objectName>
|
||||
<pages Type="Collection">
|
||||
<item ClassName="LimeReport::PageDesignIntf" Type="Object">
|
||||
<objectName Type="QString">page1</objectName>
|
||||
<sceneRect x="-50" y="-50" Type="QRect" width="2200" height="3070"/>
|
||||
<bspTreeDepth Value="5" Type="int"/>
|
||||
<font Type="QFont" italic="0" bold="0" underline="0" family="MS Shell Dlg 2" pointSize="8"/>
|
||||
<sortCacheEnabled Value="0" Type="bool"/>
|
||||
<stickyFocus Value="0" Type="bool"/>
|
||||
<minimumRenderSize Value="0" Type="qreal"/>
|
||||
<pageItem ClassName="PageItem" Type="Object">
|
||||
<objectName Type="QString">ReportPage1</objectName>
|
||||
<geometry x="0" y="0" Type="QRect" width="2100" height="2970"/>
|
||||
<children Type="Collection">
|
||||
<item ClassName="Data" Type="Object">
|
||||
<objectName Type="QString">DataBand1</objectName>
|
||||
<geometry x="50" y="306" Type="QRect" width="2000" height="110"/>
|
||||
<children Type="Collection">
|
||||
<item ClassName="TextItem" Type="Object">
|
||||
<objectName Type="QString">TextItem2</objectName>
|
||||
<geometry x="28" y="18" Type="QRect" width="814" height="50"/>
|
||||
<children Type="Collection"/>
|
||||
<zOrder Value="0" Type="qreal"/>
|
||||
<borders Value="0" Type="enumAndFlags"/>
|
||||
<parentName Type="QString">DataBand1</parentName>
|
||||
<borderLineSize Value="1" Type="int"/>
|
||||
<isVisible Value="1" Type="bool"/>
|
||||
<itemLocation Value="1" Type="enumAndFlags"/>
|
||||
<stretchToMaxHeight Value="0" Type="bool"/>
|
||||
<itemAlign Value="4" Type="enumAndFlags"/>
|
||||
<content Type="QString">$S{
|
||||
|
||||
var selectedItemBegin = '<span style="background:black; color:red; font-weight:bold ">';
|
||||
var selectedItemEnd = '</span>'
|
||||
|
||||
var customer = "";
|
||||
|
||||
if ($D{customers.CustomerID}=="ANTON"){
|
||||
customer = selectedItemBegin+$D{customers.CustomerID}+selectedItemEnd;
|
||||
} else {
|
||||
customer = $D{customers.CustomerID};
|
||||
}
|
||||
'<span>Customer: </span>'+customer;
|
||||
|
||||
}</content>
|
||||
<margin Value="4" Type="int"/>
|
||||
<alignment Value="33" Type="enumAndFlags"/>
|
||||
<autoWidth Value="0" Type="enumAndFlags"/>
|
||||
<autoHeight Value="0" Type="bool"/>
|
||||
<font Type="QFont" italic="0" bold="0" underline="0" family="Arial" pointSize="10"/>
|
||||
<backgroundOpacity Value="100" Type="int"/>
|
||||
<backgroundMode Value="1" Type="enumAndFlags"/>
|
||||
<backgroundColor Value="#ffffff" Type="QColor"/>
|
||||
<fontColor Value="#000000" Type="QColor"/>
|
||||
<angle Value="0" Type="enumAndFlags"/>
|
||||
<foregroundOpacity Value="100" Type="int"/>
|
||||
<trimValue Value="1" Type="bool"/>
|
||||
<allowHTML Value="1" Type="bool"/>
|
||||
</item>
|
||||
</children>
|
||||
<zOrder Value="0" Type="qreal"/>
|
||||
<borders Value="0" Type="enumAndFlags"/>
|
||||
<parentName Type="QString">ReportPage1</parentName>
|
||||
<borderLineSize Value="1" Type="int"/>
|
||||
<isVisible Value="1" Type="bool"/>
|
||||
<autoHeight Value="1" Type="bool"/>
|
||||
<bandIndex Value="4" Type="int"/>
|
||||
<keepBottomSpace Value="0" Type="bool"/>
|
||||
<parentBand Type="QString"></parentBand>
|
||||
<backgroundColor Value="#ffffff" Type="QColor"/>
|
||||
<printIfEmpty Value="0" Type="bool"/>
|
||||
<datasource Type="QString">customers</datasource>
|
||||
<keepSubdetailTogether Value="0" Type="bool"/>
|
||||
<splittable Value="0" Type="bool"/>
|
||||
<keepFooterTogether Value="0" Type="bool"/>
|
||||
<sliceLastRow Value="0" Type="bool"/>
|
||||
<columnsCount Value="1" Type="int"/>
|
||||
<columnsFillDirection Value="0" Type="enumAndFlags"/>
|
||||
<startNewPage Value="0" Type="bool"/>
|
||||
</item>
|
||||
<item ClassName="ReportHeader" Type="Object">
|
||||
<objectName Type="QString">ReportHeader1</objectName>
|
||||
<geometry x="50" y="50" Type="QRect" width="2000" height="252"/>
|
||||
<children Type="Collection">
|
||||
<item ClassName="TextItem" Type="Object">
|
||||
<objectName Type="QString">TextItem1</objectName>
|
||||
<geometry x="6" y="12" Type="QRect" width="816" height="222"/>
|
||||
<children Type="Collection"/>
|
||||
<zOrder Value="0" Type="qreal"/>
|
||||
<borders Value="0" Type="enumAndFlags"/>
|
||||
<parentName Type="QString">ReportHeader1</parentName>
|
||||
<borderLineSize Value="1" Type="int"/>
|
||||
<isVisible Value="1" Type="bool"/>
|
||||
<itemLocation Value="1" Type="enumAndFlags"/>
|
||||
<stretchToMaxHeight Value="0" Type="bool"/>
|
||||
<itemAlign Value="4" Type="enumAndFlags"/>
|
||||
<content Type="QString">$S{
|
||||
var color = new QColor('#DEB887');
|
||||
var font = new QFont('Times New Roman',26,false,true);
|
||||
THIS.backgroundColor = color;
|
||||
THIS.fontColor = QColor('red');
|
||||
THIS.font = font;
|
||||
|
||||
'Test'}</content>
|
||||
<margin Value="4" Type="int"/>
|
||||
<alignment Value="33" Type="enumAndFlags"/>
|
||||
<autoWidth Value="0" Type="enumAndFlags"/>
|
||||
<autoHeight Value="0" Type="bool"/>
|
||||
<font Type="QFont" italic="0" bold="0" underline="0" family="Times New Roman" pointSize="10"/>
|
||||
<backgroundOpacity Value="100" Type="int"/>
|
||||
<backgroundMode Value="1" Type="enumAndFlags"/>
|
||||
<backgroundColor Value="#ffffff" Type="QColor"/>
|
||||
<fontColor Value="#000000" Type="QColor"/>
|
||||
<angle Value="0" Type="enumAndFlags"/>
|
||||
<foregroundOpacity Value="100" Type="int"/>
|
||||
<trimValue Value="1" Type="bool"/>
|
||||
<allowHTML Value="1" Type="bool"/>
|
||||
</item>
|
||||
<item ClassName="TextItem" Type="Object">
|
||||
<objectName Type="QString">TextItem3</objectName>
|
||||
<geometry x="878" y="44" Type="QRect" width="408" height="86"/>
|
||||
<children Type="Collection"/>
|
||||
<zOrder Value="0" Type="qreal"/>
|
||||
<borders Value="0" Type="enumAndFlags"/>
|
||||
<parentName Type="QString">ReportHeader1</parentName>
|
||||
<borderLineSize Value="1" Type="int"/>
|
||||
<isVisible Value="1" Type="bool"/>
|
||||
<itemLocation Value="0" Type="enumAndFlags"/>
|
||||
<stretchToMaxHeight Value="0" Type="bool"/>
|
||||
<itemAlign Value="4" Type="enumAndFlags"/>
|
||||
<content Type="QString"><p> <span>test1</span> <span style="background:red">test</span> </p></content>
|
||||
<margin Value="4" Type="int"/>
|
||||
<alignment Value="33" Type="enumAndFlags"/>
|
||||
<autoWidth Value="0" Type="enumAndFlags"/>
|
||||
<autoHeight Value="0" Type="bool"/>
|
||||
<font Type="QFont" italic="0" bold="0" underline="0" family="Arial" pointSize="10"/>
|
||||
<backgroundOpacity Value="100" Type="int"/>
|
||||
<backgroundMode Value="1" Type="enumAndFlags"/>
|
||||
<backgroundColor Value="#ffffff" Type="QColor"/>
|
||||
<fontColor Value="#000000" Type="QColor"/>
|
||||
<angle Value="0" Type="enumAndFlags"/>
|
||||
<foregroundOpacity Value="100" Type="int"/>
|
||||
<trimValue Value="1" Type="bool"/>
|
||||
<allowHTML Value="1" Type="bool"/>
|
||||
</item>
|
||||
</children>
|
||||
<zOrder Value="0" Type="qreal"/>
|
||||
<borders Value="0" Type="enumAndFlags"/>
|
||||
<parentName Type="QString">ReportPage1</parentName>
|
||||
<borderLineSize Value="1" Type="int"/>
|
||||
<isVisible Value="1" Type="bool"/>
|
||||
<autoHeight Value="1" Type="bool"/>
|
||||
<bandIndex Value="1" Type="int"/>
|
||||
<keepBottomSpace Value="0" Type="bool"/>
|
||||
<parentBand Type="QString"></parentBand>
|
||||
<backgroundColor Value="#ffffff" Type="QColor"/>
|
||||
<printIfEmpty Value="0" Type="bool"/>
|
||||
<splittable Value="0" Type="bool"/>
|
||||
</item>
|
||||
</children>
|
||||
<zOrder Value="0" Type="qreal"/>
|
||||
<borders Value="0" Type="enumAndFlags"/>
|
||||
<parentName Type="QString"></parentName>
|
||||
<borderLineSize Value="1" Type="int"/>
|
||||
<isVisible Value="1" Type="bool"/>
|
||||
<topMargin Value="5" Type="int"/>
|
||||
<bottomMargin Value="5" Type="int"/>
|
||||
<rightMargin Value="5" Type="int"/>
|
||||
<leftMargin Value="5" Type="int"/>
|
||||
<pageOrientation Value="0" Type="enumAndFlags"/>
|
||||
<pageSize Value="0" Type="enumAndFlags"/>
|
||||
<gridStep Value="2" Type="int"/>
|
||||
</pageItem>
|
||||
</item>
|
||||
</pages>
|
||||
<datasourcesManager ClassName="LimeReport::DataSourceManager" Type="Object">
|
||||
<objectName Type="QString">datasources</objectName>
|
||||
<connections Type="Collection">
|
||||
<item ClassName="LimeReport::ConnectionDesc" Type="Object">
|
||||
<objectName Type="QString"></objectName>
|
||||
<name Type="QString">test</name>
|
||||
<driver Type="QString">QSQLITE</driver>
|
||||
<databaseName Type="QString">./demo_reports/northwind.db</databaseName>
|
||||
<userName Type="QString"></userName>
|
||||
<password Value="" Type="QString"/>
|
||||
<host Type="QString"></host>
|
||||
<autoconnect Value="1" Type="bool"/>
|
||||
</item>
|
||||
</connections>
|
||||
<queries Type="Collection">
|
||||
<item ClassName="LimeReport::QueryDesc" Type="Object">
|
||||
<objectName Type="QString"></objectName>
|
||||
<queryName Type="QString">customers</queryName>
|
||||
<queryText Type="QString">Select * from customers limit 5</queryText>
|
||||
<connectionName Type="QString">test</connectionName>
|
||||
</item>
|
||||
</queries>
|
||||
<subqueries Type="Collection"/>
|
||||
<subproxies Type="Collection"/>
|
||||
<variables Type="Collection">
|
||||
<item ClassName="LimeReport::VarDesc" Type="Object">
|
||||
<objectName Type="QString"></objectName>
|
||||
<name Type="QString">TestName</name>
|
||||
<value Type="QString">TestValue</value>
|
||||
</item>
|
||||
</variables>
|
||||
</datasourcesManager>
|
||||
</object>
|
||||
</Report>
|
BIN
demo_r2/demo_reports/northwind.db
Normal file
BIN
demo_r2/images/First.png
Normal file
After Width: | Height: | Size: 259 B |
BIN
demo_r2/images/FitPage.png
Normal file
After Width: | Height: | Size: 318 B |
BIN
demo_r2/images/FitWidth.png
Normal file
After Width: | Height: | Size: 278 B |
BIN
demo_r2/images/Last.png
Normal file
After Width: | Height: | Size: 248 B |
BIN
demo_r2/images/Next.png
Normal file
After Width: | Height: | Size: 239 B |
BIN
demo_r2/images/OneToOne.png
Normal file
After Width: | Height: | Size: 282 B |
BIN
demo_r2/images/PDF.png
Normal file
After Width: | Height: | Size: 597 B |
BIN
demo_r2/images/Prev.png
Normal file
After Width: | Height: | Size: 252 B |
BIN
demo_r2/images/Print.png
Normal file
After Width: | Height: | Size: 252 B |
BIN
demo_r2/images/ZoomIn.png
Normal file
After Width: | Height: | Size: 765 B |
BIN
demo_r2/images/ZoomOut.png
Normal file
After Width: | Height: | Size: 750 B |
BIN
demo_r2/images/design.png
Normal file
After Width: | Height: | Size: 259 B |
BIN
demo_r2/images/folder3.png
Normal file
After Width: | Height: | Size: 351 B |
BIN
demo_r2/images/logo.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
demo_r2/images/logo1.png
Normal file
After Width: | Height: | Size: 9.4 KiB |
BIN
demo_r2/images/lr.png
Normal file
After Width: | Height: | Size: 328 B |
BIN
demo_r2/images/new_leaf1.png
Normal file
After Width: | Height: | Size: 637 B |
11
demo_r2/main.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include "mainwindow.h"
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
BIN
demo_r2/main.ico
Normal file
After Width: | Height: | Size: 316 KiB |
1
demo_r2/mainicon.rc
Normal file
@ -0,0 +1 @@
|
||||
DI_ICON1 ICON "main.ico"
|
123
demo_r2/mainwindow.cpp
Normal file
@ -0,0 +1,123 @@
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include <QSqlDatabase>
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
m_preview = m_report.createPreviewWidget();
|
||||
connect(m_preview,SIGNAL(scalePercentChanged(int)), this, SLOT(slotScalePercentChanged(int)));
|
||||
ui->groupBox_2->layout()->addWidget(m_preview);
|
||||
buildReportsTree(QApplication::applicationDirPath()+"/demo_reports/", ui->treeWidget);
|
||||
connect(ui->tbZoomIn, SIGNAL(clicked(bool)), m_preview, SLOT(zoomIn()));
|
||||
connect(ui->tbZoomOut, SIGNAL(clicked(bool)), m_preview, SLOT(zoomOut()));
|
||||
connect(ui->tbFirstPage, SIGNAL(clicked(bool)), m_preview, SLOT(firstPage()));
|
||||
connect(ui->tbPrevPage, SIGNAL(clicked(bool)), m_preview, SLOT(priorPage()));
|
||||
connect(ui->tbNextPage, SIGNAL(clicked(bool)), m_preview, SLOT(nextPage()));
|
||||
connect(ui->tbLastPage, SIGNAL(clicked(bool)), m_preview, SLOT(lastPage()));
|
||||
connect(ui->cbScalePercent, SIGNAL(currentIndexChanged(QString)), this, SLOT(scaleComboboxChanged(QString)));
|
||||
connect(ui->tbFitWidth, SIGNAL(clicked(bool)), m_preview, SLOT(fitWidth()));
|
||||
connect(ui->tbFitPage, SIGNAL(clicked(bool)), m_preview, SLOT(fitPage()));
|
||||
connect(m_preview, SIGNAL(pagesSet(int)), this, SLOT(slotPagesSet(int)));
|
||||
connect(m_preview, SIGNAL(pageChanged(int)), this, SLOT(slotPageChanged(int)));
|
||||
connect(ui->tbPDFExport, SIGNAL(clicked(bool)), m_preview, SLOT(printToPDF()));
|
||||
connect(ui->tbPrint, SIGNAL(clicked(bool)), m_preview, SLOT(print()));
|
||||
initPercentCombobox();
|
||||
enableUI(false);
|
||||
QDesktopWidget *desktop = QApplication::desktop();
|
||||
|
||||
int screenWidth = desktop->screenGeometry().width();
|
||||
int screenHeight = desktop->screenGeometry().height();
|
||||
|
||||
int x = screenWidth*0.1;
|
||||
int y = screenHeight*0.1;
|
||||
|
||||
resize(screenWidth*0.8, screenHeight*0.8);
|
||||
move(x, y);
|
||||
if (QFile::exists(QApplication::applicationDirPath()+"/demo_reports/categories.lrxml")){
|
||||
m_report.loadFromFile(QApplication::applicationDirPath()+"/demo_reports/categories.lrxml");
|
||||
m_preview->refreshPages();
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::enableUI(bool value)
|
||||
{
|
||||
ui->tbDesign->setEnabled(value);
|
||||
ui->tbPrint->setEnabled(value);
|
||||
ui->tbPDFExport->setEnabled(value);
|
||||
ui->tbFirstPage->setEnabled(value);
|
||||
ui->tbPrevPage->setEnabled(value);
|
||||
ui->tbNextPage->setEnabled(value);
|
||||
ui->tbLastPage->setEnabled(value);
|
||||
ui->tbZoomIn->setEnabled(value);
|
||||
ui->tbZoomOut->setEnabled(value);
|
||||
ui->tbFitWidth->setEnabled(value);
|
||||
ui->tbFitPage->setEnabled(value);
|
||||
ui->tbOneToOne->setEnabled(value);
|
||||
ui->sbPageNavigator->setEnabled(value);
|
||||
ui->cbScalePercent->setEnabled(value);
|
||||
}
|
||||
|
||||
void MainWindow::slotScalePercentChanged(int percent)
|
||||
{
|
||||
ui->cbScalePercent->setCurrentText(QString("%1%").arg(percent));
|
||||
}
|
||||
|
||||
void MainWindow::scaleComboboxChanged(QString text)
|
||||
{
|
||||
m_preview->setScalePercent(text.remove(text.count()-1,1).toInt());
|
||||
}
|
||||
|
||||
void MainWindow::slotPagesSet(int pagesCount)
|
||||
{
|
||||
ui->sbPageNavigator->setSuffix(tr(" of %1").arg(pagesCount));
|
||||
ui->sbPageNavigator->setMinimum(1);
|
||||
ui->sbPageNavigator->setMaximum(pagesCount);
|
||||
ui->sbPageNavigator->setValue(1);
|
||||
enableUI(true);
|
||||
}
|
||||
|
||||
void MainWindow::slotPageChanged(int page)
|
||||
{
|
||||
ui->sbPageNavigator->setValue(page);
|
||||
}
|
||||
|
||||
void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, int )
|
||||
{
|
||||
m_report.loadFromFile(item->data(0,Qt::UserRole).toString());
|
||||
m_preview->refreshPages();
|
||||
}
|
||||
|
||||
void MainWindow::initPercentCombobox()
|
||||
{
|
||||
for (int i = 10; i<310; i+=10){
|
||||
ui->cbScalePercent->addItem(QString("%1%").arg(i));
|
||||
}
|
||||
ui->cbScalePercent->setCurrentIndex(4);
|
||||
}
|
||||
|
||||
void MainWindow::on_sbPageNavigator_valueChanged(int arg1)
|
||||
{
|
||||
m_preview->pageNavigatorChanged(arg1);
|
||||
}
|
||||
|
||||
void MainWindow::on_tbDesign_clicked()
|
||||
{
|
||||
m_report.designReport();
|
||||
m_preview->refreshPages();
|
||||
}
|
||||
|
||||
void MainWindow::on_tbOneToOne_clicked()
|
||||
{
|
||||
m_preview->setScalePercent(100);
|
||||
}
|
61
demo_r2/mainwindow.h
Normal file
@ -0,0 +1,61 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <LimeReport>
|
||||
#include <QTreeWidget>
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
private:
|
||||
void enableUI(bool value);
|
||||
private slots:
|
||||
void slotScalePercentChanged(int percent);
|
||||
void scaleComboboxChanged(QString text);
|
||||
void slotPagesSet(int pagesCount);
|
||||
void slotPageChanged(int page);
|
||||
void on_treeWidget_itemClicked(QTreeWidgetItem *item, int);
|
||||
void on_sbPageNavigator_valueChanged(int arg1);
|
||||
void on_tbDesign_clicked();
|
||||
void on_tbOneToOne_clicked();
|
||||
private:
|
||||
template< typename T >
|
||||
void buildReportsTree(const QString &path, T* parentItem)
|
||||
{
|
||||
QDir reportsDir(path);
|
||||
QStringList items = reportsDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
foreach( QString dir, items){
|
||||
QTreeWidgetItem* listItem = new QTreeWidgetItem(parentItem);
|
||||
listItem->setText(0,dir);
|
||||
listItem->setIcon(0,QIcon(":/images/images/folder.png"));
|
||||
buildReportsTree(reportsDir.path()+"/"+dir, listItem);
|
||||
}
|
||||
QStringList nameFilters;
|
||||
nameFilters <<"*.lrxml";
|
||||
items = reportsDir.entryList(nameFilters, QDir::Files);
|
||||
foreach( QString file, items){
|
||||
QTreeWidgetItem* listItem = new QTreeWidgetItem(parentItem);
|
||||
listItem->setIcon(0,QIcon(":/images/images/report.png"));
|
||||
listItem->setText(0,file);
|
||||
listItem->setData(0,Qt::UserRole,reportsDir.path()+"/"+file);
|
||||
}
|
||||
}
|
||||
void initPercentCombobox();
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
LimeReport::ReportEngine m_report;
|
||||
LimeReport::PreviewReportWidget* m_preview;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
587
demo_r2/mainwindow.ui
Normal file
@ -0,0 +1,587 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1157</width>
|
||||
<height>554</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Lime Report Demo</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="demo_r2.qrc">
|
||||
<normaloff>:/images/images/logo1.png</normaloff>:/images/images/logo1.png</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Reports</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="treeWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="topMargin">
|
||||
<number>7</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>59</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="demo_r2.qrc">:/images/images/logo1.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>127</red>
|
||||
<green>170</green>
|
||||
<blue>24</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>189</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>127</red>
|
||||
<green>170</green>
|
||||
<blue>24</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>189</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>190</red>
|
||||
<green>190</green>
|
||||
<blue>190</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>190</red>
|
||||
<green>190</green>
|
||||
<blue>190</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Lime Report </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>DEMO</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Preview</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbDesign">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>6</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="demo_r2.qrc">
|
||||
<normaloff>:/images/images/design.png</normaloff>:/images/images/design.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::VLine</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbPrint">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="demo_r2.qrc">
|
||||
<normaloff>:/images/images/Print.png</normaloff>:/images/images/Print.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbPDFExport">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="demo_r2.qrc">
|
||||
<normaloff>:/images/images/PDF.png</normaloff>:/images/images/PDF.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::VLine</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbZoomIn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="demo_r2.qrc">
|
||||
<normaloff>:/images/images/ZoomIn.png</normaloff>:/images/images/ZoomIn.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbZoomOut">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="demo_r2.qrc">
|
||||
<normaloff>:/images/images/ZoomOut.png</normaloff>:/images/images/ZoomOut.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cbScalePercent">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbOneToOne">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="demo_r2.qrc">
|
||||
<normaloff>:/images/images/OneToOne.png</normaloff>:/images/images/OneToOne.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbFitWidth">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="demo_r2.qrc">
|
||||
<normaloff>:/images/images/FitWidth.png</normaloff>:/images/images/FitWidth.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbFitPage">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="demo_r2.qrc">
|
||||
<normaloff>:/images/images/FitPage.png</normaloff>:/images/images/FitPage.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::VLine</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbFirstPage">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="demo_r2.qrc">
|
||||
<normaloff>:/images/images/First.png</normaloff>:/images/images/First.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbPrevPage">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="demo_r2.qrc">
|
||||
<normaloff>:/images/images/Prev.png</normaloff>:/images/images/Prev.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="sbPageNavigator">
|
||||
<property name="prefix">
|
||||
<string>Page: </string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbNextPage">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="demo_r2.qrc">
|
||||
<normaloff>:/images/images/Next.png</normaloff>:/images/images/Next.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbLastPage">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="demo_r2.qrc">
|
||||
<normaloff>:/images/images/Last.png</normaloff>:/images/images/Last.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources>
|
||||
<include location="demo_r2.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
BIN
docs/UserManualEn.pdf
Normal file
BIN
docs/UserManualRu.pdf
Normal file
@ -24,20 +24,25 @@ public:
|
||||
~PreviewReportWidget();
|
||||
public slots:
|
||||
void refreshPages();
|
||||
void slotZoomIn();
|
||||
void slotZoomOut();
|
||||
void zoomIn();
|
||||
void zoomOut();
|
||||
|
||||
void slotFirstPage();
|
||||
void slotPriorPage();
|
||||
void slotNextPage();
|
||||
void slotLastPage();
|
||||
void firstPage();
|
||||
void priorPage();
|
||||
void nextPage();
|
||||
void lastPage();
|
||||
|
||||
void slotPrint();
|
||||
void slotPrintToPDF();
|
||||
void slotPageNavigatorChanged(int value);
|
||||
void slotSaveToFile();
|
||||
void print();
|
||||
void printToPDF();
|
||||
void pageNavigatorChanged(int value);
|
||||
void saveToFile();
|
||||
void setScalePercent(int percent);
|
||||
void fitWidth();
|
||||
void fitPage();
|
||||
signals:
|
||||
void pageChanged(int page);
|
||||
void scalePercentChanged(int percent);
|
||||
void pagesSet(int pageCount);
|
||||
private slots:
|
||||
void slotSliderMoved(int value);
|
||||
void reportEngineDestroyed(QObject* object);
|
||||
@ -45,6 +50,7 @@ private:
|
||||
void initPreview();
|
||||
void setErrorsMesagesVisible(bool visible);
|
||||
void setErrorMessages(const QStringList &value);
|
||||
void emitPageSet();
|
||||
private:
|
||||
Ui::PreviewReportWidget *ui;
|
||||
PreviewReportWidgetPrivate* d_ptr;
|
||||
|
@ -9,7 +9,7 @@ SUBDIRS += \
|
||||
|
||||
CONFIG += ordered
|
||||
|
||||
SUBDIRS += demo_r1
|
||||
SUBDIRS += demo_r1 demo_r2
|
||||
|
||||
|
||||
|
||||
|
BIN
limereport/images/FitPage.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
limereport/images/FitWidth.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
limereport/images/OneToOne.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
@ -32,7 +32,6 @@ unix:{
|
||||
for(FILE,EXTRA_FILES){
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($${DEST_INCLUDE_DIR}) $$escape_expand(\\n\\t) # inside of libs make /include/files
|
||||
}
|
||||
|
||||
}
|
||||
macx{
|
||||
for(FILE,EXTRA_FILES){
|
||||
@ -40,21 +39,21 @@ unix:{
|
||||
}
|
||||
QMAKE_POST_LINK += mkdir -p $$quote($${DESTDIR}/include) $$escape_expand(\\n\\t)
|
||||
}
|
||||
QMAKE_POST_LINK += $(COPY_DIR) $$quote($${DEST_INCLUDE_DIR}*) $$quote($${DESTDIR}/include)
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($${DEST_INCLUDE_DIR}) $$quote($${DESTDIR})
|
||||
}
|
||||
|
||||
win32 {
|
||||
EXTRA_FILES ~= s,/,\\,g
|
||||
BUILD_DIR ~= s,/,\\,g
|
||||
DESTDIR = $${BUILD_DIR}/$${BUILD_TYPE}/lib
|
||||
DEST_DIR = $$DESTDIR/include/
|
||||
DEST_DIR = $$DESTDIR/include
|
||||
DEST_DIR ~= s,/,\\,g
|
||||
DEST_INCLUDE_DIR ~= s,/,\\,g
|
||||
|
||||
for(FILE,EXTRA_FILES){
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($${DEST_INCLUDE_DIR}) $$escape_expand(\\n\\t)
|
||||
}
|
||||
QMAKE_POST_LINK += $(COPY_DIR) $$quote($${DEST_INCLUDE_DIR}*) $$quote($${DEST_DIR})
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($${DEST_INCLUDE_DIR}\\*) $$quote($${DEST_DIR})
|
||||
}
|
||||
|
||||
contains(CONFIG,zint){
|
||||
|
@ -46,9 +46,17 @@ void PreviewReportWidgetPrivate::setPages(ReportPages pages)
|
||||
if (pages.at(0)) pages.at(0)->setSelected(true);
|
||||
m_changingPage = false;
|
||||
q_ptr->initPreview();
|
||||
q_ptr->emitPageSet();
|
||||
}
|
||||
}
|
||||
|
||||
PageItemDesignIntf::Ptr PreviewReportWidgetPrivate::currentPage()
|
||||
{
|
||||
if (m_reportPages.count()>m_currentPage)
|
||||
return m_reportPages.at(m_currentPage-1);
|
||||
else return PageItemDesignIntf::Ptr(0);
|
||||
}
|
||||
|
||||
PreviewReportWidget::PreviewReportWidget(ReportEnginePrivate *report, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::PreviewReportWidget), d_ptr(new PreviewReportWidgetPrivate(this))
|
||||
@ -75,9 +83,11 @@ PreviewReportWidget::~PreviewReportWidget()
|
||||
|
||||
void PreviewReportWidget::initPreview()
|
||||
{
|
||||
ui->graphicsView->setScene(d_ptr->m_previewPage);
|
||||
if (ui->graphicsView->scene()!=d_ptr->m_previewPage)
|
||||
ui->graphicsView->setScene(d_ptr->m_previewPage);
|
||||
ui->graphicsView->resetMatrix();
|
||||
ui->graphicsView->centerOn(0, 0);
|
||||
ui->graphicsView->scale(0.5,0.5);
|
||||
setScalePercent(d_ptr->m_scalePercent);
|
||||
}
|
||||
|
||||
void PreviewReportWidget::setErrorsMesagesVisible(bool visible)
|
||||
@ -85,17 +95,20 @@ void PreviewReportWidget::setErrorsMesagesVisible(bool visible)
|
||||
ui->errorsView->setVisible(visible);
|
||||
}
|
||||
|
||||
void PreviewReportWidget::slotZoomIn()
|
||||
void PreviewReportWidget::zoomIn()
|
||||
{
|
||||
ui->graphicsView->scale(1.2,1.2);
|
||||
d_ptr->m_scalePercent += 10;
|
||||
setScalePercent(d_ptr->m_scalePercent);
|
||||
}
|
||||
|
||||
void PreviewReportWidget::slotZoomOut()
|
||||
void PreviewReportWidget::zoomOut()
|
||||
{
|
||||
ui->graphicsView->scale(1/1.2,1/1.2);
|
||||
if (d_ptr->m_scalePercent>0)
|
||||
d_ptr->m_scalePercent -= 10;
|
||||
setScalePercent(d_ptr->m_scalePercent);
|
||||
}
|
||||
|
||||
void PreviewReportWidget::slotFirstPage()
|
||||
void PreviewReportWidget::firstPage()
|
||||
{
|
||||
d_ptr->m_changingPage=true;
|
||||
if ((!d_ptr->m_reportPages.isEmpty())&&(d_ptr->m_currentPage>1)){
|
||||
@ -106,7 +119,7 @@ void PreviewReportWidget::slotFirstPage()
|
||||
d_ptr->m_changingPage=false;
|
||||
}
|
||||
|
||||
void PreviewReportWidget::slotPriorPage()
|
||||
void PreviewReportWidget::priorPage()
|
||||
{
|
||||
d_ptr->m_changingPage=true;
|
||||
if ((!d_ptr->m_reportPages.isEmpty())&&(d_ptr->m_currentPage>1)){
|
||||
@ -117,7 +130,7 @@ void PreviewReportWidget::slotPriorPage()
|
||||
d_ptr->m_changingPage=false;
|
||||
}
|
||||
|
||||
void PreviewReportWidget::slotNextPage()
|
||||
void PreviewReportWidget::nextPage()
|
||||
{
|
||||
d_ptr->m_changingPage=true;
|
||||
if ((!d_ptr->m_reportPages.isEmpty())&&(d_ptr->m_reportPages.count()>(d_ptr->m_currentPage))){
|
||||
@ -128,7 +141,7 @@ void PreviewReportWidget::slotNextPage()
|
||||
d_ptr->m_changingPage=false;
|
||||
}
|
||||
|
||||
void PreviewReportWidget::slotLastPage()
|
||||
void PreviewReportWidget::lastPage()
|
||||
{
|
||||
d_ptr->m_changingPage=true;
|
||||
if ((!d_ptr->m_reportPages.isEmpty())&&(d_ptr->m_reportPages.count()>(d_ptr->m_currentPage))){
|
||||
@ -139,7 +152,7 @@ void PreviewReportWidget::slotLastPage()
|
||||
d_ptr->m_changingPage=false;
|
||||
}
|
||||
|
||||
void PreviewReportWidget::slotPrint()
|
||||
void PreviewReportWidget::print()
|
||||
{
|
||||
QPrinter printer(QPrinter::HighResolution);
|
||||
QPrintDialog dialog(&printer,QApplication::activeWindow());
|
||||
@ -150,10 +163,13 @@ void PreviewReportWidget::slotPrint()
|
||||
printer,
|
||||
PrintRange(dialog.printRange(),dialog.fromPage(),dialog.toPage())
|
||||
);
|
||||
foreach(PageItemDesignIntf::Ptr pageItem, d_ptr->m_reportPages){
|
||||
d_ptr->m_previewPage->reactivatePageItem(pageItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewReportWidget::slotPrintToPDF()
|
||||
void PreviewReportWidget::printToPDF()
|
||||
{
|
||||
QString fileName = QFileDialog::getSaveFileName(this,tr("PDF file name"),"","PDF(*.pdf)" );
|
||||
if (!fileName.isEmpty()){
|
||||
@ -169,7 +185,7 @@ void PreviewReportWidget::slotPrintToPDF()
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewReportWidget::slotPageNavigatorChanged(int value)
|
||||
void PreviewReportWidget::pageNavigatorChanged(int value)
|
||||
{
|
||||
if (d_ptr->m_changingPage) return;
|
||||
d_ptr->m_changingPage = true;
|
||||
@ -180,7 +196,7 @@ void PreviewReportWidget::slotPageNavigatorChanged(int value)
|
||||
d_ptr->m_changingPage=false;
|
||||
}
|
||||
|
||||
void PreviewReportWidget::slotSaveToFile()
|
||||
void PreviewReportWidget::saveToFile()
|
||||
{
|
||||
QString fileName = QFileDialog::getSaveFileName(this,tr("Report file name"));
|
||||
if (!fileName.isEmpty()){
|
||||
@ -192,6 +208,32 @@ void PreviewReportWidget::slotSaveToFile()
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewReportWidget::setScalePercent(int percent)
|
||||
{
|
||||
ui->graphicsView->resetMatrix();
|
||||
d_ptr->m_scalePercent = percent;
|
||||
qreal scaleSize = percent/100.0;
|
||||
ui->graphicsView->scale(scaleSize, scaleSize);
|
||||
emit scalePercentChanged(percent);
|
||||
}
|
||||
|
||||
void PreviewReportWidget::fitWidth()
|
||||
{
|
||||
if (d_ptr->currentPage()){
|
||||
qreal scalePercent = ui->graphicsView->viewport()->width() / ui->graphicsView->scene()->width();
|
||||
setScalePercent(scalePercent*100);
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewReportWidget::fitPage()
|
||||
{
|
||||
if (d_ptr->currentPage()){
|
||||
qreal vScale = ui->graphicsView->viewport()->width() / ui->graphicsView->scene()->width();
|
||||
qreal hScale = ui->graphicsView->viewport()->height() / d_ptr->currentPage()->height();
|
||||
setScalePercent(qMin(vScale,hScale)*100);
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewReportWidget::setErrorMessages(const QStringList &value)
|
||||
{
|
||||
foreach (QString line, value) {
|
||||
@ -199,6 +241,11 @@ void PreviewReportWidget::setErrorMessages(const QStringList &value)
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewReportWidget::emitPageSet()
|
||||
{
|
||||
emit pagesSet(d_ptr->m_reportPages.count());
|
||||
}
|
||||
|
||||
void PreviewReportWidget::refreshPages()
|
||||
{
|
||||
if (d_ptr->m_report){
|
||||
@ -207,15 +254,7 @@ void PreviewReportWidget::refreshPages()
|
||||
ReportPages pages = d_ptr->m_report->renderToPages();
|
||||
d_ptr->m_report->dataManager()->setDesignTime(true);
|
||||
if (pages.count()>0){
|
||||
d_ptr->m_reportPages = pages;
|
||||
if (!d_ptr->m_reportPages.isEmpty()){
|
||||
d_ptr->m_previewPage->setPageItems(d_ptr->m_reportPages);
|
||||
d_ptr->m_changingPage = true;
|
||||
d_ptr->m_currentPage = 1;
|
||||
if (pages.at(0)) pages.at(0)->setSelected(true);
|
||||
d_ptr->m_changingPage = false;
|
||||
}
|
||||
ui->graphicsView->centerOn(0, 0);
|
||||
d_ptr->setPages(pages);
|
||||
}
|
||||
} catch (ReportError &exception){
|
||||
d_ptr->m_report->saveError(exception.what());
|
||||
|
@ -24,20 +24,25 @@ public:
|
||||
~PreviewReportWidget();
|
||||
public slots:
|
||||
void refreshPages();
|
||||
void slotZoomIn();
|
||||
void slotZoomOut();
|
||||
void zoomIn();
|
||||
void zoomOut();
|
||||
|
||||
void slotFirstPage();
|
||||
void slotPriorPage();
|
||||
void slotNextPage();
|
||||
void slotLastPage();
|
||||
void firstPage();
|
||||
void priorPage();
|
||||
void nextPage();
|
||||
void lastPage();
|
||||
|
||||
void slotPrint();
|
||||
void slotPrintToPDF();
|
||||
void slotPageNavigatorChanged(int value);
|
||||
void slotSaveToFile();
|
||||
void print();
|
||||
void printToPDF();
|
||||
void pageNavigatorChanged(int value);
|
||||
void saveToFile();
|
||||
void setScalePercent(int percent);
|
||||
void fitWidth();
|
||||
void fitPage();
|
||||
signals:
|
||||
void pageChanged(int page);
|
||||
void scalePercentChanged(int percent);
|
||||
void pagesSet(int pageCount);
|
||||
private slots:
|
||||
void slotSliderMoved(int value);
|
||||
void reportEngineDestroyed(QObject* object);
|
||||
@ -45,6 +50,7 @@ private:
|
||||
void initPreview();
|
||||
void setErrorsMesagesVisible(bool visible);
|
||||
void setErrorMessages(const QStringList &value);
|
||||
void emitPageSet();
|
||||
private:
|
||||
Ui::PreviewReportWidget *ui;
|
||||
PreviewReportWidgetPrivate* d_ptr;
|
||||
|
@ -12,11 +12,13 @@ class PreviewReportWidget;
|
||||
class PreviewReportWidgetPrivate
|
||||
{
|
||||
public:
|
||||
PreviewReportWidgetPrivate(PreviewReportWidget* previewReportWidget): q_ptr(previewReportWidget),
|
||||
m_currentPage(1), m_changingPage(false), m_priorScrolValue(0){}
|
||||
PreviewReportWidgetPrivate(PreviewReportWidget* previewReportWidget):
|
||||
m_currentPage(1), m_changingPage(false), m_priorScrolValue(0), m_scalePercent(50),
|
||||
q_ptr(previewReportWidget) {}
|
||||
bool pageIsVisible();
|
||||
QRectF calcPageShift();
|
||||
void setPages( ReportPages pages);
|
||||
PageItemDesignIntf::Ptr currentPage();
|
||||
public:
|
||||
PageDesignIntf* m_previewPage;
|
||||
ReportPages m_reportPages;
|
||||
@ -25,6 +27,7 @@ public:
|
||||
int m_currentPage;
|
||||
bool m_changingPage;
|
||||
int m_priorScrolValue;
|
||||
int m_scalePercent;
|
||||
PreviewReportWidget* q_ptr;
|
||||
|
||||
};
|
||||
|
@ -61,6 +61,13 @@ PreviewReportWindow::PreviewReportWindow(ReportEnginePrivate *report,QWidget *pa
|
||||
setCentralWidget(m_previewReportWidget);
|
||||
layout()->setContentsMargins(1,1,1,1);
|
||||
connect(m_previewReportWidget,SIGNAL(pageChanged(int)), this,SLOT(slotPageChanged(int)) );
|
||||
|
||||
|
||||
m_scalePercent = new QComboBox(this);
|
||||
ui->toolBar->insertWidget(ui->actionZoomOut, m_scalePercent);
|
||||
initPercentCombobox();
|
||||
connect(m_previewReportWidget, SIGNAL(scalePercentChanged(int)), this, SLOT(slotScalePercentChanged(int)));
|
||||
connect(m_scalePercent, SIGNAL(currentIndexChanged(QString)), this, SLOT(scaleComboboxChanged(QString)));
|
||||
restoreSetting();
|
||||
}
|
||||
|
||||
@ -203,32 +210,32 @@ void PreviewReportWindow::moveEvent(QMoveEvent* e)
|
||||
|
||||
void PreviewReportWindow::slotPrint()
|
||||
{
|
||||
m_previewReportWidget->slotPrint();
|
||||
m_previewReportWidget->print();
|
||||
}
|
||||
|
||||
void PreviewReportWindow::slotPriorPage()
|
||||
{
|
||||
m_previewReportWidget->slotPriorPage();
|
||||
m_previewReportWidget->priorPage();
|
||||
}
|
||||
|
||||
void PreviewReportWindow::slotNextPage()
|
||||
{
|
||||
m_previewReportWidget->slotNextPage();
|
||||
m_previewReportWidget->nextPage();
|
||||
}
|
||||
|
||||
void PreviewReportWindow::slotZoomIn()
|
||||
{
|
||||
m_previewReportWidget->slotZoomIn();
|
||||
m_previewReportWidget->zoomIn();
|
||||
}
|
||||
|
||||
void PreviewReportWindow::slotZoomOut()
|
||||
{
|
||||
m_previewReportWidget->slotZoomOut();
|
||||
m_previewReportWidget->zoomOut();
|
||||
}
|
||||
|
||||
void PreviewReportWindow::slotPageNavigatorChanged(int value)
|
||||
{
|
||||
m_previewReportWidget->slotPageNavigatorChanged(value);
|
||||
m_previewReportWidget->pageNavigatorChanged(value);
|
||||
}
|
||||
|
||||
void PreviewReportWindow::slotShowErrors()
|
||||
@ -241,24 +248,32 @@ ItemsReaderIntf *PreviewReportWindow::reader()
|
||||
return m_reader.data();
|
||||
}
|
||||
|
||||
void PreviewReportWindow::initPercentCombobox()
|
||||
{
|
||||
for (int i = 10; i<310; i+=10){
|
||||
m_scalePercent->addItem(QString("%1%").arg(i));
|
||||
}
|
||||
m_scalePercent->setCurrentIndex(4);
|
||||
}
|
||||
|
||||
void PreviewReportWindow::on_actionSaveToFile_triggered()
|
||||
{
|
||||
m_previewReportWidget->slotSaveToFile();
|
||||
m_previewReportWidget->saveToFile();
|
||||
}
|
||||
|
||||
void PreviewReportWindow::slotFirstPage()
|
||||
{
|
||||
m_previewReportWidget->slotFirstPage();
|
||||
m_previewReportWidget->firstPage();
|
||||
}
|
||||
|
||||
void PreviewReportWindow::slotLastPage()
|
||||
{
|
||||
m_previewReportWidget->slotLastPage();
|
||||
m_previewReportWidget->lastPage();
|
||||
}
|
||||
|
||||
void PreviewReportWindow::slotPrintToPDF()
|
||||
{
|
||||
m_previewReportWidget->slotPrintToPDF();
|
||||
m_previewReportWidget->printToPDF();
|
||||
}
|
||||
|
||||
void PreviewReportWindow::slotPageChanged(int pageIndex)
|
||||
@ -266,4 +281,35 @@ void PreviewReportWindow::slotPageChanged(int pageIndex)
|
||||
m_pagesNavigator->setValue(pageIndex);
|
||||
}
|
||||
|
||||
void PreviewReportWindow::on_actionFit_page_width_triggered()
|
||||
{
|
||||
m_previewReportWidget->fitWidth();
|
||||
}
|
||||
|
||||
void PreviewReportWindow::on_actionFit_page_triggered()
|
||||
{
|
||||
m_previewReportWidget->fitPage();
|
||||
}
|
||||
|
||||
void PreviewReportWindow::on_actionOne_to_one_triggered()
|
||||
{
|
||||
m_previewReportWidget->setScalePercent(100);
|
||||
}
|
||||
|
||||
void PreviewReportWindow::scaleComboboxChanged(QString text)
|
||||
{
|
||||
m_previewReportWidget->setScalePercent(text.remove(text.count()-1,1).toInt());
|
||||
}
|
||||
|
||||
void PreviewReportWindow::slotScalePercentChanged(int percent)
|
||||
{
|
||||
m_scalePercent->setCurrentText(QString("%1%").arg(percent));
|
||||
}
|
||||
|
||||
}// namespace LimeReport
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <QMainWindow>
|
||||
#include <QDomComment>
|
||||
#include <QSpinBox>
|
||||
#include <QComboBox>
|
||||
|
||||
#include "lrpagedesignintf.h"
|
||||
#include "lrreportrender.h"
|
||||
@ -78,8 +79,15 @@ public slots:
|
||||
void slotLastPage();
|
||||
void slotPrintToPDF();
|
||||
void slotPageChanged(int pageIndex);
|
||||
private slots:
|
||||
void on_actionFit_page_width_triggered();
|
||||
void on_actionFit_page_triggered();
|
||||
void on_actionOne_to_one_triggered();
|
||||
void scaleComboboxChanged(QString text);
|
||||
void slotScalePercentChanged(int percent);
|
||||
private:
|
||||
ItemsReaderIntf* reader();
|
||||
void initPercentCombobox();
|
||||
//bool pageIsVisible(PageItemDesignIntf::Ptr page);
|
||||
//QRectF calcPageShift(PageItemDesignIntf::Ptr page);
|
||||
private:
|
||||
@ -91,6 +99,7 @@ private:
|
||||
QSettings* m_settings;
|
||||
bool m_ownedSettings;
|
||||
PreviewReportWidget* m_previewReportWidget;
|
||||
QComboBox* m_scalePercent;
|
||||
};
|
||||
} //namespace LimeReport
|
||||
#endif // LRPREVIEWREPORTWINDOW_H
|
||||
|
@ -77,6 +77,9 @@
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionZoomIn"/>
|
||||
<addaction name="actionZoomOut"/>
|
||||
<addaction name="actionOne_to_one"/>
|
||||
<addaction name="actionFit_page_width"/>
|
||||
<addaction name="actionFit_page"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionFirst_Page"/>
|
||||
<addaction name="actionPriorPage"/>
|
||||
@ -224,10 +227,37 @@
|
||||
<string>Print To PDF</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFit_page_width">
|
||||
<property name="icon">
|
||||
<iconset resource="report.qrc">
|
||||
<normaloff>:/report/images/FitWidth.png</normaloff>:/report/images/FitWidth.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fit page width</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFit_page">
|
||||
<property name="icon">
|
||||
<iconset resource="report.qrc">
|
||||
<normaloff>:/report/images/FitPage.png</normaloff>:/report/images/FitPage.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fit page</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOne_to_one">
|
||||
<property name="icon">
|
||||
<iconset resource="report.qrc">
|
||||
<normaloff>:/report/images/OneToOne.png</normaloff>:/report/images/OneToOne.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>One to one</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="databrowser/lrdatabrowser.qrc"/>
|
||||
<include location="report.qrc"/>
|
||||
<include location="databrowser/lrdatabrowser.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
|
@ -161,5 +161,8 @@
|
||||
<file alias="/images/settings">images/settings.png</file>
|
||||
<file alias="/images/grid">images/grid.png</file>
|
||||
<file alias="/images/magnet">images/magnet.png</file>
|
||||
<file>images/FitPage.png</file>
|
||||
<file>images/FitWidth.png</file>
|
||||
<file>images/OneToOne.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|