QJSEngine will be used if Qt version 5.6 and higher

This commit is contained in:
Arin Alexander 2017-12-14 02:28:52 +03:00
parent 41dec61d02
commit 09754e6906
6 changed files with 319 additions and 183 deletions

View File

@ -4,10 +4,13 @@ CONFIG *= build_translations
CONFIG *= zint
}
!contains(CONFIG, qtscriptengine){
!contains(CONFIG, qtscriptengine):
greaterThan(QT_MAJOR_VERSION, 4):
greaterThan(QT_MINOR_VERSION, 5){
CONFIG *= qjsengine
}
!contains(CONFIG, no_formdesigner){
CONFIG *= dialogdesigner
}

View File

@ -1,27 +1,27 @@
<?xml version="1.0" encoding="UTF8"?>
<Report>
<object ClassName="LimeReport::ReportEnginePrivate" Type="Object">
<object Type="Object" ClassName="LimeReport::ReportEnginePrivate">
<objectName Type="QString"></objectName>
<pages Type="Collection">
<item ClassName="LimeReport::PageDesignIntf" Type="Object">
<item Type="Object" ClassName="LimeReport::PageDesignIntf">
<objectName Type="QString">page1</objectName>
<sceneRect Type="QRect" width="2200" x="-50" y="-50" height="3070"/>
<sceneRect Type="QRect" x="-50" y="-50" width="2200" height="3070"/>
<bspTreeDepth Value="5" Type="int"/>
<font stylename="" Type="QFont" pointSize="8" underline="0" family="MS Shell Dlg 2" weight="50" italic="0"/>
<font underline="0" Type="QFont" italic="0" family="MS Shell Dlg 2" weight="50" pointSize="8" stylename=""/>
<sortCacheEnabled Value="0" Type="bool"/>
<stickyFocus Value="0" Type="bool"/>
<minimumRenderSize Value="0" Type="qreal"/>
<pageItem ClassName="PageItem" Type="Object">
<pageItem Type="Object" ClassName="PageItem">
<objectName Type="QString">ReportPage1</objectName>
<geometry Type="QRect" width="2100" x="0" y="0" height="2970"/>
<geometry Type="QRect" x="0" y="0" width="2100" height="2970"/>
<children Type="Collection">
<item ClassName="Data" Type="Object">
<item Type="Object" ClassName="Data">
<objectName Type="QString">DataBand1</objectName>
<geometry Type="QRect" width="2000" x="50" y="306" height="110"/>
<geometry Type="QRect" x="50" y="306" width="2000" height="110"/>
<children Type="Collection">
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem2</objectName>
<geometry Type="QRect" width="814" x="38" y="32" height="50"/>
<geometry Type="QRect" x="38" y="32" width="814" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
@ -51,7 +51,7 @@ if ($D{customers.CustomerID}=="ANTON"){
<alignment Value="33" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font stylename="" Type="QFont" pointSize="10" underline="0" family="Arial" weight="50" italic="0"/>
<font underline="0" Type="QFont" italic="0" family="Arial" weight="50" pointSize="10" stylename=""/>
<backgroundOpacity Value="100" Type="int"/>
<backgroundMode Value="1" Type="enumAndFlags"/>
<backgroundColor Value="#ffffff" Type="QColor"/>
@ -65,6 +65,13 @@ if ($D{customers.CustomerID}=="ANTON"){
<underlineLineSize Value="1" Type="int"/>
<allowHTML Value="1" Type="bool"/>
<allowHTMLInFields Value="0" Type="bool"/>
<format Type="QString"></format>
<valueType Value="0" Type="enumAndFlags"/>
<followTo Type="QString"></followTo>
<backgroundBrushStyle Value="1" Type="enumAndFlags"/>
<textIndent Value="0" Type="qreal"/>
<textLayoutDirection Value="2" Type="enumAndFlags"/>
<fillInSecondPass Value="0" Type="bool"/>
</item>
</children>
<zOrder Value="0" Type="qreal"/>
@ -78,6 +85,7 @@ if ($D{customers.CustomerID}=="ANTON"){
<keepBottomSpace Value="0" Type="bool"/>
<parentBand Type="QString"></parentBand>
<backgroundColor Value="#ffffff" Type="QColor"/>
<backgroundBrushStyle Value="1" Type="enumAndFlags"/>
<printIfEmpty Value="0" Type="bool"/>
<datasource Type="QString">customers</datasource>
<keepSubdetailTogether Value="0" Type="bool"/>
@ -88,14 +96,16 @@ if ($D{customers.CustomerID}=="ANTON"){
<columnsFillDirection Value="0" Type="enumAndFlags"/>
<startNewPage Value="0" Type="bool"/>
<startFromNewPage Value="0" Type="bool"/>
<alternateBackgroundColor Value="#ffffff" Type="QColor"/>
<useAlternateBackgroundColor Value="0" Type="bool"/>
</item>
<item ClassName="ReportHeader" Type="Object">
<item Type="Object" ClassName="ReportHeader">
<objectName Type="QString">ReportHeader1</objectName>
<geometry Type="QRect" width="2000" x="50" y="50" height="252"/>
<geometry Type="QRect" x="50" y="50" width="2000" height="252"/>
<children Type="Collection">
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem1</objectName>
<geometry Type="QRect" width="816" x="6" y="12" height="222"/>
<geometry Type="QRect" x="6" y="12" width="816" height="222"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
@ -107,10 +117,10 @@ if ($D{customers.CustomerID}=="ANTON"){
<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);
var color = LimeReport.color('#DEB887');
var font = LimeReport.font('Times New Roman',26,false,true);
THIS.backgroundColor = color;
THIS.fontColor = QColor('red');
THIS.fontColor = LimeReport.color('red');
THIS.font = font;
'Test'}</content>
@ -118,7 +128,7 @@ THIS.font = font;
<alignment Value="33" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font stylename="" Type="QFont" pointSize="10" underline="0" family="Times New Roman" weight="50" italic="0"/>
<font underline="0" Type="QFont" italic="0" family="Times New Roman" weight="50" pointSize="10" stylename=""/>
<backgroundOpacity Value="100" Type="int"/>
<backgroundMode Value="1" Type="enumAndFlags"/>
<backgroundColor Value="#ffffff" Type="QColor"/>
@ -132,10 +142,17 @@ THIS.font = font;
<underlineLineSize Value="1" Type="int"/>
<allowHTML Value="0" Type="bool"/>
<allowHTMLInFields Value="0" Type="bool"/>
<format Type="QString"></format>
<valueType Value="0" Type="enumAndFlags"/>
<followTo Type="QString"></followTo>
<backgroundBrushStyle Value="1" Type="enumAndFlags"/>
<textIndent Value="0" Type="qreal"/>
<textLayoutDirection Value="2" Type="enumAndFlags"/>
<fillInSecondPass Value="0" Type="bool"/>
</item>
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem3</objectName>
<geometry Type="QRect" width="408" x="878" y="44" height="86"/>
<geometry Type="QRect" x="878" y="44" width="408" height="86"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
@ -151,7 +168,7 @@ THIS.font = font;
<alignment Value="33" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font stylename="" Type="QFont" pointSize="10" underline="0" family="Arial" weight="50" italic="0"/>
<font underline="0" Type="QFont" italic="0" family="Arial" weight="50" pointSize="10" stylename=""/>
<backgroundOpacity Value="100" Type="int"/>
<backgroundMode Value="1" Type="enumAndFlags"/>
<backgroundColor Value="#ffffff" Type="QColor"/>
@ -165,6 +182,13 @@ THIS.font = font;
<underlineLineSize Value="1" Type="int"/>
<allowHTML Value="1" Type="bool"/>
<allowHTMLInFields Value="0" Type="bool"/>
<format Type="QString"></format>
<valueType Value="0" Type="enumAndFlags"/>
<followTo Type="QString"></followTo>
<backgroundBrushStyle Value="1" Type="enumAndFlags"/>
<textIndent Value="0" Type="qreal"/>
<textLayoutDirection Value="2" Type="enumAndFlags"/>
<fillInSecondPass Value="0" Type="bool"/>
</item>
</children>
<zOrder Value="0" Type="qreal"/>
@ -178,8 +202,10 @@ THIS.font = font;
<keepBottomSpace Value="0" Type="bool"/>
<parentBand Type="QString"></parentBand>
<backgroundColor Value="#ffffff" Type="QColor"/>
<backgroundBrushStyle Value="1" Type="enumAndFlags"/>
<printIfEmpty Value="0" Type="bool"/>
<splittable Value="0" Type="bool"/>
<printBeforePageHeader Value="0" Type="bool"/>
</item>
</children>
<zOrder Value="0" Type="qreal"/>
@ -197,13 +223,19 @@ THIS.font = font;
<gridStep Value="2" Type="int"/>
<fullPage Value="0" Type="bool"/>
<oldPrintMode Value="0" Type="bool"/>
<resetPageNumber Value="0" Type="bool"/>
<isExtendedInDesignMode Value="0" Type="bool"/>
<extendedHeight Value="1000" Type="int"/>
<pageIsTOC Value="0" Type="bool"/>
<setPageSizeToPrinter Value="0" Type="bool"/>
<endlessHeight Value="0" Type="bool"/>
</pageItem>
</item>
</pages>
<datasourcesManager ClassName="LimeReport::DataSourceManager" Type="Object">
<datasourcesManager Type="Object" ClassName="LimeReport::DataSourceManager">
<objectName Type="QString">datasources</objectName>
<connections Type="Collection">
<item ClassName="LimeReport::ConnectionDesc" Type="Object">
<item Type="Object" ClassName="LimeReport::ConnectionDesc">
<objectName Type="QString"></objectName>
<name Type="QString">test</name>
<driver Type="QString">QSQLITE</driver>
@ -212,10 +244,11 @@ THIS.font = font;
<password Value="" Type="QString"/>
<host Type="QString"></host>
<autoconnect Value="0" Type="bool"/>
<keepDBCredentials Value="1" Type="bool"/>
</item>
</connections>
<queries Type="Collection">
<item ClassName="LimeReport::QueryDesc" Type="Object">
<item Type="Object" ClassName="LimeReport::QueryDesc">
<objectName Type="QString"></objectName>
<queryName Type="QString">customers</queryName>
<queryText Type="QString">Select * from customers limit 5</queryText>
@ -225,18 +258,21 @@ THIS.font = font;
<subqueries Type="Collection"/>
<subproxies Type="Collection"/>
<variables Type="Collection">
<item ClassName="LimeReport::VarDesc" Type="Object">
<item Type="Object" ClassName="LimeReport::VarDesc">
<objectName Type="QString"></objectName>
<name Type="QString">TestName</name>
<value Type="QString">TestValue</value>
<isMandatory Value="0" Type="bool"/>
<dataType Value="0" Type="int"/>
</item>
</variables>
</datasourcesManager>
<scriptContext ClassName="LimeReport::ScriptEngineContext" Type="Object">
<scriptContext Type="Object" ClassName="LimeReport::ScriptEngineContext">
<objectName Type="QString"></objectName>
<dialogs Type="Collection"/>
<initScript Type="QString"></initScript>
</scriptContext>
<suppressFieldAndVarError Value="0" Type="bool"/>
<translation Type="Translation"/>
</object>
</Report>

View File

@ -1,35 +1,37 @@
<?xml version="1.0" encoding="UTF8"?>
<Report>
<object ClassName="LimeReport::ReportEnginePrivate" Type="Object">
<object Type="Object" ClassName="LimeReport::ReportEnginePrivate">
<objectName Type="QString"></objectName>
<pages Type="Collection">
<item ClassName="LimeReport::PageDesignIntf" Type="Object">
<item Type="Object" ClassName="LimeReport::PageDesignIntf">
<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">
<sceneRect x="-50" Type="QRect" width="2200" y="-50" height="3070"/>
<bspTreeDepth Type="int" Value="5"/>
<font weight="50" Type="QFont" pointSize="8" stylename="" underline="0" family="MS Shell Dlg 2" italic="0"/>
<sortCacheEnabled Type="bool" Value="0"/>
<stickyFocus Type="bool" Value="0"/>
<minimumRenderSize Type="qreal" Value="0"/>
<pageItem Type="Object" ClassName="PageItem">
<objectName Type="QString">ReportPage1</objectName>
<geometry x="0" y="0" Type="QRect" width="2100" height="2970"/>
<geometry x="0" Type="QRect" width="2100" y="0" height="2970"/>
<children Type="Collection">
<item ClassName="Data" Type="Object">
<item Type="Object" ClassName="Data">
<objectName Type="QString">DataBand1</objectName>
<geometry x="50" y="306" Type="QRect" width="2000" height="110"/>
<geometry x="50" Type="QRect" width="2000" y="306" height="110"/>
<children Type="Collection">
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem2</objectName>
<geometry x="28" y="18" Type="QRect" width="814" height="50"/>
<geometry x="38" Type="QRect" width="814" y="32" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
<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"/>
<borderLineSize Type="int" Value="1"/>
<isVisible Type="bool" Value="1"/>
<borderColor Type="QColor" Value="#000000"/>
<itemLocation Type="enumAndFlags" Value="1"/>
<stretchToMaxHeight Type="bool" Value="0"/>
<itemAlign Type="enumAndFlags" Value="4"/>
<content Type="QString">$S{
var selectedItemBegin = '&lt;span style="background:black; color:red; font-weight:bold ">';
@ -45,152 +47,208 @@ if ($D{customers.CustomerID}=="ANTON"){
'&lt;span>Customer: &lt;/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"/>
<margin Type="int" Value="4"/>
<alignment Type="enumAndFlags" Value="33"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font weight="50" Type="QFont" pointSize="10" stylename="" underline="0" family="Arial" italic="0"/>
<backgroundOpacity Type="int" Value="100"/>
<backgroundMode Type="enumAndFlags" Value="1"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
<fontColor Type="QColor" Value="#000000"/>
<angle Type="enumAndFlags" Value="0"/>
<foregroundOpacity Type="int" Value="100"/>
<underlines Type="bool" Value="0"/>
<adaptFontToSize Type="bool" Value="0"/>
<trimValue Type="bool" Value="1"/>
<lineSpacing Type="int" Value="1"/>
<underlineLineSize Type="int" Value="1"/>
<allowHTML Type="bool" Value="1"/>
<allowHTMLInFields Type="bool" Value="0"/>
<format Type="QString"></format>
<valueType Type="enumAndFlags" Value="0"/>
<followTo Type="QString"></followTo>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
</children>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
<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"/>
<borderLineSize Type="int" Value="1"/>
<isVisible Type="bool" Value="1"/>
<borderColor Type="QColor" Value="#000000"/>
<autoHeight Type="bool" Value="1"/>
<bandIndex Type="int" Value="4"/>
<keepBottomSpace Type="bool" Value="0"/>
<parentBand Type="QString"></parentBand>
<backgroundColor Value="#ffffff" Type="QColor"/>
<printIfEmpty Value="0" Type="bool"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<printIfEmpty Type="bool" Value="0"/>
<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"/>
<keepSubdetailTogether Type="bool" Value="0"/>
<splittable Type="bool" Value="0"/>
<keepFooterTogether Type="bool" Value="0"/>
<sliceLastRow Type="bool" Value="0"/>
<columnsCount Type="int" Value="1"/>
<columnsFillDirection Type="enumAndFlags" Value="0"/>
<startNewPage Type="bool" Value="0"/>
<startFromNewPage Type="bool" Value="0"/>
<alternateBackgroundColor Type="QColor" Value="#ffffff"/>
<useAlternateBackgroundColor Type="bool" Value="0"/>
</item>
<item ClassName="ReportHeader" Type="Object">
<item Type="Object" ClassName="ReportHeader">
<objectName Type="QString">ReportHeader1</objectName>
<geometry x="50" y="50" Type="QRect" width="2000" height="252"/>
<geometry x="50" Type="QRect" width="2000" y="50" height="252"/>
<children Type="Collection">
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem1</objectName>
<geometry x="6" y="12" Type="QRect" width="816" height="222"/>
<geometry x="6" Type="QRect" width="816" y="12" height="222"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
<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"/>
<borderLineSize Type="int" Value="1"/>
<isVisible Type="bool" Value="1"/>
<borderColor Type="QColor" Value="#000000"/>
<itemLocation Type="enumAndFlags" Value="1"/>
<stretchToMaxHeight Type="bool" Value="0"/>
<itemAlign Type="enumAndFlags" Value="4"/>
<content Type="QString">$S{
var color = new QColor('#DEB887');
var font = new QFont('Times New Roman',26,false,true);
var color = LimeReport.color('#DEB887');
var font = LimeReport.font('Times New Roman',26,false,true);
THIS.backgroundColor = color;
THIS.fontColor = QColor('red');
THIS.fontColor = LimeReport.color('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"/>
<margin Type="int" Value="4"/>
<alignment Type="enumAndFlags" Value="33"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font weight="50" Type="QFont" pointSize="10" stylename="" underline="0" family="Times New Roman" italic="0"/>
<backgroundOpacity Type="int" Value="100"/>
<backgroundMode Type="enumAndFlags" Value="1"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
<fontColor Type="QColor" Value="#000000"/>
<angle Type="enumAndFlags" Value="0"/>
<foregroundOpacity Type="int" Value="100"/>
<underlines Type="bool" Value="0"/>
<adaptFontToSize Type="bool" Value="0"/>
<trimValue Type="bool" Value="1"/>
<lineSpacing Type="int" Value="1"/>
<underlineLineSize Type="int" Value="1"/>
<allowHTML Type="bool" Value="0"/>
<allowHTMLInFields Type="bool" Value="0"/>
<format Type="QString"></format>
<valueType Type="enumAndFlags" Value="0"/>
<followTo Type="QString"></followTo>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem3</objectName>
<geometry x="878" y="44" Type="QRect" width="408" height="86"/>
<geometry x="878" Type="QRect" width="408" y="44" height="86"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
<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"/>
<borderLineSize Type="int" Value="1"/>
<isVisible Type="bool" Value="1"/>
<borderColor Type="QColor" Value="#000000"/>
<itemLocation Type="enumAndFlags" Value="0"/>
<stretchToMaxHeight Type="bool" Value="0"/>
<itemAlign Type="enumAndFlags" Value="4"/>
<content Type="QString">&lt;p> &lt;span>test1&lt;/span> &lt;span style="background:red">test&lt;/span> &lt;/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"/>
<margin Type="int" Value="4"/>
<alignment Type="enumAndFlags" Value="33"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font weight="50" Type="QFont" pointSize="10" stylename="" underline="0" family="Arial" italic="0"/>
<backgroundOpacity Type="int" Value="100"/>
<backgroundMode Type="enumAndFlags" Value="1"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
<fontColor Type="QColor" Value="#000000"/>
<angle Type="enumAndFlags" Value="0"/>
<foregroundOpacity Type="int" Value="100"/>
<underlines Type="bool" Value="0"/>
<adaptFontToSize Type="bool" Value="0"/>
<trimValue Type="bool" Value="1"/>
<lineSpacing Type="int" Value="1"/>
<underlineLineSize Type="int" Value="1"/>
<allowHTML Type="bool" Value="1"/>
<allowHTMLInFields Type="bool" Value="0"/>
<format Type="QString"></format>
<valueType Type="enumAndFlags" Value="0"/>
<followTo Type="QString"></followTo>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
</children>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
<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"/>
<borderLineSize Type="int" Value="1"/>
<isVisible Type="bool" Value="1"/>
<borderColor Type="QColor" Value="#000000"/>
<autoHeight Type="bool" Value="1"/>
<bandIndex Type="int" Value="1"/>
<keepBottomSpace Type="bool" Value="0"/>
<parentBand Type="QString"></parentBand>
<backgroundColor Value="#ffffff" Type="QColor"/>
<printIfEmpty Value="0" Type="bool"/>
<splittable Value="0" Type="bool"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<printIfEmpty Type="bool" Value="0"/>
<splittable Type="bool" Value="0"/>
<printBeforePageHeader Type="bool" Value="0"/>
</item>
</children>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
<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"/>
<borderLineSize Type="int" Value="1"/>
<isVisible Type="bool" Value="1"/>
<borderColor Type="QColor" Value="#000000"/>
<topMargin Type="int" Value="5"/>
<bottomMargin Type="int" Value="5"/>
<rightMargin Type="int" Value="5"/>
<leftMargin Type="int" Value="5"/>
<pageOrientation Type="enumAndFlags" Value="0"/>
<pageSize Type="enumAndFlags" Value="0"/>
<gridStep Type="int" Value="2"/>
<fullPage Type="bool" Value="0"/>
<oldPrintMode Type="bool" Value="0"/>
<resetPageNumber Type="bool" Value="0"/>
<isExtendedInDesignMode Type="bool" Value="0"/>
<extendedHeight Type="int" Value="1000"/>
<pageIsTOC Type="bool" Value="0"/>
<setPageSizeToPrinter Type="bool" Value="0"/>
<endlessHeight Type="bool" Value="0"/>
</pageItem>
</item>
</pages>
<datasourcesManager ClassName="LimeReport::DataSourceManager" Type="Object">
<datasourcesManager Type="Object" ClassName="LimeReport::DataSourceManager">
<objectName Type="QString">datasources</objectName>
<connections Type="Collection">
<item ClassName="LimeReport::ConnectionDesc" Type="Object">
<item Type="Object" ClassName="LimeReport::ConnectionDesc">
<objectName Type="QString"></objectName>
<name Type="QString">test</name>
<driver Type="QString">QSQLITE</driver>
<databaseName Type="QString">./demo_reports/northwind.db</databaseName>
<databaseName Type="QString">/home/alex/Work/C++Projects/LimeReport/build/5.6.2/linux64/release/demo_r1/demo_reports/northwind.db</databaseName>
<userName Type="QString"></userName>
<password Value="" Type="QString"/>
<password Type="QString" Value=""/>
<host Type="QString"></host>
<autoconnect Value="1" Type="bool"/>
<autoconnect Type="bool" Value="0"/>
<keepDBCredentials Type="bool" Value="1"/>
</item>
</connections>
<queries Type="Collection">
<item ClassName="LimeReport::QueryDesc" Type="Object">
<item Type="Object" ClassName="LimeReport::QueryDesc">
<objectName Type="QString"></objectName>
<queryName Type="QString">customers</queryName>
<queryText Type="QString">Select * from customers limit 5</queryText>
@ -200,12 +258,21 @@ THIS.font = font;
<subqueries Type="Collection"/>
<subproxies Type="Collection"/>
<variables Type="Collection">
<item ClassName="LimeReport::VarDesc" Type="Object">
<item Type="Object" ClassName="LimeReport::VarDesc">
<objectName Type="QString"></objectName>
<name Type="QString">TestName</name>
<value Type="QString">TestValue</value>
<isMandatory Type="bool" Value="0"/>
<dataType Type="int" Value="0"/>
</item>
</variables>
</datasourcesManager>
<scriptContext Type="Object" ClassName="LimeReport::ScriptEngineContext">
<objectName Type="QString"></objectName>
<dialogs Type="Collection"/>
<initScript Type="QString"></initScript>
</scriptContext>
<suppressFieldAndVarError Type="bool" Value="0"/>
<translation Type="Translation"/>
</object>
</Report>

View File

@ -273,7 +273,10 @@ bool ScriptEngineManager::containsFunction(const QString& functionName){
}
#ifndef USE_QJSENGINE
Q_DECL_DEPRECATED bool ScriptEngineManager::addFunction(const QString& name,
#if QT_VERSION > 0x050600
Q_DECL_DEPRECATED
#endif
bool ScriptEngineManager::addFunction(const QString& name,
QScriptEngine::FunctionSignature function,
const QString& category,
const QString& description)
@ -345,11 +348,6 @@ void ScriptEngineManager::setDataManager(DataSourceManager *dataManager){
addFunction(describer);
}
// qDebug()<<"is script context exists before set datamanager is called"<< (m_context == 0);
// ICallbackDatasource* tableOfContents = m_dataManager->createCallbackDatasource("tableofcontents");
// connect(tableOfContents, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
// m_tableOfContents, SLOT(slotOneSlotDS(LimeReport::CallbackInfo,QVariant&)));
}
}
}
@ -1548,11 +1546,7 @@ void ScriptFunctionsManager::clearTableOfContents()
scriptEngineManager()->clearTableOfContents();
}
#ifdef USE_QJSENGINE
QFont ScriptFunctionsManager::font(const QString &family, int pointSize, bool bold, bool italic, bool underLine)
QFont ScriptFunctionsManager::font(const QString &family, int pointSize, bool italic, bool bold, bool underLine)
{
QFont result (family, pointSize);
result.setBold(bold);
@ -1561,6 +1555,8 @@ QFont ScriptFunctionsManager::font(const QString &family, int pointSize, bool bo
return result;
}
#ifdef USE_QJSENGINE
void ScriptFunctionsManager::addItemsToComboBox(QJSValue object, const QStringList &values)
{
QComboBox* comboBox = dynamic_cast<QComboBox*>(object.toQObject());
@ -1599,7 +1595,48 @@ QJSValue ScriptFunctionsManager::createWrapper(QJSValue item)
return QJSValue();
}
#else
void ScriptFunctionsManager::addItemsToComboBox(QScriptValue object, const QStringList &values)
{
QComboBox* comboBox = dynamic_cast<QComboBox*>(object.toQObject());
if (comboBox){
comboBox->addItems(values);
}
}
void ScriptFunctionsManager::addItemToComboBox(QScriptValue object, const QString &value)
{
QComboBox* comboBox = dynamic_cast<QComboBox*>(object.toQObject());
if (comboBox){
comboBox->addItem(value);
}
}
QScriptValue ScriptFunctionsManager::createComboBoxWrapper(QScriptValue comboBox)
{
QComboBox* item = dynamic_cast<QComboBox*>(comboBox.toQObject());
if (item){
ComboBoxWrapper* wrapper = new ComboBoxWrapper(item);
return m_scriptEngineManager->scriptEngine()->newQObject(wrapper);
}
return QScriptValue();
}
QScriptValue ScriptFunctionsManager::createWrapper(QScriptValue item)
{
QObject* object = item.toQObject();
if (object){
IWrapperCreator* wrapper = m_wrappersFactory.value(object->metaObject()->className());
if (wrapper){
return m_scriptEngineManager->scriptEngine()->newQObject(wrapper->createWrapper(item.toQObject()));
}
}
return QScriptValue();
}
#endif
QFont ScriptFunctionsManager::font(QVariantMap params){
if (!params.contains("family")){
return QFont();
@ -1694,7 +1731,7 @@ void LimeReport::TableOfContents::clear(){
}
#ifdef USE_QJSENGINE
//#ifdef USE_QJSENGINE
QObject* ComboBoxWrapperCreator::createWrapper(QObject *item)
{
@ -1705,7 +1742,7 @@ QObject* ComboBoxWrapperCreator::createWrapper(QObject *item)
return 0;
}
#endif
//#endif
#ifndef USE_QJSENGINE
void ComboBoxPrototype::addItem(const QString &text)

View File

@ -263,7 +263,6 @@ private:
QString m_scriptWrapper;
};
#ifndef USE_QJSENGINE
class ComboBoxPrototype : public QObject, public QScriptable{
Q_OBJECT
@ -275,8 +274,6 @@ public slots:
};
#endif
#ifdef USE_QJSENGINE
class IWrapperCreator{
public:
virtual QObject* createWrapper(QObject* item) = 0;
@ -298,20 +295,15 @@ private:
QObject* createWrapper(QObject* item);
};
#endif
class ScriptFunctionsManager : public QObject{
Q_OBJECT
public:
explicit ScriptFunctionsManager(QObject* parent = 0):QObject(parent){
#ifdef USE_QJSENGINE
m_wrappersFactory.insert("QComboBox",new ComboBoxWrapperCreator());
#endif
}
~ScriptFunctionsManager(){
#ifdef USE_QJSENGINE
foreach(IWrapperCreator* wrapper, m_wrappersFactory.values()){ delete wrapper;} m_wrappersFactory.clear();
#endif
}
Q_INVOKABLE QVariant calcGroupFunction(const QString& name, const QString& expressionID, const QString& bandName);
Q_INVOKABLE QVariant line(const QString& bandName);
@ -331,13 +323,17 @@ public:
Q_INVOKABLE QVariant color(const QString& color){ return QColor(color);}
Q_INVOKABLE void addTableOfContentsItem(const QString& uniqKey, const QString& content, int indent = 0);
Q_INVOKABLE void clearTableOfContents();
Q_INVOKABLE QFont font(const QString& family, int pointSize = -1, bool bold = false, bool italic = false, bool underLine = false);
#ifdef USE_QJSENGINE
Q_INVOKABLE QFont font(const QString& family, int pointSize = -1, bool bold = false, bool italic = false, bool underLine = false);
Q_INVOKABLE void addItemsToComboBox(QJSValue object, const QStringList& values);
Q_INVOKABLE void addItemToComboBox(QJSValue object, const QString& value);
Q_INVOKABLE QJSValue createComboBoxWrapper(QJSValue comboBox);
Q_INVOKABLE QJSValue createWrapper(QJSValue item);
#else
Q_INVOKABLE void addItemsToComboBox(QScriptValue object, const QStringList& values);
Q_INVOKABLE void addItemToComboBox(QScriptValue object, const QString& value);
Q_INVOKABLE QScriptValue createComboBoxWrapper(QScriptValue comboBox);
Q_INVOKABLE QScriptValue createWrapper(QScriptValue item);
#endif
Q_INVOKABLE QFont font(QVariantMap params);
ScriptEngineManager *scriptEngineManager() const;
@ -345,9 +341,7 @@ public:
static QColor createQColor(const QString& color){ return QColor(color);}
private:
ScriptEngineManager* m_scriptEngineManager;
#ifdef USE_QJSENGINE
QMap<QString, IWrapperCreator*> m_wrappersFactory;
#endif
};
class ScriptEngineManager : public QObject, public Singleton<ScriptEngineManager>, public IScriptEngineManager

View File

@ -89,9 +89,8 @@ void ScriptEditor::initCompleter()
if (m_page)
dm = m_page->datasourceManager();
ScriptEngineManager& se = LimeReport::ScriptEngineManager::instance();
#ifdef USE_QJSENGINE
ScriptEngineManager& se = LimeReport::ScriptEngineManager::instance();
QJSValue globalObject = se.scriptEngine()->globalObject();
QJSValueIterator it(globalObject);
while (it.hasNext()){