0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-23 16:22:58 +03:00

Merge branch '1.4'

# Conflicts:
#	limereport/items/lrtextitem.cpp
#	limereport/items/lrtextitem.h
#	limereport/lrdatasourcemanager.cpp
#	limereport/lrdatasourcemanager.h
This commit is contained in:
Arin Alexander 2017-03-01 00:40:36 +03:00
commit ddc793f6e4
126 changed files with 8954 additions and 1762 deletions

View File

@ -1,5 +1,13 @@
CONFIG += build_translations
CONFIG += zint
greaterThan(QT_MAJOR_VERSION, 4) {
QT += uitools
}
lessThan(QT_MAJOR_VERSION, 5){
CONFIG += uitools
}
ZINT_PATH = $$PWD/3rdparty/zint-2.4.4
CONFIG(release, debug|release){
@ -47,8 +55,8 @@ OBJECTS_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/obj
RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
LIMEREPORT_VERSION_MAJOR = 1
LIMEREPORT_VERSION_MINOR = 3
LIMEREPORT_VERSION_RELEASE = 12
LIMEREPORT_VERSION_MINOR = 4
LIMEREPORT_VERSION_RELEASE = 1
LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"'
DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\"

View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Message</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit"/>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF8"?>
<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 x="-50" width="2200" Type="QRect" height="3070" y="-50"/>
<bspTreeDepth Value="5" Type="int"/>
<font italic="0" family="MS Shell Dlg 2" underline="0" Type="QFont" pointSize="8" stylename="" weight="50"/>
<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 x="0" width="2100" Type="QRect" height="2970" y="0"/>
<children Type="Collection">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem1</objectName>
<geometry x="236" width="1216" Type="QRect" height="50" y="160"/>
<children Type="Collection"/>
<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"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="1" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">$S{Dialog.lineEdit.text}</content>
<margin Value="4" Type="int"/>
<alignment Value="33" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font italic="0" family="Arial" underline="0" Type="QFont" pointSize="10" stylename="" weight="50"/>
<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"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<underlineLineSize Value="1" Type="int"/>
<allowHTML Value="0" Type="bool"/>
<allowHTMLInFields Value="0" Type="bool"/>
<format Type="QString"></format>
<valueType Value="0" Type="enumAndFlags"/>
</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"/>
<borderColor Value="#000000" Type="QColor"/>
<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"/>
<fullPage Value="0" Type="bool"/>
<oldPrintMode Value="0" Type="bool"/>
</pageItem>
</item>
</pages>
<datasourcesManager Type="Object" ClassName="LimeReport::DataSourceManager">
<objectName Type="QString">datasources</objectName>
<connections Type="Collection"/>
<queries Type="Collection"/>
<subqueries Type="Collection"/>
<subproxies Type="Collection"/>
<variables Type="Collection"/>
</datasourcesManager>
<scriptContext Type="Object" ClassName="LimeReport::ScriptEngineContext">
<objectName Type="QString"></objectName>
<dialogs Type="Collection">
<item Type="Object" ClassName="LimeReport::DialogDescriber">
<objectName Type="QString"></objectName>
<name Type="QString">Dialog</name>
<description Value="PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjx1aSB2ZXJzaW9uPSI0LjAiPg0KIDxjbGFzcz5EaWFsb2c8L2NsYXNzPg0KIDx3aWRnZXQgY2xhc3M9IlFEaWFsb2ciIG5hbWU9IkRpYWxvZyI+DQogIDxwcm9wZXJ0eSBuYW1lPSJnZW9tZXRyeSI+DQogICA8cmVjdD4NCiAgICA8eD4wPC94Pg0KICAgIDx5PjA8L3k+DQogICAgPHdpZHRoPjQwMDwvd2lkdGg+DQogICAgPGhlaWdodD4zMDA8L2hlaWdodD4NCiAgIDwvcmVjdD4NCiAgPC9wcm9wZXJ0eT4NCiAgPHByb3BlcnR5IG5hbWU9IndpbmRvd1RpdGxlIj4NCiAgIDxzdHJpbmc+RGlhbG9nPC9zdHJpbmc+DQogIDwvcHJvcGVydHk+DQogIDxsYXlvdXQgY2xhc3M9IlFWQm94TGF5b3V0IiBuYW1lPSJ2ZXJ0aWNhbExheW91dF8yIj4NCiAgIDxpdGVtPg0KICAgIDxsYXlvdXQgY2xhc3M9IlFWQm94TGF5b3V0IiBuYW1lPSJ2ZXJ0aWNhbExheW91dCI+DQogICAgIDxpdGVtPg0KICAgICAgPGxheW91dCBjbGFzcz0iUUhCb3hMYXlvdXQiIG5hbWU9Imhvcml6b250YWxMYXlvdXQiPg0KICAgICAgIDxpdGVtPg0KICAgICAgICA8d2lkZ2V0IGNsYXNzPSJRTGFiZWwiIG5hbWU9ImxhYmVsIj4NCiAgICAgICAgIDxwcm9wZXJ0eSBuYW1lPSJ0ZXh0Ij4NCiAgICAgICAgICA8c3RyaW5nPk1lc3NhZ2U8L3N0cmluZz4NCiAgICAgICAgIDwvcHJvcGVydHk+DQogICAgICAgIDwvd2lkZ2V0Pg0KICAgICAgIDwvaXRlbT4NCiAgICAgICA8aXRlbT4NCiAgICAgICAgPHdpZGdldCBjbGFzcz0iUUxpbmVFZGl0IiBuYW1lPSJsaW5lRWRpdCIvPg0KICAgICAgIDwvaXRlbT4NCiAgICAgIDwvbGF5b3V0Pg0KICAgICA8L2l0ZW0+DQogICAgIDxpdGVtPg0KICAgICAgPHdpZGdldCBjbGFzcz0iUURpYWxvZ0J1dHRvbkJveCIgbmFtZT0iYnV0dG9uQm94Ij4NCiAgICAgICA8cHJvcGVydHkgbmFtZT0ib3JpZW50YXRpb24iPg0KICAgICAgICA8ZW51bT5RdDo6SG9yaXpvbnRhbDwvZW51bT4NCiAgICAgICA8L3Byb3BlcnR5Pg0KICAgICAgIDxwcm9wZXJ0eSBuYW1lPSJzdGFuZGFyZEJ1dHRvbnMiPg0KICAgICAgICA8c2V0PlFEaWFsb2dCdXR0b25Cb3g6OkNhbmNlbHxRRGlhbG9nQnV0dG9uQm94OjpPazwvc2V0Pg0KICAgICAgIDwvcHJvcGVydHk+DQogICAgICA8L3dpZGdldD4NCiAgICAgPC9pdGVtPg0KICAgIDwvbGF5b3V0Pg0KICAgPC9pdGVtPg0KICA8L2xheW91dD4NCiA8L3dpZGdldD4NCiA8cmVzb3VyY2VzLz4NCiA8Y29ubmVjdGlvbnM+DQogIDxjb25uZWN0aW9uPg0KICAgPHNlbmRlcj5idXR0b25Cb3g8L3NlbmRlcj4NCiAgIDxzaWduYWw+YWNjZXB0ZWQoKTwvc2lnbmFsPg0KICAgPHJlY2VpdmVyPkRpYWxvZzwvcmVjZWl2ZXI+DQogICA8c2xvdD5hY2NlcHQoKTwvc2xvdD4NCiAgIDxoaW50cz4NCiAgICA8aGludCB0eXBlPSJzb3VyY2VsYWJlbCI+DQogICAgIDx4PjI0ODwveD4NCiAgICAgPHk+MjU0PC95Pg0KICAgIDwvaGludD4NCiAgICA8aGludCB0eXBlPSJkZXN0aW5hdGlvbmxhYmVsIj4NCiAgICAgPHg+MTU3PC94Pg0KICAgICA8eT4yNzQ8L3k+DQogICAgPC9oaW50Pg0KICAgPC9oaW50cz4NCiAgPC9jb25uZWN0aW9uPg0KICA8Y29ubmVjdGlvbj4NCiAgIDxzZW5kZXI+YnV0dG9uQm94PC9zZW5kZXI+DQogICA8c2lnbmFsPnJlamVjdGVkKCk8L3NpZ25hbD4NCiAgIDxyZWNlaXZlcj5EaWFsb2c8L3JlY2VpdmVyPg0KICAgPHNsb3Q+cmVqZWN0KCk8L3Nsb3Q+DQogICA8aGludHM+DQogICAgPGhpbnQgdHlwZT0ic291cmNlbGFiZWwiPg0KICAgICA8eD4zMTY8L3g+DQogICAgIDx5PjI2MDwveT4NCiAgICA8L2hpbnQ+DQogICAgPGhpbnQgdHlwZT0iZGVzdGluYXRpb25sYWJlbCI+DQogICAgIDx4PjI4NjwveD4NCiAgICAgPHk+Mjc0PC95Pg0KICAgIDwvaGludD4NCiAgIDwvaGludHM+DQogIDwvY29ubmVjdGlvbj4NCiA8L2Nvbm5lY3Rpb25zPg0KPC91aT4NCg==" Type="QByteArray"/>
</item>
</dialogs>
<initScript Type="QString">Dialog.exec()==1</initScript>
</scriptContext>
<suppressFieldAndVarError Value="0" Type="bool"/>
</object>
</Report>

View File

@ -0,0 +1,636 @@
<?xml version="1.0" encoding="UTF8"?>
<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 x="-50" width="2200" Type="QRect" y="-50" height="3070"/>
<bspTreeDepth Value="5" Type="int"/>
<font family="MS Shell Dlg 2" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="8"/>
<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 x="0" width="2100" Type="QRect" y="0" height="2970"/>
<children Type="Collection">
<item Type="Object" ClassName="Data">
<objectName Type="QString">DataBand1</objectName>
<geometry x="50" width="2000" Type="QRect" y="362" height="100"/>
<children Type="Collection">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem1</objectName>
<geometry x="28" width="590" Type="QRect" y="6" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString">DataBand1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">$D{customers.CompanyName}</content>
<margin Value="4" Type="int"/>
<alignment Value="33" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="9"/>
<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"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem5</objectName>
<geometry x="622" width="716" Type="QRect" y="6" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString">DataBand1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">$D{customers.Address}</content>
<margin Value="4" Type="int"/>
<alignment Value="33" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="9"/>
<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"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem6</objectName>
<geometry x="1342" width="272" Type="QRect" y="6" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString">DataBand1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">$D{customers.Phone}</content>
<margin Value="4" Type="int"/>
<alignment Value="33" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="9"/>
<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"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem7</objectName>
<geometry x="1618" width="282" Type="QRect" y="6" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString">DataBand1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">$D{customers.Fax}</content>
<margin Value="4" Type="int"/>
<alignment Value="33" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="9"/>
<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"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
</children>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString">ReportPage1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<autoHeight Value="1" Type="bool"/>
<bandIndex Value="6" 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"/>
<startFromNewPage Value="0" Type="bool"/>
<alternateBackgroundColor Value="#ffffff" Type="QColor"/>
</item>
<item Type="Object" ClassName="DataHeader">
<objectName Type="QString">DataHeaderBand1</objectName>
<geometry x="50" width="2000" Type="QRect" y="154" height="100"/>
<children Type="Collection">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem2</objectName>
<geometry x="28" width="590" Type="QRect" y="40" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="2" Type="enumAndFlags"/>
<parentName Type="QString">DataHeaderBand1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">Company</content>
<margin Value="4" Type="int"/>
<alignment Value="129" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="9"/>
<backgroundOpacity Value="100" Type="int"/>
<backgroundMode Value="1" Type="enumAndFlags"/>
<backgroundColor Value="#ffffff" Type="QColor"/>
<fontColor Value="#ff0000" Type="QColor"/>
<angle Value="0" Type="enumAndFlags"/>
<foregroundOpacity Value="100" Type="int"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem4</objectName>
<geometry x="622" width="716" Type="QRect" y="40" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="2" Type="enumAndFlags"/>
<parentName Type="QString">DataHeaderBand1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">Address</content>
<margin Value="4" Type="int"/>
<alignment Value="129" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="9"/>
<backgroundOpacity Value="100" Type="int"/>
<backgroundMode Value="1" Type="enumAndFlags"/>
<backgroundColor Value="#ffffff" Type="QColor"/>
<fontColor Value="#ff0000" Type="QColor"/>
<angle Value="0" Type="enumAndFlags"/>
<foregroundOpacity Value="100" Type="int"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem8</objectName>
<geometry x="1342" width="272" Type="QRect" y="40" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="2" Type="enumAndFlags"/>
<parentName Type="QString">DataHeaderBand1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">Phone</content>
<margin Value="4" Type="int"/>
<alignment Value="129" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="9"/>
<backgroundOpacity Value="100" Type="int"/>
<backgroundMode Value="1" Type="enumAndFlags"/>
<backgroundColor Value="#ffffff" Type="QColor"/>
<fontColor Value="#ff0000" Type="QColor"/>
<angle Value="0" Type="enumAndFlags"/>
<foregroundOpacity Value="100" Type="int"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem9</objectName>
<geometry x="1618" width="282" Type="QRect" y="40" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="2" Type="enumAndFlags"/>
<parentName Type="QString">DataHeaderBand1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">Fax</content>
<margin Value="4" Type="int"/>
<alignment Value="129" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="9"/>
<backgroundOpacity Value="100" Type="int"/>
<backgroundMode Value="1" Type="enumAndFlags"/>
<backgroundColor Value="#ffffff" Type="QColor"/>
<fontColor Value="#ff0000" Type="QColor"/>
<angle Value="0" Type="enumAndFlags"/>
<foregroundOpacity Value="100" Type="int"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
</children>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString">ReportPage1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<autoHeight Value="1" Type="bool"/>
<bandIndex Value="4" Type="int"/>
<keepBottomSpace Value="0" Type="bool"/>
<parentBand Type="QString">DataBand1</parentBand>
<backgroundColor Value="#ffffff" Type="QColor"/>
<printIfEmpty Value="0" Type="bool"/>
<reprintOnEachPage Value="1" Type="bool"/>
<columnsCount Value="1" Type="int"/>
<columnsFillDirection Value="0" Type="enumAndFlags"/>
<printAlways Value="0" Type="bool"/>
<repeatOnEachRow Value="0" Type="bool"/>
</item>
<item Type="Object" ClassName="ReportHeader">
<objectName Type="QString">ReportHeader2</objectName>
<geometry x="50" width="2000" Type="QRect" y="50" height="100"/>
<children Type="Collection">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem3</objectName>
<geometry x="32" width="1868" Type="QRect" y="28" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString">ReportHeader2</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">Customers</content>
<margin Value="4" Type="int"/>
<alignment Value="132" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="75" Type="QFont" stylename="" italic="0" underline="0" pointSize="10"/>
<backgroundOpacity Value="100" Type="int"/>
<backgroundMode Value="1" Type="enumAndFlags"/>
<backgroundColor Value="#8c8c8c" Type="QColor"/>
<fontColor Value="#ffffff" Type="QColor"/>
<angle Value="0" Type="enumAndFlags"/>
<foregroundOpacity Value="100" Type="int"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
</children>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString">ReportPage1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<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>
<item Type="Object" ClassName="PageFooter">
<objectName Type="QString">PageFooter9</objectName>
<geometry x="50" width="2000" Type="QRect" y="540" height="100"/>
<children Type="Collection">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem10</objectName>
<geometry x="18" width="1962" Type="QRect" y="22" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="1" Type="enumAndFlags"/>
<parentName Type="QString">PageFooter9</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">Page $V{#PAGE} of $V{#PAGE_COUNT}</content>
<margin Value="4" Type="int"/>
<alignment Value="130" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="9"/>
<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"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
</children>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString">ReportPage1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<autoHeight Value="1" Type="bool"/>
<bandIndex Value="8" Type="int"/>
<keepBottomSpace Value="0" Type="bool"/>
<parentBand Type="QString"></parentBand>
<backgroundColor Value="#ffffff" Type="QColor"/>
<printIfEmpty Value="0" Type="bool"/>
<printOnFirstPage Value="1" Type="bool"/>
<printOnLastPage Value="1" Type="bool"/>
</item>
<item Type="Object" ClassName="GroupHeader">
<objectName Type="QString">GroupBandHeader1</objectName>
<geometry x="50" width="2000" Type="QRect" y="258" height="100"/>
<children Type="Collection">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem11</objectName>
<geometry x="28" width="1870" Type="QRect" y="24" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString">GroupBandHeader1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">$S{$D{customers.CompanyName}.substring(0,1).toUpperCase();}</content>
<margin Value="4" Type="int"/>
<alignment Value="33" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="10"/>
<backgroundOpacity Value="100" Type="int"/>
<backgroundMode Value="1" Type="enumAndFlags"/>
<backgroundColor Value="#dfdfdf" Type="QColor"/>
<fontColor Value="#95221e" Type="QColor"/>
<angle Value="0" Type="enumAndFlags"/>
<foregroundOpacity Value="100" Type="int"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
</children>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString">ReportPage1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<autoHeight Value="1" Type="bool"/>
<bandIndex Value="5" Type="int"/>
<keepBottomSpace Value="0" Type="bool"/>
<parentBand Type="QString">DataBand1</parentBand>
<backgroundColor Value="#ffffff" Type="QColor"/>
<printIfEmpty Value="0" Type="bool"/>
<groupFieldName Type="QString"></groupFieldName>
<splittable Value="0" Type="bool"/>
<keepGroupTogether Value="0" Type="bool"/>
<startNewPage Value="0" Type="bool"/>
<resetPageNumber Value="0" Type="bool"/>
<reprintOnEachPage Value="0" Type="bool"/>
<condition Type="QString">$S{$D{customers.CompanyName}.substring(0,1).toUpperCase();}</condition>
</item>
<item Type="Object" ClassName="GroupFooter">
<objectName Type="QString">GroupBandFooter11</objectName>
<geometry x="50" width="2000" Type="QRect" y="466" height="70"/>
<children Type="Collection">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem12</objectName>
<geometry x="34" width="1866" Type="QRect" y="8" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="1" Type="enumAndFlags"/>
<parentName Type="QString">GroupBandFooter11</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#999999" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">Count: $S{COUNT($D{customers.CompanyName},"DataBand1")}</content>
<margin Value="4" Type="int"/>
<alignment Value="130" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="9"/>
<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"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
</children>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString">ReportPage1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<autoHeight Value="1" Type="bool"/>
<bandIndex Value="7" Type="int"/>
<keepBottomSpace Value="0" Type="bool"/>
<parentBand Type="QString">GroupBandHeader1</parentBand>
<backgroundColor Value="#ffffff" Type="QColor"/>
<printIfEmpty Value="0" Type="bool"/>
</item>
</children>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString"></parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<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"/>
<fullPage Value="0" Type="bool"/>
<oldPrintMode Value="0" Type="bool"/>
<resetPageNumber Value="0" Type="bool"/>
</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.db</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">customers</queryName>
<queryText Type="QString">Select * from customers</queryText>
<connectionName Type="QString">northwind.db</connectionName>
</item>
</queries>
<subqueries Type="Collection"/>
<subproxies Type="Collection"/>
<variables Type="Collection"/>
</datasourcesManager>
<scriptContext Type="Object" ClassName="LimeReport::ScriptEngineContext">
<objectName Type="QString"></objectName>
<dialogs Type="Collection"/>
<initScript Type="QString"></initScript>
</scriptContext>
<suppressFieldAndVarError Value="0" Type="bool"/>
</object>
</Report>

View File

@ -0,0 +1,521 @@
<?xml version="1.0" encoding="UTF8"?>
<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 x="-50" width="2200" Type="QRect" y="-50" height="3070"/>
<bspTreeDepth Value="5" Type="int"/>
<font family="MS Shell Dlg 2" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="8"/>
<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 x="0" width="2100" Type="QRect" y="0" height="2970"/>
<children Type="Collection">
<item Type="Object" ClassName="Data">
<objectName Type="QString">DataBand1</objectName>
<geometry x="50" width="2000" Type="QRect" y="258" height="62"/>
<children Type="Collection">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem1</objectName>
<geometry x="28" width="590" Type="QRect" y="6" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString">DataBand1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">$D{customers.CompanyName}</content>
<margin Value="4" Type="int"/>
<alignment Value="33" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="9"/>
<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"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem5</objectName>
<geometry x="622" width="716" Type="QRect" y="6" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString">DataBand1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">$D{customers.Address}</content>
<margin Value="4" Type="int"/>
<alignment Value="33" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="9"/>
<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"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem6</objectName>
<geometry x="1342" width="272" Type="QRect" y="6" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString">DataBand1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">$D{customers.Phone}</content>
<margin Value="4" Type="int"/>
<alignment Value="33" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="9"/>
<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"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem7</objectName>
<geometry x="1618" width="282" Type="QRect" y="6" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString">DataBand1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">$D{customers.Fax}</content>
<margin Value="4" Type="int"/>
<alignment Value="33" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="9"/>
<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"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
</children>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString">ReportPage1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<autoHeight Value="1" Type="bool"/>
<bandIndex Value="6" 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"/>
<startFromNewPage Value="0" Type="bool"/>
<alternateBackgroundColor Value="#f3f3f3" Type="QColor"/>
</item>
<item Type="Object" ClassName="DataHeader">
<objectName Type="QString">DataHeaderBand1</objectName>
<geometry x="50" width="2000" Type="QRect" y="154" height="100"/>
<children Type="Collection">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem2</objectName>
<geometry x="28" width="590" Type="QRect" y="40" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="2" Type="enumAndFlags"/>
<parentName Type="QString">DataHeaderBand1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">Company</content>
<margin Value="4" Type="int"/>
<alignment Value="129" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="9"/>
<backgroundOpacity Value="100" Type="int"/>
<backgroundMode Value="1" Type="enumAndFlags"/>
<backgroundColor Value="#ffffff" Type="QColor"/>
<fontColor Value="#ff0000" Type="QColor"/>
<angle Value="0" Type="enumAndFlags"/>
<foregroundOpacity Value="100" Type="int"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem4</objectName>
<geometry x="622" width="716" Type="QRect" y="40" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="2" Type="enumAndFlags"/>
<parentName Type="QString">DataHeaderBand1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">Address</content>
<margin Value="4" Type="int"/>
<alignment Value="129" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="9"/>
<backgroundOpacity Value="100" Type="int"/>
<backgroundMode Value="1" Type="enumAndFlags"/>
<backgroundColor Value="#ffffff" Type="QColor"/>
<fontColor Value="#ff0000" Type="QColor"/>
<angle Value="0" Type="enumAndFlags"/>
<foregroundOpacity Value="100" Type="int"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem8</objectName>
<geometry x="1342" width="272" Type="QRect" y="40" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="2" Type="enumAndFlags"/>
<parentName Type="QString">DataHeaderBand1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">Phone</content>
<margin Value="4" Type="int"/>
<alignment Value="129" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="9"/>
<backgroundOpacity Value="100" Type="int"/>
<backgroundMode Value="1" Type="enumAndFlags"/>
<backgroundColor Value="#ffffff" Type="QColor"/>
<fontColor Value="#ff0000" Type="QColor"/>
<angle Value="0" Type="enumAndFlags"/>
<foregroundOpacity Value="100" Type="int"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem9</objectName>
<geometry x="1618" width="282" Type="QRect" y="40" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="2" Type="enumAndFlags"/>
<parentName Type="QString">DataHeaderBand1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">Fax</content>
<margin Value="4" Type="int"/>
<alignment Value="129" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="9"/>
<backgroundOpacity Value="100" Type="int"/>
<backgroundMode Value="1" Type="enumAndFlags"/>
<backgroundColor Value="#ffffff" Type="QColor"/>
<fontColor Value="#ff0000" Type="QColor"/>
<angle Value="0" Type="enumAndFlags"/>
<foregroundOpacity Value="100" Type="int"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
</children>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString">ReportPage1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<autoHeight Value="1" Type="bool"/>
<bandIndex Value="4" Type="int"/>
<keepBottomSpace Value="0" Type="bool"/>
<parentBand Type="QString">DataBand1</parentBand>
<backgroundColor Value="#ffffff" Type="QColor"/>
<printIfEmpty Value="0" Type="bool"/>
<reprintOnEachPage Value="1" Type="bool"/>
<columnsCount Value="1" Type="int"/>
<columnsFillDirection Value="0" Type="enumAndFlags"/>
<printAlways Value="0" Type="bool"/>
<repeatOnEachRow Value="0" Type="bool"/>
</item>
<item Type="Object" ClassName="ReportHeader">
<objectName Type="QString">ReportHeader2</objectName>
<geometry x="50" width="2000" Type="QRect" y="50" height="100"/>
<children Type="Collection">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem3</objectName>
<geometry x="32" width="1868" Type="QRect" y="28" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString">ReportHeader2</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">Customers</content>
<margin Value="4" Type="int"/>
<alignment Value="132" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="75" Type="QFont" stylename="" italic="0" underline="0" pointSize="10"/>
<backgroundOpacity Value="100" Type="int"/>
<backgroundMode Value="1" Type="enumAndFlags"/>
<backgroundColor Value="#8c8c8c" Type="QColor"/>
<fontColor Value="#ffffff" Type="QColor"/>
<angle Value="0" Type="enumAndFlags"/>
<foregroundOpacity Value="100" Type="int"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
</children>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString">ReportPage1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<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>
<item Type="Object" ClassName="PageFooter">
<objectName Type="QString">PageFooter9</objectName>
<geometry x="50" width="2000" Type="QRect" y="324" height="100"/>
<children Type="Collection">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem10</objectName>
<geometry x="18" width="1962" Type="QRect" y="22" height="50"/>
<children Type="Collection"/>
<zOrder Value="0" Type="qreal"/>
<borders Value="1" Type="enumAndFlags"/>
<parentName Type="QString">PageFooter9</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<itemLocation Value="0" Type="enumAndFlags"/>
<stretchToMaxHeight Value="0" Type="bool"/>
<itemAlign Value="4" Type="enumAndFlags"/>
<content Type="QString">Page $V{#PAGE} of $V{#PAGE_COUNT}</content>
<margin Value="4" Type="int"/>
<alignment Value="130" Type="enumAndFlags"/>
<autoWidth Value="0" Type="enumAndFlags"/>
<autoHeight Value="0" Type="bool"/>
<font family="Arial" weight="50" Type="QFont" stylename="" italic="0" underline="0" pointSize="9"/>
<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"/>
<underlines Value="0" Type="bool"/>
<adaptFontToSize Value="0" Type="bool"/>
<trimValue Value="1" Type="bool"/>
<lineSpacing Value="1" Type="int"/>
<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>
</item>
</children>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString">ReportPage1</parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<autoHeight Value="1" Type="bool"/>
<bandIndex Value="8" Type="int"/>
<keepBottomSpace Value="0" Type="bool"/>
<parentBand Type="QString"></parentBand>
<backgroundColor Value="#ffffff" Type="QColor"/>
<printIfEmpty Value="0" Type="bool"/>
<printOnFirstPage Value="1" Type="bool"/>
<printOnLastPage Value="1" Type="bool"/>
</item>
</children>
<zOrder Value="0" Type="qreal"/>
<borders Value="0" Type="enumAndFlags"/>
<parentName Type="QString"></parentName>
<borderLineSize Value="0" Type="int"/>
<isVisible Value="1" Type="bool"/>
<borderColor Value="#000000" Type="QColor"/>
<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"/>
<fullPage Value="0" Type="bool"/>
<oldPrintMode Value="0" Type="bool"/>
<resetPageNumber Value="0" Type="bool"/>
</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.db</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">customers</queryName>
<queryText Type="QString">Select * from customers</queryText>
<connectionName Type="QString">northwind.db</connectionName>
</item>
</queries>
<subqueries Type="Collection"/>
<subproxies Type="Collection"/>
<variables Type="Collection"/>
</datasourcesManager>
<scriptContext Type="Object" ClassName="LimeReport::ScriptEngineContext">
<objectName Type="QString"></objectName>
<dialogs Type="Collection"/>
<initScript Type="QString"></initScript>
</scriptContext>
<suppressFieldAndVarError Value="0" Type="bool"/>
</object>
</Report>

View File

@ -33,8 +33,8 @@
#include <QMessageBox>
#include <QtSql/QSqlQuery>
#include <QtSql/QSqlRecord>
#include "lrreportengine.h"
#include "lrcallbackdatasourceintf.h"
#include <LimeReport>
#include <LRCallbackDS>
#include <QDebug>
#include <QStringListModel>
@ -76,14 +76,16 @@ MainWindow::MainWindow(QWidget *parent) :
this, SLOT(slotGetCallbackData(LimeReport::CallbackInfo,QVariant&)));
connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)),
this, SLOT(slotChangePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)));
//report->dataManager()->addCallbackDatasource(callbackDatasource,"master");
callbackDatasource = report->dataManager()->createCallbackDatasouce("detail");
connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
this, SLOT(slotGetCallbackChildData(LimeReport::CallbackInfo,QVariant&)));
connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)),
this, SLOT(slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosType&,bool&)));
//report->dataManager()->addCallbackDatasource(callbackDatasource,"detail");
callbackDatasource = report->dataManager()->createCallbackDatasouce("oneSlotDS");
connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
this, SLOT(slotOneSlotDS(LimeReport::CallbackInfo,QVariant&)));
QStringList simpleData;
simpleData << "value1" << "value2" << "value3";
@ -102,6 +104,8 @@ MainWindow::MainWindow(QWidget *parent) :
MainWindow::~MainWindow()
{
delete ui;
delete m_customers;
delete m_orders;
}
void MainWindow::on_pushButton_clicked()
@ -208,3 +212,32 @@ void MainWindow::slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosTyp
if (type == LimeReport::CallbackInfo::First) result = ds->first();
else result = ds->next();
}
void MainWindow::slotOneSlotDS(LimeReport::CallbackInfo info, QVariant &data)
{
QStringList columns;
columns << "Name" << "Value" << "Image";
switch (info.dataType) {
case LimeReport::CallbackInfo::RowCount:
data = 4;
break;
case LimeReport::CallbackInfo::ColumnCount:
data = columns.size();
break;
// case LimeReport::CallbackInfo::IsEmpty:
// data = false;
// break;
case LimeReport::CallbackInfo::ColumnHeaderData: {
data = columns.at(info.index);
break;
}
case LimeReport::CallbackInfo::ColumnData:
if (info.columnName == "Image")
data = QImage(":/report//images/logo32");
else {
data = info.columnName+" "+QString::number(info.index);
}
break;
default: break;
}
}

View File

@ -57,6 +57,7 @@ private slots:
void slotChangePos(const LimeReport::CallbackInfo::ChangePosType& type, bool& result);
void slotGetCallbackChildData(LimeReport::CallbackInfo info, QVariant& data);
void slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosType& type, bool& result);
void slotOneSlotDS(LimeReport::CallbackInfo info, QVariant& data);
private:
void prepareData(QSqlQuery* ds, LimeReport::CallbackInfo info, QVariant &data);
private:

View File

@ -5,6 +5,9 @@ int main(int argc, char *argv[])
{
QApplication a(argc, argv);
LimeReport::ReportEngine report;
if (a.arguments().count()>1){
report.loadFromFile(a.arguments().at(1));
}
report.designReport();
return a.exec();
}

497
followTo.patch Normal file
View File

@ -0,0 +1,497 @@
diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp
index 7d61562..041a737 100644
--- a/limereport/items/lrtextitem.cpp
+++ b/limereport/items/lrtextitem.cpp
@@ -31,6 +31,7 @@
#include <QTextLayout>
#include <QtScript/QScriptEngine>
#include <QLocale>
+#include <QMessageBox>
#include <math.h>
#include "lrpagedesignintf.h"
@@ -57,7 +58,7 @@ namespace LimeReport{
TextItem::TextItem(QObject *owner, QGraphicsItem *parent)
: ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false),
- m_allowHTMLInFields(false)
+ m_allowHTMLInFields(false), m_followTo(""), m_follower(0)
{
m_text = new QTextDocument();
@@ -265,8 +266,13 @@ void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, i
setWidth(m_textSize.width() + fakeMarginSize()*2);
}
- if ((m_textSize.height()>height()) && (m_autoHeight) ){
- setHeight(m_textSize.height()+borderLineSize()*2);
+ if (m_textSize.height()>height()) {
+ if (m_autoHeight)
+ setHeight(m_textSize.height()+borderLineSize()*2);
+ else if (hasFollower() && !content().isEmpty()){
+ follower()->setContent(getTextPart(0,height()));
+ setContent(getTextPart(height(),0));
+ }
}
BaseDesignIntf::updateItemSize(dataManager, pass, maxHeight);
}
@@ -353,6 +359,7 @@ void TextItem::setLineSpacing(int value)
void TextItem::initText()
{
+ if (!m_text) return;
QTextOption to;
to.setAlignment(m_alignment);
@@ -454,6 +461,66 @@ QString TextItem::formatFieldValue()
}
}
+QString TextItem::followTo() const
+{
+ return m_followTo;
+}
+
+void TextItem::setFollowTo(const QString &followTo)
+{
+ if (m_followTo != followTo){
+ QString oldValue = m_followTo;
+ m_followTo = followTo;
+ if (!isLoading()){
+ TextItem* fi = scene()->findChild<TextItem*>(followTo);
+ if (fi && initFollower(followTo)){
+ notify("followTo",oldValue,followTo);
+ } else {
+ m_followTo = "";
+ QMessageBox::critical(
+ 0,
+ tr("Error"),
+ tr("TextItem \" %1 \" already has folower \" %2 \" ")
+ .arg(fi->objectName())
+ .arg(fi->follower()->objectName())
+ );
+ notify("followTo",followTo,"");
+ }
+ }
+ }
+}
+
+void TextItem::setFollower(TextItem *follower)
+{
+ if (!m_follower){
+ m_follower = follower;
+ }
+}
+
+bool TextItem::hasFollower()
+{
+ return m_follower != 0;
+}
+
+bool TextItem::initFollower(QString follower)
+{
+ TextItem* fi = scene()->findChild<TextItem*>(follower);
+ if (fi){
+ if (!fi->hasFollower()){
+ fi->setFollower(this);
+ return true;
+ }
+ }
+ return false;
+}
+
+void TextItem::pageObjectHasBeenLoaded()
+{
+ if (!m_followTo.isEmpty()){
+ initFollower(m_followTo);
+ }
+}
+
TextItem::ValueType TextItem::valueType() const
{
return m_valueType;
@@ -537,6 +604,7 @@ bool TextItem::isNeedUpdateSize(RenderPass pass) const
Q_UNUSED(pass)
bool res = (m_textSize.height()>geometry().height()&&autoHeight()) ||
(m_textSize.width()>geometry().width()&&autoWidth()) ||
+ m_follower ||
isNeedExpandContent();
return res;
}
@@ -557,6 +625,7 @@ void TextItem::setAlignment(Qt::Alignment value)
void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass)
{
+
QString context=content();
ExpandType expandType = (allowHTML() && !allowHTMLInFields())?ReplaceHTMLSymbols:NoEscapeSymbols;
switch(pass){
@@ -575,6 +644,7 @@ void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass)
} else {
setContent(context);
}
+
}
void TextItem::setAutoHeight(bool value)
@@ -611,63 +681,79 @@ bool TextItem::canBeSplitted(int height) const
return height>(m_text->begin().layout()->lineAt(0).height());
}
-BaseDesignIntf *TextItem::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent)
-{
+QString TextItem::getTextPart(int height, int skipHeight){
int linesHeight=0;
- QString tmpText="";
- TextItem* upperPart = dynamic_cast<TextItem*>(cloneItem(itemMode(),owner,parent));
+ int curLine=0;
+ int textPos=0;
- for (QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){
- for (int i=0;i<it.layout()->lineCount();i++){
- linesHeight+=it.layout()->lineAt(i).height()+lineSpacing();
- if (linesHeight>(height-(fakeMarginSize()*2+borderLineSize()*2))) {
- linesHeight-=it.layout()->lineAt(i).height();
- goto loop_exit;
+ QTextBlock curBlock = m_text->begin();
+ QString resultText="";
+
+ if (skipHeight>0){
+ for (;curBlock!=m_text->end();curBlock=curBlock.next()){
+ for (curLine=0;curLine<curBlock.layout()->lineCount();curLine++){
+ linesHeight+=curBlock.layout()->lineAt(curLine).height()+lineSpacing();
+ if (linesHeight>(skipHeight-(/*fakeMarginSize()*2+*/borderLineSize()*2))) {goto loop_exit;}
+ }
+ }
+ loop_exit:;
+ }
+
+ linesHeight = 0;
+ qDebug()<<curBlock.lineCount();
+ qDebug()<<(curBlock == m_text->end());
+ for (;curBlock!=m_text->end() || curLine<curBlock.lineCount();curBlock=curBlock.next(), curLine=0, resultText+='\n'){
+ for (;curLine<curBlock.layout()->lineCount();curLine++){
+ if (resultText=="") textPos= curBlock.layout()->lineAt(curLine).textStart();
+ linesHeight+=curBlock.layout()->lineAt(curLine).height()+lineSpacing();
+ if ( (height>0) && (linesHeight>(height-(/*fakeMarginSize()*2+*/borderLineSize()*2))) ) {
+ linesHeight-=curBlock.layout()->lineAt(curLine).height();
+ goto loop_exit1;
}
- tmpText+=it.text().mid(it.layout()->lineAt(i).textStart(),it.layout()->lineAt(i).textLength())+'\n';
+ resultText+=curBlock.text().mid(curBlock.layout()->lineAt(curLine).textStart(),
+ curBlock.layout()->lineAt(curLine).textLength());
}
}
- loop_exit:
- tmpText.chop(1);
+ loop_exit1:;
+
+ resultText.chop(1);
- upperPart->setHeight(linesHeight+fakeMarginSize()*2+borderLineSize()*2);
QScopedPointer<HtmlContext> context(new HtmlContext(m_strText));
- upperPart->setContent(context->extendTextByTags(tmpText,0));
- upperPart->initText();
- return upperPart;
+ return context->extendTextByTags(resultText,textPos);
}
-BaseDesignIntf *TextItem::cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent)
+void TextItem::restoreLinksEvent()
{
- TextItem* bottomPart = dynamic_cast<TextItem*>(cloneItem(itemMode(),owner,parent));
- int linesHeight=0;
- int curLine=0;
- QTextBlock curBlock;
-
- QString tmpText="";
-
- for (curBlock=m_text->begin();curBlock!=m_text->end();curBlock=curBlock.next()){
- for (curLine=0;curLine<curBlock.layout()->lineCount();curLine++){
- linesHeight+=curBlock.layout()->lineAt(curLine).height()+lineSpacing();
- if (linesHeight>(height-(fakeMarginSize()*2+borderLineSize()*2))) {goto loop_exit;}
+ if (!followTo().isEmpty()){
+ BaseDesignIntf* pi = dynamic_cast<BaseDesignIntf*>(parentItem());
+ if (pi){
+ foreach (BaseDesignIntf* bi, pi->childBaseItems()) {
+ if (bi->patternName().compare(followTo())==0){
+ TextItem* ti = dynamic_cast<TextItem*>(bi);
+ if (ti){
+ ti->setFollower(this);
+ }
+ }
+ }
}
}
- loop_exit:;
+}
- int textPos=0;
- for (;curBlock!=m_text->end();curBlock=curBlock.next(),curLine=0){
- for (;curLine<curBlock.layout()->lineCount();curLine++){
- if (tmpText=="") textPos= curBlock.layout()->lineAt(curLine).textStart();
- tmpText+=curBlock.text().mid(curBlock.layout()->lineAt(curLine).textStart(),
- curBlock.layout()->lineAt(curLine).textLength()) + "\n";
- }
- }
- tmpText.chop(1);
+BaseDesignIntf *TextItem::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent)
+{
+ TextItem* upperPart = dynamic_cast<TextItem*>(cloneItem(itemMode(),owner,parent));
+ upperPart->setContent(getTextPart(height,0));
+ upperPart->initText();
+ upperPart->setHeight(upperPart->textSize().height()+borderLineSize()*2);
+ return upperPart;
+}
- QScopedPointer<HtmlContext> context(new HtmlContext(m_strText));
- bottomPart->setContent(context->extendTextByTags(tmpText,textPos));
+BaseDesignIntf *TextItem::cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent)
+{
+ TextItem* bottomPart = dynamic_cast<TextItem*>(cloneItem(itemMode(),owner,parent));
+ bottomPart->setContent(getTextPart(0,height));
bottomPart->initText();
- bottomPart->setHeight(bottomPart->m_textSize.height()+borderLineSize()*2);
+ bottomPart->setHeight(bottomPart->textSize().height()+borderLineSize()*2);
return bottomPart;
}
diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h
index 07c3412..bda15d8 100644
--- a/limereport/items/lrtextitem.h
+++ b/limereport/items/lrtextitem.h
@@ -32,15 +32,16 @@
#include <QGraphicsTextItem>
#include <QtGui>
#include <QLabel>
-#include "lritemdesignintf.h"
-#include <qnamespace.h>
-
#include <QTextDocument>
+#include "lritemdesignintf.h"
+#include "lritemdesignintf.h"
+#include "lrpageinitintf.h"
+
namespace LimeReport {
class Tag;
-class TextItem : public LimeReport::ContentItemDesignIntf {
+class TextItem : public LimeReport::ContentItemDesignIntf, IPageInit {
Q_OBJECT
Q_ENUMS(AutoWidth)
Q_ENUMS(AngleType)
@@ -66,6 +67,7 @@ class TextItem : public LimeReport::ContentItemDesignIntf {
Q_PROPERTY(bool allowHTMLInFields READ allowHTMLInFields WRITE setAllowHTMLInFields)
Q_PROPERTY(QString format READ format WRITE setFormat)
Q_PROPERTY(ValueType valueType READ valueType WRITE setValueType)
+ Q_PROPERTY(QString followTo READ followTo WRITE setFollowTo)
public:
enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength};
@@ -140,12 +142,25 @@ public:
ValueType valueType() const;
void setValueType(const ValueType valueType);
+ QSizeF textSize(){ return m_textSize;}
+ QString followTo() const;
+ void setFollowTo(const QString &followTo);
+ void setFollower(TextItem* follower);
+ bool hasFollower();
+ TextItem* follower(){ return m_follower;}
+ bool initFollower(QString follower);
+
+ // IPageInit interface
+ void pageObjectHasBeenLoaded();
+
protected:
void updateLayout();
bool isNeedExpandContent() const;
QString replaceBR(QString text);
QString replaceReturns(QString text);
int fakeMarginSize();
+ QString getTextPart(int height, int skipHeight);
+ void restoreLinksEvent();
private:
void initText();
void setTextFont(const QFont &value);
@@ -174,6 +189,8 @@ private:
QString m_format;
ValueType m_valueType;
+ QString m_followTo;
+ TextItem* m_follower;
};
}
diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp
index a55f74c..c7b3dcc 100644
--- a/limereport/lrbanddesignintf.cpp
+++ b/limereport/lrbanddesignintf.cpp
@@ -889,6 +889,7 @@ void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass p
if (borderLines()!=0){
spaceBorder += borderLineSize();
}
+ restoreLinks();
snapshotItemsLayout();
arrangeSubItems(pass, dataManager);
if (autoHeight()){
diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp
index 8b632d5..a901997 100644
--- a/limereport/lrbasedesignintf.cpp
+++ b/limereport/lrbasedesignintf.cpp
@@ -76,7 +76,8 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q
m_itemAlign(DesignedItemAlign),
m_changingItemAlign(false),
m_borderColor(Qt::black),
- m_reportSettings(0)
+ m_reportSettings(0),
+ m_patternName("")
{
setGeometry(QRectF(0, 0, m_width, m_height));
if (BaseDesignIntf *item = dynamic_cast<BaseDesignIntf *>(parent)) {
@@ -672,6 +673,16 @@ void BaseDesignIntf::turnOnSelectionMarker(bool value)
}
}
+QString BaseDesignIntf::patternName() const
+{
+ return m_patternName;
+}
+
+void BaseDesignIntf::setPatternName(const QString &patternName)
+{
+ m_patternName = patternName;
+}
+
ReportSettings *BaseDesignIntf::reportSettings() const
{
return m_reportSettings;
@@ -737,7 +748,7 @@ void BaseDesignIntf::emitObjectNamePropertyChanged(const QString &oldName, const
int BaseDesignIntf::borderLineSize() const
{
- return m_borderLineSize;
+ return 0 /*m_borderLineSize*/;
}
void BaseDesignIntf::setBorderLineSize(int value)
@@ -987,6 +998,19 @@ void BaseDesignIntf::parentChangedEvent(BaseDesignIntf *)
}
+void BaseDesignIntf::restoreLinks()
+{
+#ifdef HAVE_QT5
+ foreach(QObject * child, children()) {
+#else
+ foreach(QObject * child, QObject::children()) {
+#endif
+ BaseDesignIntf *childItem = dynamic_cast<BaseDesignIntf *>(child);
+ if (childItem) {childItem->restoreLinks();}
+ }
+ restoreLinksEvent();
+}
+
QPainterPath BaseDesignIntf::shape() const
{
QPainterPath path;
@@ -1229,6 +1253,7 @@ void BaseDesignIntf::collectionLoadFinished(const QString &collectionName)
BaseDesignIntf *BaseDesignIntf::cloneItem(ItemMode mode, QObject *owner, QGraphicsItem *parent)
{
BaseDesignIntf *clone = cloneItemWOChild(mode, owner, parent);
+ clone->setPatternName(this->objectName());
#ifdef HAVE_QT5
foreach(QObject * child, children()) {
#else
diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h
index f31bf73..dae9cf4 100644
--- a/limereport/lrbasedesignintf.h
+++ b/limereport/lrbasedesignintf.h
@@ -249,6 +249,8 @@ public:
ReportSettings* reportSettings() const;
void setReportSettings(ReportSettings *reportSettings);
void setZValueProperty(qreal value);
+ QString patternName() const;
+ void setPatternName(const QString &patternName);
Q_INVOKABLE QString setItemWidth(qreal width);
Q_INVOKABLE QString setItemHeight(qreal height);
@@ -258,6 +260,7 @@ public:
Q_INVOKABLE qreal getItemPosY();
Q_INVOKABLE QString setItemPosX(qreal xValue);
Q_INVOKABLE QString setItemPosY(qreal yValue);
+
protected:
//ICollectionContainer
@@ -283,6 +286,8 @@ protected:
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
virtual void childAddedEvent(BaseDesignIntf* child);
virtual void parentChangedEvent(BaseDesignIntf*);
+ void restoreLinks();
+ virtual void restoreLinksEvent(){}
void drawTopLine(QPainter *painter, QRectF rect) const;
void drawBootomLine(QPainter *painter, QRectF rect) const;
@@ -359,6 +364,7 @@ private:
bool m_changingItemAlign;
QColor m_borderColor;
ReportSettings* m_reportSettings;
+ QString m_patternName;
signals:
void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
void posChanged(QObject* object, QPointF newPos, QPointF oldPos);
diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp
index 42dacef..3d39635 100644
--- a/limereport/lrreportrender.cpp
+++ b/limereport/lrreportrender.cpp
@@ -204,7 +204,6 @@ void ReportRender::renderPage(PageDesignIntf* patternPage)
resetPageNumber(PageReset);
}
- //m_pageCount = 1;
m_renderCanceled = false;
BandDesignIntf* reportFooter = m_patternPageItem->bandByType(BandDesignIntf::ReportFooter);
m_reportFooterHeight = 0;
@@ -225,9 +224,7 @@ void ReportRender::renderPage(PageDesignIntf* patternPage)
QMessageBox::critical(0,tr("Error"),exception.what());
return;
}
-
clearPageMap();
-
startNewPage();
renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader),StartNewPageAsNeeded);
@@ -543,15 +540,21 @@ void ReportRender::renderPageFooter(PageItemDesignIntf *patternPage)
void ReportRender::renderPageItems(PageItemDesignIntf* patternPage)
{
+ QList<BaseDesignIntf*> pageItems;
foreach (BaseDesignIntf* item, patternPage->childBaseItems()) {
ItemDesignIntf* id = dynamic_cast<ItemDesignIntf*>(item);
if (id&&id->itemLocation()==ItemDesignIntf::Page){
BaseDesignIntf* cloneItem = item->cloneItem(m_renderPageItem->itemMode(),
m_renderPageItem,
m_renderPageItem);
- cloneItem->updateItemSize(m_datasources);
+ pageItems.append(cloneItem);
+ //cloneItem->updateItemSize(m_datasources);
}
}
+ m_renderPageItem->restoreLinks();
+ foreach(BaseDesignIntf* item, pageItems){
+ item->updateItemSize(m_datasources);
+ }
}
qreal ReportRender::calcPageFooterHeight(PageItemDesignIntf *patternPage)
@@ -978,7 +981,6 @@ void ReportRender::startNewPage()
renderBand(band);
}
checkLostHeadersOnPrevPage();
-
pasteGroups();
renderPageItems(m_patternPageItem);
}

View File

@ -37,18 +37,25 @@ class QString;
class QAbstractItemModel;
namespace LimeReport{
class IDbCredentialsProvider{
public:
virtual QString getUserName(const QString& connectionName) = 0;
virtual QString getPassword(const QString& connectionName) = 0;
};
class IDataSourceManager{
public:
virtual void setReportVariable(const QString& name, const QVariant& value)=0;
virtual void setDefaultDatabasePath(const QString &defaultDatabasePath)=0;
virtual void deleteVariable(const QString& name)=0;
virtual bool containsVariable(const QString& variableName)=0;
virtual QVariant variable(const QString& variableName)=0;
virtual bool addModel(const QString& name, QAbstractItemModel *model, bool owned)=0;
virtual void removeModel(const QString& name)=0;
virtual bool containsDatasource(const QString& dataSourceName)=0;
virtual void setReportVariable(const QString& name, const QVariant& value) = 0;
virtual void setDefaultDatabasePath(const QString &defaultDatabasePath) = 0;
virtual void deleteVariable(const QString& name) = 0;
virtual bool containsVariable(const QString& variableName) = 0;
virtual QVariant variable(const QString& variableName) = 0;
virtual bool addModel(const QString& name, QAbstractItemModel *model, bool owned) = 0;
virtual void removeModel(const QString& name) = 0;
virtual bool containsDatasource(const QString& dataSourceName) = 0;
virtual void clearUserVariables()=0;
virtual ICallbackDatasource* createCallbackDatasouce(const QString& name) = 0;
virtual void registerDbCredentialsProvider(IDbCredentialsProvider* provider) = 0;
//virtual void addCallbackDatasource(ICallbackDatasource* datasource, const QString& name) = 0;
};

View File

@ -51,4 +51,20 @@ void ReportSettings::setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentF
m_suppressAbsentFieldsAndVarsWarnings = suppressAbsentFieldsAndVarsWarnings;
}
QString escapeSimbols(const QString &value)
{
QString result = value;
result.replace("\"","\\\"");
result.replace('\n',"\\n");
return result;
}
QString replaceHTMLSymbols(const QString &value)
{
QString result = value;
result.replace("<","&lt;");
result.replace(">","&gt;");
return result;
}
} //namespace LimeReport

View File

@ -77,14 +77,26 @@ namespace Const{
const QString FIELD_RX = "\\$D\\s*\\{\\s*([^{}]*)\\s*\\}";
const QString VARIABLE_RX = "\\$V\\s*\\{\\s*([^{}]*)\\s*\\}";
const QString SCRIPT_RX = "\\$S\\s*\\{(.*)\\}";
const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)";
const int DATASOURCE_INDEX = 6;
const int VALUE_INDEX = 2;
//const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)";
//const int DATASOURCE_INDEX = 6;
//const int VALUE_INDEX = 2;
//const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:((?:(?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"?\\$S\\s*\\{\\s*)|(?:\\\"))((?:\\w+\\.?\\w+)|(?:\\w+))(?:(?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,)|(?:))\\s*\\\"(\\w+)\\\"\\s*\\)";
const QString GROUP_FUNCTION_PARAM_RX = "\\((?:(.+),|(?:))(?:\\\"(\\w+)\\\")\\)";
const int DATASOURCE_INDEX = 3;//4;
const int VALUE_INDEX = 2; //2;
const int EXPRESSION_ARGUMENT_INDEX = 1;//3;
const QString GROUP_FUNCTION_RX = "(%1\\s*"+GROUP_FUNCTION_PARAM_RX+")";
const QString GROUP_FUNCTION_NAME_RX = "%1\\s*\\((.*[^\\)])\\)";
const int SCENE_MARGIN = 50;
}
QString extractClassName(QString className);
QString escapeSimbols(const QString& value);
QString replaceHTMLSymbols(const QString &value);
enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols};
enum RenderPass {FirstPass, SecondPass};
enum ArrangeType {AsNeeded, Force};
enum PreviewHint{ShowAllPreviewBars = 0,
@ -93,6 +105,7 @@ namespace Const{
HidePreviewStatusBar = 4,
HideAllPreviewBar = 7,
PreviewBarsUserSetting = 8};
Q_DECLARE_FLAGS(PreviewHints, PreviewHint)
Q_FLAGS(PreviewHints)

View File

@ -60,6 +60,10 @@ private:
class DataSourceManager;
class ReportEnginePrivate;
class PageDesignIntf;
class PageItemDesignIntf;
typedef QList< QSharedPointer<PageItemDesignIntf> > ReportPages;
class LIMEREPORT_EXPORT ReportEngine : public QObject{
Q_OBJECT
@ -69,7 +73,9 @@ public:
explicit ReportEngine(QObject *parent = 0);
~ReportEngine();
bool printReport(QPrinter *printer=0);
bool printPages(ReportPages pages, QPrinter *printer, PrintRange printRange = PrintRange());
void printToFile(const QString& fileName);
PageDesignIntf *createPreviewScene(QObject *parent = 0);
bool printToPDF(const QString& fileName);
void previewReport(PreviewHints hints = PreviewBarsUserSetting);
void designReport();
@ -92,7 +98,10 @@ public:
PreviewReportWidget *createPreviewWidget(QWidget *parent = 0);
void setPreviewWindowTitle(const QString& title);
void setPreviewWindowIcon(const QIcon& icon);
void setResultEditable(bool value);
bool resultIsEditable();
bool isBusy();
void setPassPharse(QString& passPharse);
signals:
void renderStarted();
void renderFinished();

5
limereport.pri Normal file
View File

@ -0,0 +1,5 @@
CONFIG += zint
include(./limereport/limereport.pri)
contains(CONFIG, zint){
include(./qzint.pri)
}

1
limereport/LRCallbackDS Normal file
View File

@ -0,0 +1 @@
#include "lrcallbackdatasourceintf.h"

1
limereport/LRDataManager Normal file
View File

@ -0,0 +1 @@
#include "lrdatasourcemanagerintf.h"

View File

@ -0,0 +1 @@
#include "lrscriptenginemanagerintf.h"

1
limereport/LimeReport Normal file
View File

@ -0,0 +1 @@
#include "lrreportengine.h"

View File

@ -31,7 +31,6 @@
#include "lrglobal.h"
#include "lrdatasourcemanager.h"
const QString xmlTagHeader = QLatin1String("GroupHeader");
const QString xmlTagFooter = QLatin1String("GroupFooter");
@ -98,6 +97,8 @@ void GroupBandHeader::startGroup(DataSourceManager* dataManager)
if (ds && ds->columnIndexByName(m_groupFiledName)!=-1)
m_groupFieldValue=ds->data(m_groupFiledName);
}
if (!m_condition.isEmpty()) m_conditionValue = calcCondition(dataManager);
}
QColor GroupBandHeader::bandColor() const
@ -114,20 +115,47 @@ QString GroupBandHeader::findDataSourceName(BandDesignIntf* parentBand){
}
QString GroupBandHeader::condition() const
{
return m_condition;
}
void GroupBandHeader::setCondition(const QString &condition)
{
m_condition = condition;
}
QString GroupBandHeader::calcCondition(DataSourceManager* dataManager){
QString result = m_condition;
if (!m_condition.isEmpty()){
result=expandUserVariables(result, FirstPass, NoEscapeSymbols, dataManager);
result=expandScripts(result, dataManager);
result=expandDataFields(result, NoEscapeSymbols, dataManager);
}
return result;
}
bool GroupBandHeader::isNeedToClose(DataSourceManager* dataManager)
{
if (!m_groupStarted) return false;
if (m_groupFiledName.isNull() || m_groupFiledName.isEmpty())
if ((m_groupFiledName.isNull() || m_groupFiledName.isEmpty()) && condition().isEmpty()){
dataManager->putError(tr("Group field not found"));
QString datasourceName = findDataSourceName(parentBand());
if (dataManager->containsDatasource(datasourceName)){
IDataSource* ds = dataManager->dataSource(datasourceName);
if (ds){
if (ds->data(m_groupFiledName).isNull() && m_groupFieldValue.isNull()) return false;
return ds->data(m_groupFiledName)!=m_groupFieldValue;
}
return false;
}
if (!m_condition.isEmpty()){
return m_conditionValue != calcCondition(dataManager);
} else {
dataManager->putError(tr("Datasource \"%1\" not found !!!").arg(datasourceName));
QString datasourceName = findDataSourceName(parentBand());
if (dataManager->containsDatasource(datasourceName)){
IDataSource* ds = dataManager->dataSource(datasourceName);
if (ds){
if (ds->data(m_groupFiledName).isNull() && m_groupFieldValue.isNull()) return false;
return ds->data(m_groupFiledName)!=m_groupFieldValue;
}
} else {
dataManager->putError(tr("Datasource \"%1\" not found !!!").arg(datasourceName));
}
}
return false;
@ -141,6 +169,7 @@ bool GroupBandHeader::isStarted()
void GroupBandHeader::closeGroup()
{
m_groupFieldValue=QVariant();
m_conditionValue="";
m_groupStarted=false;
}

View File

@ -43,6 +43,7 @@ class GroupBandHeader : public BandDesignIntf, public IGroupBand{
Q_PROPERTY(bool startNewPage READ startNewPage WRITE setStartNewPage)
Q_PROPERTY(bool resetPageNumber READ resetPageNumber WRITE setResetPageNumber)
Q_PROPERTY(bool reprintOnEachPage READ reprintOnEachPage WRITE setReprintOnEachPage)
Q_PROPERTY(QString condition READ condition WRITE setCondition)
public:
GroupBandHeader(QObject* owner = 0, QGraphicsItem* parent=0);
virtual bool isUnique() const;
@ -57,6 +58,8 @@ public:
void setResetPageNumber(bool resetPageNumber);
bool isHeader() const{return true;}
bool isGroupHeader() const {return true;}
QString condition() const;
void setCondition(const QString &condition);
private:
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
void startGroup(DataSourceManager* dataManager);
@ -65,12 +68,15 @@ private:
void closeGroup();
int index();
QString findDataSourceName(BandDesignIntf *parentBand);
QString calcCondition(DataSourceManager *dataManager);
private:
QVariant m_groupFieldValue;
QString m_groupFiledName;
bool m_groupStarted;
//bool m_startNewPage;
bool m_resetPageNumber;
QString m_condition;
QString m_conditionValue;
};
class GroupBandFooter : public BandDesignIntf{

View File

@ -41,7 +41,7 @@ namespace LimeReport{
ConnectionDialog::ConnectionDialog(LimeReport::IConnectionController *conControl, LimeReport::ConnectionDesc* connectionDesc, QWidget *parent) :
QDialog(parent),
ui(new Ui::ConnectionDialog),m_connection(connectionDesc),m_controller(conControl)
ui(new Ui::ConnectionDialog), m_connection(connectionDesc), m_controller(conControl), m_savedConnectionName("")
{
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose,true);
@ -56,6 +56,7 @@ ConnectionDialog::~ConnectionDialog()
void ConnectionDialog::init()
{
ui->cbbDrivers->addItems(QSqlDatabase::drivers());
ui->cbbUseDefaultConnection->setEnabled(!m_controller->containsDefaultConnection());
}
void ConnectionDialog::showEvent(QShowEvent *)
@ -101,33 +102,27 @@ void ConnectionDialog::checkFieldsFill()
bool ConnectionDialog::checkConnection()
{
QScopedPointer<LimeReport::ConnectionDesc> con(uiToConnection());
// LimeReport::ConnectionDesc con;
// con.setName(ui->leConnectionName->text()+"_check");
// con.setHost(ui->leServerName->text());
// con.setUserName(ui->leUserName->text());
// con.setPassword(ui->lePassword->text());
// con.setDatabaseName(ui->leDataBase->text());
// con.setDriver(ui->cbbDrivers->currentText());
if (!m_controller->checkConnectionDesc(con.data())){
throw LimeReport::ReportError(m_controller->lastError());
}
return true;
}
LimeReport::ConnectionDesc *ConnectionDialog::uiToConnection(LimeReport::ConnectionDesc* conDesc)
ConnectionDesc *ConnectionDialog::uiToConnection(LimeReport::ConnectionDesc* conDesc)
{
LimeReport::ConnectionDesc* result;
if (conDesc)
result = conDesc;
else
result = new LimeReport::ConnectionDesc();
result ->setName(ui->leConnectionName->text());
result ->setName(ConnectionDesc::connectionNameForReport(ui->leConnectionName->text()));
result ->setHost(ui->leServerName->text());
result ->setDriver(ui->cbbDrivers->currentText());
result ->setUserName(ui->leUserName->text());
result ->setPassword(ui->lePassword->text());
result ->setDatabaseName(ui->leDataBase->text());
result ->setAutoconnect(ui->cbAutoConnect->isChecked());
result->setKeepDBCredentials(!ui->cbbKeepCredentials->isChecked());
return result ;
}
@ -135,19 +130,37 @@ void ConnectionDialog::connectionToUI()
{
init();
if (!m_connection) return;
ui->leConnectionName->setText(m_connection->name());
ui->leConnectionName->setText(ConnectionDesc::connectionNameForUser(m_connection->name()));
ui->cbbUseDefaultConnection->setChecked(m_connection->name().compare(QSqlDatabase::defaultConnection) == 0);
ui->leDataBase->setText(m_connection->databaseName());
ui->leServerName->setText(m_connection->host());
ui->leUserName->setText(m_connection->userName());
ui->lePassword->setText(m_connection->password());
ui->cbbDrivers->setCurrentIndex(ui->cbbDrivers->findText(m_connection->driver()));
ui->cbAutoConnect->setChecked(m_connection->autoconnect());
ui->cbbKeepCredentials->setChecked(!m_connection->keepDBCredentials());
}
void ConnectionDialog::on_toolButton_clicked()
{
ui->leDataBase->setText(QFileDialog::getOpenFileName());
}
void ConnectionDialog::on_cbbUseDefaultConnection_toggled(bool checked)
{
if (checked){
m_savedConnectionName = ui->leConnectionName->text();
ui->leConnectionName->setText(tr("defaultConnection"));
ui->leConnectionName->setEnabled(false);
} else {
ui->leConnectionName->setText(m_savedConnectionName);
ui->leConnectionName->setEnabled(true);
}
}
} // namespace LimeReport

View File

@ -50,7 +50,7 @@ protected:
void init();
void checkFieldsFill();
bool checkConnection();
LimeReport::ConnectionDesc* uiToConnection(LimeReport::ConnectionDesc *conDesc = 0);
ConnectionDesc* uiToConnection(LimeReport::ConnectionDesc *conDesc = 0);
void connectionToUI();
signals:
void conectionRegistred(LimeReport::ConnectionDesc* connectionDesc);
@ -58,11 +58,14 @@ private slots:
void slotAccept();
void slotCheckConnection();
void on_toolButton_clicked();
void on_cbbUseDefaultConnection_toggled(bool checked);
private:
Ui::ConnectionDialog *ui;
LimeReport::ConnectionDesc* m_connection;
ConnectionDesc* m_connection;
bool m_changeMode;
LimeReport::IConnectionController* m_controller;
IConnectionController* m_controller;
QString m_savedConnectionName;
};
} // namespace LimeReport

View File

@ -36,6 +36,13 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="cbbUseDefaultConnection">
<property name="text">
<string>Use default application connection</string>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
@ -130,6 +137,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbbKeepCredentials">
<property name="text">
<string>Dont keep credentals in lrxml</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">

View File

@ -126,17 +126,17 @@ void DataBrowser::slotSQLEditingFinished(SQLEditResult result)
void DataBrowser::slotDeleteConnection()
{
if (!getConnectionName().isEmpty()){
if (!getConnectionName(NameForUser).isEmpty()){
if (
QMessageBox::critical(
this,
tr("Attention"),
tr("Do you really want to delete \"%1\" connection ?").arg(getConnectionName()),
tr("Do you really want to delete \"%1\" connection ?").arg(getConnectionName(NameForUser)),
QMessageBox::Ok|QMessageBox::No,
QMessageBox::No
)==QMessageBox::Ok
) == QMessageBox::Ok
){
m_report->dataManager()->removeConnection(getConnectionName());
m_report->dataManager()->removeConnection(getConnectionName(NameForReport));
updateDataTree();
}
}
@ -153,7 +153,7 @@ void DataBrowser::slotAddDataSource()
#endif
sqlEdit->setSettings(settings());
sqlEdit->setDataSources(m_report->dataManager());
sqlEdit->setDefaultConnection(getConnectionName());
sqlEdit->setDefaultConnection(getConnectionName(NameForReport));
connect(sqlEdit,SIGNAL(signalSqlEditingFinished(SQLEditResult)),this,SLOT(slotSQLEditingFinished(SQLEditResult)));
sqlEdit->exec();
}
@ -173,7 +173,10 @@ void DataBrowser::updateDataTree()
foreach(QString dataSourceName, m_report->datasourcesNames()){
QTreeWidgetItem *item=new QTreeWidgetItem(QStringList(dataSourceName),DataBrowserTree::Table);
QTreeWidgetItem *parentItem = findByNameAndType(m_report->dataManager()->connectionName(dataSourceName),DataBrowserTree::Connection);
QTreeWidgetItem *parentItem = findByNameAndType(
ConnectionDesc::connectionNameForUser(m_report->dataManager()->connectionName(dataSourceName)),
DataBrowserTree::Connection
);
if (parentItem){
parentItem->addChild(item);
if (!parentItem->isExpanded()) ui->dataTree->expandItem(parentItem);
@ -336,11 +339,18 @@ QTreeWidgetItem* findConnectionItem(QTreeWidgetItem* item){
}
}
QString DataBrowser::getConnectionName()
QString DataBrowser::getConnectionName(NameType nameType)
{
if (ui->dataTree->currentItem()){
QTreeWidgetItem * ci = findConnectionItem(ui->dataTree->currentItem());
if (ci) return ci->text(0);
if (ci) {
switch (nameType) {
case NameForUser:
return ConnectionDesc::connectionNameForUser(ci->text(0));
case NameForReport:
return ConnectionDesc::connectionNameForReport(ci->text(0));
}
}
else return QString();
};
return QString();
@ -416,14 +426,58 @@ void DataBrowser::initConnections()
{
ui->dataTree->clear();
QList<QTreeWidgetItem *>items;
foreach(QString connectionName,m_report->dataManager()->connectionNames()){
QTreeWidgetItem *item=new QTreeWidgetItem(ui->dataTree,QStringList(connectionName), DataBrowserTree::Connection);
if (m_report->dataManager()->isConnectionConnected(connectionName))
QStringList connections = QSqlDatabase::connectionNames();
foreach(QString connectionName, m_report->dataManager()->connectionNames()){
if (!connections.contains(connectionName,Qt::CaseInsensitive)){
connections.append(connectionName);
}
}
qSort(connections);
foreach (QString connectionName, connections) {
QTreeWidgetItem *item=new QTreeWidgetItem(
ui->dataTree,
QStringList(ConnectionDesc::connectionNameForUser(connectionName)),
DataBrowserTree::Connection
);
if (!m_report->dataManager()->connectionNames().contains(ConnectionDesc::connectionNameForReport(connectionName), Qt::CaseInsensitive))
{
item->setIcon(0,QIcon(":/databrowser/images/database_connected"));
else
item->setIcon(0,QIcon(":/databrowser/images/database_disconnected"));
} else {
if (m_report->dataManager()->isConnectionConnected(connectionName))
item->setIcon(0,QIcon(":/databrowser/images/database_connected"));
else
item->setIcon(0,QIcon(":/databrowser/images/database_disconnected"));
}
items.append(item);
}
// foreach (QString connectionName, connections) {
// QTreeWidgetItem *item=new QTreeWidgetItem(
// ui->dataTree,
// QStringList(ConnectionDesc::connectionNameForUser(connectionName)),
// DataBrowserTree::Connection
// );
// item->setIcon(0,QIcon(":/databrowser/images/database_connected"));
// }
// connections = m_report->dataManager()->connectionNames();
// qSort(connections);
// foreach(QString connectionName,connectionName){
// if (!QSqlDatabase::contains(connectionName)){
// QTreeWidgetItem *item=new QTreeWidgetItem(
// ui->dataTree,
// QStringList(ConnectionDesc::connectionNameForUser(connectionName)),
// DataBrowserTree::Connection
// );
// if (m_report->dataManager()->isConnectionConnected(connectionName))
// item->setIcon(0,QIcon(":/databrowser/images/database_connected"));
// else
// item->setIcon(0,QIcon(":/databrowser/images/database_disconnected"));
// items.append(item);
// }
// }
ui->dataTree->insertTopLevelItems(0,items);
}
@ -482,10 +536,10 @@ void DataBrowser::slotDataWindowClosed()
void DataBrowser::slotChangeConnection()
{
if (!getConnectionName().isEmpty()){
if (!getConnectionName(NameForUser).isEmpty()){
ConnectionDialog *connectionEdit = new ConnectionDialog(
this,
m_report->dataManager()->connectionByName(getConnectionName()),
m_report->dataManager()->connectionByName(getConnectionName(NameForReport)),
this
);
connectionEdit->setAttribute(Qt::WA_DeleteOnClose,true);
@ -501,7 +555,7 @@ void DataBrowser::slotChangeConnection()
void DataBrowser::slotChangeConnectionState()
{
QString connectionName = getConnectionName();
QString connectionName = getConnectionName(NameForReport);
if (!connectionName.isEmpty()){
if (!m_report->dataManager()->isConnectionConnected(connectionName)){
setCursor(Qt::WaitCursor);
@ -626,6 +680,13 @@ bool DataBrowser::checkConnectionDesc(ConnectionDesc *connection)
return result;
}
bool DataBrowser::containsDefaultConnection()
{
bool result = m_report->dataManager()->connectionByName(QSqlDatabase::defaultConnection) ||
QSqlDatabase::contains(QSqlDatabase::defaultConnection);
return result;
}
QString DataBrowser::lastError() const
{
return m_lastError;
@ -640,7 +701,7 @@ void DataBrowser::on_dataTree_currentItemChanged(QTreeWidgetItem *current, QTree
{
Q_UNUSED(previous)
if (current&&(current->type() == DataBrowserTree::Connection)) {
ui->pbConnect->setEnabled(true);
bool internalConnection = m_report->dataManager()->connectionByName(ConnectionDesc::connectionNameForReport(current->text(0)));
if (m_report->dataManager()->isConnectionConnected(current->text(0))){
ui->pbConnect->setIcon(QIcon(":/databrowser/images/plug-connect.png"));
} else {
@ -648,9 +709,10 @@ void DataBrowser::on_dataTree_currentItemChanged(QTreeWidgetItem *current, QTree
}
ui->editDataSource->setEnabled(false);
ui->deleteDataSource->setEnabled(false);
ui->viewDataSource->setEnabled(false);
ui->changeConnection->setEnabled(true);
ui->deleteConection->setEnabled(true);
ui->viewDataSource->setEnabled(false);
ui->pbConnect->setEnabled(internalConnection);
ui->changeConnection->setEnabled(internalConnection);
ui->deleteConection->setEnabled(internalConnection);
ui->errorMessage->setDisabled(true);
} else {
ui->changeConnection->setEnabled(false);
@ -779,13 +841,3 @@ void DataBrowser::on_variablesTree_itemDoubleClicked(QTreeWidgetItem *item, int
}
} // namespace LimeReport

View File

@ -87,8 +87,9 @@ private slots:
void on_variablesTree_itemDoubleClicked(QTreeWidgetItem *item, int);
private:
enum NameType{NameForUser, NameForReport};
QString getDatasourceName();
QString getConnectionName();
QString getConnectionName(NameType nameType);
QString getVariable();
bool isClosingWindows() const {return m_closingWindows;}
QTreeWidgetItem * findByNameAndType(QString name, int itemType);
@ -108,6 +109,7 @@ private:
void addConnectionDesc(ConnectionDesc *connection);
void changeConnectionDesc(ConnectionDesc *connection);
bool checkConnectionDesc(ConnectionDesc *connection);
bool containsDefaultConnection();
private:
Ui::DataBrowser* ui;

View File

@ -101,7 +101,7 @@ void SQLEditDialog::accept()
else result.resultMode=SQLEditResult::SubProxy;
}
result.connectionName=ui->cbbConnection->currentText();
result.connectionName = ConnectionDesc::connectionNameForReport(ui->cbbConnection->currentText());
result.datasourceName=ui->leDatasourceName->text();
result.sql=ui->textEditSQL->toPlainText();
result.dialogMode=m_dialogMode;
@ -159,15 +159,19 @@ void SQLEditDialog::check()
void SQLEditDialog::initConnections()
{
foreach(QString connectionName, QSqlDatabase::connectionNames()){
ui->cbbConnection->addItem(QIcon(":/databrowser/images/plug-connect.png"),connectionName);
ui->cbbConnection->addItem(QIcon(":/databrowser/images/plug-connect.png"),ConnectionDesc::connectionNameForUser(connectionName));
}
foreach(QString connectionName, m_datasources->connectionNames()){
connectionName = (connectionName.compare(QSqlDatabase::defaultConnection)==0) ?
tr("defaultConnection") : connectionName;
if (ui->cbbConnection->findText(connectionName,Qt::MatchExactly )==-1)
ui->cbbConnection->addItem(QIcon(":/databrowser/images/plug-disconnect.png"),connectionName);
ui->cbbConnection->addItem(QIcon(":/databrowser/images/plug-disconnect.png"),ConnectionDesc::connectionNameForUser(connectionName));
}
ui->cbbConnection->setCurrentIndex(ui->cbbConnection->findText(m_defaultConnection));
if (!m_oldDatasourceName.isEmpty()){
ui->cbbConnection->setCurrentIndex(ui->cbbConnection->findText(m_datasources->connectionName(m_oldDatasourceName)));
ui->cbbConnection->setCurrentIndex(ui->cbbConnection->findText(ConnectionDesc::connectionNameForUser(m_datasources->connectionName(m_oldDatasourceName))));
}
}
@ -202,7 +206,7 @@ void SQLEditDialog::setDataSources(LimeReport::DataSourceManager *dataSources, Q
void SQLEditDialog::setDefaultConnection(QString defaultConnection)
{
m_defaultConnection=defaultConnection;
m_defaultConnection = ConnectionDesc::connectionNameForUser(defaultConnection);
}
void SQLEditDialog::slotDataSourceNameEditing()
@ -298,7 +302,11 @@ void SQLEditDialog::slotPreviewData()
QMessageBox::critical(this,tr("Attention"),tr("Connection is not specified"));
return;
}
m_previewModel = m_datasources->previewSQL(ui->cbbConnection->currentText(),ui->textEditSQL->toPlainText(),ui->leMaster->text());
m_previewModel = m_datasources->previewSQL(
ConnectionDesc::connectionNameForReport(ui->cbbConnection->currentText()),
ui->textEditSQL->toPlainText(),
ui->leMaster->text()
);
if (m_previewModel){
ui->tvPreview->setModel(m_previewModel.data());
ui->gbDataPreview->setVisible(true);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 B

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -41,6 +41,16 @@ FontEditorWidget::FontEditorWidget(ReportDesignWidget *reportEditor, QWidget *pa
initEditor();
}
FontEditorWidget::FontEditorWidget(PageDesignIntf *page, const QString &title, QWidget *parent)
:ItemEditorWidget(page,title,parent), m_ignoreSlots(false) {
initEditor();
}
FontEditorWidget::FontEditorWidget(LimeReport::PageDesignIntf *page, QWidget *parent)
:ItemEditorWidget(page,parent), m_ignoreSlots(false){
initEditor();
}
void FontEditorWidget::setItemEvent(BaseDesignIntf* item)
{
@ -112,26 +122,31 @@ void FontEditorWidget::updateValues(const QFont& font)
void FontEditorWidget::slotFontChanged(const QFont &font)
{
if (reportEditor() && !m_ignoreSlots) reportEditor()->setFont(font);
if (page()) page()->setFont(font);
}
void FontEditorWidget::slotFontSizeChanged(const QString &value)
{
if (reportEditor() && !m_ignoreSlots){
QFont resFont(m_fontNameEditor->currentFont());
resFont.setPointSize(value.toInt());
reportEditor()->setFont(resFont);
}
if (m_ignoreSlots) return;
QFont resFont(fontNameEditor()->currentFont());
resFont.setPointSize(value.toInt());
if (reportEditor()) reportEditor()->setFont(resFont);
if (page()) page()->setFont(resFont);
}
void FontEditorWidget::slotFontAttribsChanged(bool)
{
if (reportEditor()&& !m_ignoreSlots){
QFont resFont(m_fontNameEditor->currentFont());
resFont.setBold(m_fontBold->isChecked());
resFont.setItalic(m_fontItalic->isChecked());
resFont.setUnderline(m_fontUnderline->isChecked());
reportEditor()->setFont(resFont);
}
if (m_ignoreSlots) return;
QFont resFont(m_fontNameEditor->currentFont());
resFont.setBold(m_fontBold->isChecked());
resFont.setItalic(m_fontItalic->isChecked());
resFont.setUnderline(m_fontUnderline->isChecked());
if (reportEditor()) reportEditor()->setFont(resFont);
if (page()) page()->setFont(resFont);
}
void FontEditorWidget::slotPropertyChanged(const QString &objectName, const QString &property, const QVariant& oldValue, const QVariant& newValue)

View File

@ -45,8 +45,11 @@ class FontEditorWidget :public ItemEditorWidget{
public:
explicit FontEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0);
explicit FontEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0);
explicit FontEditorWidget(PageDesignIntf* page, const QString &title, QWidget *parent = 0);
explicit FontEditorWidget(PageDesignIntf* page, QWidget *parent = 0);
protected:
void setItemEvent(BaseDesignIntf *item);
QFontComboBox* fontNameEditor(){return m_fontNameEditor;}
private slots:
void slotFontChanged(const QFont& font);
void slotFontSizeChanged(const QString& value);

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 B

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

View File

@ -14,7 +14,7 @@
<file>images/imageItem2.png</file>
<file>images/settings.png</file>
<file>images/settings2.png</file>
<file alias="HorizontalLayout">images/hlayuot_3_24.png</file>
<file>images/hlayuot_3_24.png</file>
<file alias="Band">images/addBand1.png</file>
<file>images/DataBand.png</file>
<file>images/PageHeader.png</file>
@ -34,8 +34,12 @@
<file alias="GroupBandHeader">images/GroupHeader16.png</file>
<file alias="PageItemDesignIntf">images/ReportPage16.png</file>
<file alias="TextItem">images/insert-text_6.png</file>
<file alias="BarcodeItem">images/barcode3.png</file>
<file alias="ShapeItem">images/shape6.png</file>
<file alias="ImageItem">images/imageItem3.png</file>
<file>images/barcode3.png</file>
<file>images/shape6.png</file>
<file>images/imageItem3.png</file>
<file>images/barcode4.png</file>
<file alias="ImageItem">images/imageItem4.png</file>
<file alias="ShapeItem">images/shapes7.png</file>
<file alias="BarcodeItem">images/barcode5.png</file>
</qresource>
</RCC>

View File

@ -56,16 +56,21 @@ BaseDesignIntf *ImageItem::createSameTypeItem(QObject *owner, QGraphicsItem *par
void ImageItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight)
{
if (!m_datasource.isEmpty() && !m_field.isEmpty() && m_picture.isNull()){
IDataSource* ds = dataManager->dataSource(m_datasource);
if (ds) {
QVariant data = ds->data(m_field);
if (data.isValid()){
if (data.type()==QVariant::Image){
m_picture = data.value<QImage>();
} else
m_picture.loadFromData(data.toByteArray());
}
if (m_picture.isNull()){
if (!m_datasource.isEmpty() && !m_field.isEmpty()){
IDataSource* ds = dataManager->dataSource(m_datasource);
if (ds) {
QVariant data = ds->data(m_field);
if (data.isValid()){
if (data.type()==QVariant::Image){
m_picture = data.value<QImage>();
} else
m_picture.loadFromData(data.toByteArray());
}
}
} else if (!m_resourcePath.isEmpty()){
m_picture = QImage(m_resourcePath);
}
}
if (m_autoSize){
@ -80,6 +85,11 @@ bool ImageItem::isNeedUpdateSize(RenderPass) const
return m_picture.isNull() || m_autoSize;
}
QString ImageItem::resourcePath() const
{
return m_resourcePath;
}
qreal ImageItem::minHeight() const{
if (!m_picture.isNull() && autoSize())
{
@ -231,6 +241,7 @@ void ImageItem::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option
if (img.isNull() && itemMode()==DesignMode){
QString text;
ppainter->setFont(transformToSceneFont(QFont("Arial",10)));
ppainter->setPen(Qt::black);
if (!datasource().isEmpty() && !field().isEmpty())
text = datasource()+"."+field();
else text = tr("Image");

View File

@ -44,12 +44,14 @@ class ImageItem : public LimeReport::ItemDesignIntf
Q_PROPERTY(bool scale READ scale WRITE setScale)
Q_PROPERTY(bool keepAspectRatio READ keepAspectRatio WRITE setKeepAspectRatio)
Q_PROPERTY(bool center READ center WRITE setCenter)
Q_PROPERTY(QString resourcePath READ resourcePath WRITE setResourcePath)
public:
ImageItem(QObject *owner, QGraphicsItem *parent);
virtual void paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void setImage(QImage value);
QImage image(){return m_picture;}
void setContent(const QString &value){m_content=value;}
void setResourcePath(const QString &value){m_resourcePath=value;}
QString resourcePath() const;
QString datasource() const;
void setDatasource(const QString &datasource);
QString field() const;
@ -72,8 +74,8 @@ protected:
bool isNeedUpdateSize(RenderPass) const;
bool drawDesignBorders() const {return m_picture.isNull();}
private:
QImage m_picture;
QString m_content;
QImage m_picture;
QString m_resourcePath;
QString m_datasource;
QString m_field;
bool m_autoSize;

View File

@ -60,8 +60,24 @@ ShapeItem::ShapeItem(QObject *owner, QGraphicsItem *parent)
{
}
Qt::PenStyle ShapeItem::penStyle() const
{
return m_penStyle;
}
void ShapeItem::setPenStyle(const Qt::PenStyle &value)
{
if ((value!=m_penStyle)){
Qt::PenStyle oldValue = m_penStyle;
m_penStyle=value;
update();
notify("penStyle",(int)oldValue,(int)value);
}
}
void ShapeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
painter->save();
QPen pen(m_shapeColor);
@ -69,7 +85,7 @@ void ShapeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
pen.setStyle(m_penStyle);
painter->setPen(pen);
QBrush brush(m_shapeBrushColor,m_shapeBrushType);
brush.setTransform(painter->worldTransform().inverted());
painter->setBrush(brush);
painter->setBackground(QBrush(Qt::NoBrush));
painter->setOpacity(qreal(m_opacity)/100);
@ -150,21 +166,6 @@ void ShapeItem::setLineWidth(qreal value)
}
}
Qt::PenStyle ShapeItem::penStyle() const
{
return m_penStyle;
}
void ShapeItem::setPenStyle(const Qt::PenStyle &value)
{
if (m_penStyle!=value){
Qt::PenStyle oldValue = m_penStyle;
m_penStyle = value;
update();
notify("penStyle",(int)oldValue,(int)value);
}
}
BaseDesignIntf *ShapeItem::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
{
return new ShapeItem(owner,parent);

View File

@ -31,6 +31,7 @@
#include <QTextLayout>
#include <QtScript/QScriptEngine>
#include <QLocale>
#include <QMessageBox>
#include <math.h>
#include "lrpagedesignintf.h"
@ -41,6 +42,7 @@
#include "lrsimpletagparser.h"
#include "lrtextitemeditor.h"
#include "lrreportengine_p.h"
#include <QMenu>
namespace{
@ -57,7 +59,7 @@ namespace LimeReport{
TextItem::TextItem(QObject *owner, QGraphicsItem *parent)
: ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false),
m_allowHTMLInFields(false)
m_allowHTMLInFields(false), m_followTo(""), m_follower(0), m_textIndent(0), m_textLayoutDirection(Qt::LayoutDirectionAuto)
{
PageItemDesignIntf* pageItem = dynamic_cast<PageItemDesignIntf*>(parent);
BaseDesignIntf* parentItem = dynamic_cast<BaseDesignIntf*>(parent);
@ -73,27 +75,70 @@ TextItem::TextItem(QObject *owner, QGraphicsItem *parent)
Init();
}
TextItem::~TextItem()
TextItem::~TextItem(){}
int TextItem::fakeMarginSize() const{
return marginSize()+5;
}
void TextItem::preparePopUpMenu(QMenu &menu)
{
QAction* editAction = menu.addAction(QIcon(":/report/images/edit_pecil2.png"),tr("Edit"));
menu.insertAction(menu.actions().at(0),editAction);
menu.insertSeparator(menu.actions().at(1));
menu.addSeparator();
QAction* action = menu.addAction(tr("Auto height"));
action->setCheckable(true);
action->setChecked(autoHeight());
action = menu.addAction(tr("Allow HTML"));
action->setCheckable(true);
action->setChecked(allowHTML());
action = menu.addAction(tr("Allow HTML in fields"));
action->setCheckable(true);
action->setChecked(allowHTMLInFields());
action = menu.addAction(tr("Stretch to max height"));
action->setCheckable(true);
action->setChecked(stretchToMaxHeight());
}
int TextItem::fakeMarginSize(){
return marginSize()+5;
void TextItem::processPopUpAction(QAction *action)
{
if (action->text().compare(tr("Edit")) == 0){
this->showEditorDialog();
}
if (action->text().compare(tr("Auto height")) == 0){
setProperty("autoHeight",action->isChecked());
}
if (action->text().compare(tr("Allow HTML")) == 0){
setProperty("allowHTML",action->isChecked());
}
if (action->text().compare(tr("Allow HTML in fields")) == 0){
setProperty("allowHTMLInFields",action->isChecked());
}
if (action->text().compare(tr("Stretch to max height")) == 0){
setProperty("stretchToMaxHeight",action->isChecked());
}
}
void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, QWidget* widget) {
Q_UNUSED(widget);
Q_UNUSED(style);
TextPtr text = textDocument();
painter->save();
setupPainter(painter);
prepareRect(painter,style,widget);
QSizeF tmpSize = rect().size()-m_textSize;
TextPtr text = textDocument();
QSizeF tmpSize = rect().size()-text->size();
if (!painter->clipRegion().isEmpty()){
QRegion clipReg=painter->clipRegion().xored(painter->clipRegion().subtracted(rect().toRect()));
@ -102,7 +147,7 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q
painter->setClipRect(rect());
}
qreal hOffset = 0, vOffset=0;
qreal hOffset = 0, vOffset = 0;
switch (m_angle){
case Angle0:
hOffset = fakeMarginSize();
@ -127,12 +172,12 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q
painter->rotate(90);
break;
case Angle180:
hOffset = width()-fakeMarginSize();
vOffset = height()-fakeMarginSize();
if ((tmpSize.width() > 0) && (m_alignment & Qt::AlignVCenter)){
vOffset = tmpSize.height() / 2 + text->size().height();
hOffset = width() - fakeMarginSize();
vOffset = height() - fakeMarginSize();
if ((tmpSize.width()>0) && (m_alignment & Qt::AlignVCenter)){
vOffset = tmpSize.height() / 2+ text->size().height();
}
if ((tmpSize.height() > 0) && (m_alignment & Qt::AlignBottom)){
if ((tmpSize.height()>0) && (m_alignment & Qt::AlignBottom)){
vOffset = (text->size().height());
}
painter->translate(hOffset,vOffset);
@ -140,9 +185,9 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q
break;
case Angle270:
hOffset = fakeMarginSize();
vOffset = height() - fakeMarginSize();
vOffset = height()-fakeMarginSize();
if (m_alignment & Qt::AlignVCenter){
hOffset = (width() - text->size().height()) / 2;
hOffset = (width() - text->size().height())/2;
}
if (m_alignment & Qt::AlignBottom){
@ -152,23 +197,51 @@ void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, Q
painter->rotate(270);
break;
case Angle45:
painter->translate(width() / 2,0);
painter->translate(width()/2,0);
painter->rotate(45);
text->setTextWidth(sqrt( 2 * (pow(width() / 2, 2))));
text->setTextWidth(sqrt(2*(pow(width()/2,2))));
break;
case Angle315:
painter->translate(0,height() / 2);
painter->translate(0,height()/2);
painter->rotate(315);
text->setTextWidth(sqrt( 2 * (pow(height() / 2, 2))));
text->setTextWidth(sqrt(2*(pow(height()/2,2))));
break;
}
painter->setOpacity(qreal(foregroundOpacity())/100);
int lineHeight = painter->fontMetrics().height();
qreal curpos = 0;
if (m_underlines){
QPen pen = painter->pen();
pen.setWidth(m_underlineLineSize);
painter->setPen(pen);
}
painter->setOpacity(qreal(foregroundOpacity())/100);
QAbstractTextDocumentLayout::PaintContext ctx;
ctx.palette.setColor(QPalette::Text, fontColor());
for(QTextBlock it = text->begin(); it != text->end(); it=it.next()){
it.blockFormat().setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight);
for (int i=0;i<it.layout()->lineCount();i++){
QTextLine line = it.layout()->lineAt(i);
if (m_underlines){
painter->drawLine(QPointF(0,line.rect().bottomLeft().y()),QPoint(rect().width(),line.rect().bottomRight().y()));
lineHeight = line.height()+m_lineSpacing;
curpos = line.rect().bottom();
}
}
}
text->documentLayout()->draw(painter,ctx);
if (m_underlines){
if (lineHeight<0) lineHeight = painter->fontMetrics().height();
for (curpos+=lineHeight; curpos<rect().height();curpos+=lineHeight){
painter->drawLine(QPointF(0,curpos),QPoint(rect().width(),curpos));
}
}
painter->restore();
BaseDesignIntf::paint(painter, style, widget);
}
@ -185,6 +258,10 @@ void TextItem::Init()
m_textSize = QSizeF();
m_firstLineSize = 0;
m_foregroundOpacity = 100;
m_underlines = false;
m_adaptFontToSize = false;
m_underlineLineSize = 1;
m_lineSpacing = 1;
m_valueType = Default;
}
@ -192,13 +269,18 @@ void TextItem::setContent(const QString &value)
{
if (m_strText.compare(value)!=0){
QString oldValue = m_strText;
m_strText=value;
if (m_trimValue)
m_strText=value.trimmed();
else
m_strText=value;
if (itemMode() == DesignMode){
initTextSizes();
}
// if (itemMode() == DesignMode && (autoHeight())){
// initTextSizes();
// }
if (!isLoading()){
if (autoHeight() || autoWidth() || hasFollower())
initTextSizes();
update(rect());
notify("content",oldValue,value);
}
@ -209,15 +291,20 @@ void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, i
{
if (isNeedExpandContent())
expandContent(dataManager, pass);
if (!isLoading())
if (!isLoading() && (autoHeight() || autoWidth() || hasFollower()) )
initTextSizes();
if (m_textSize.width()>width() && ((m_autoWidth==MaxWordLength)||(m_autoWidth==MaxStringLength))){
setWidth(m_textSize.width() + fakeMarginSize()*2);
}
if ((m_textSize.height()>height()) && (m_autoHeight) ){
setHeight(m_textSize.height()+5);
if (m_textSize.height()>height()) {
if (m_autoHeight)
setHeight(m_textSize.height()+borderLineSize()*2);
else if (hasFollower() && !content().isEmpty()){
follower()->setContent(getTextPart(0,height()));
setContent(getTextPart(height(),0));
}
}
BaseDesignIntf::updateItemSize(dataManager, pass, maxHeight);
}
@ -256,7 +343,55 @@ QString TextItem::replaceReturns(QString text)
return result;
}
void TextItem::initTextSizes()
void TextItem::setTextFont(TextPtr text, const QFont& value) const {
text->setDefaultFont(value);
if ((m_angle==Angle0)||(m_angle==Angle180)){
text->setTextWidth(rect().width()-fakeMarginSize()*2);
} else {
text->setTextWidth(rect().height()-fakeMarginSize()*2);
}
}
void TextItem::adaptFontSize(TextPtr text) const{
QFont _font = transformToSceneFont(font());
do{
setTextFont(text,_font);
if (_font.pixelSize()>2)
_font.setPixelSize(_font.pixelSize()-1);
else break;
} while(text->size().height()>this->height() || text->size().width()>(this->width()) - fakeMarginSize() * 2);
}
int TextItem::underlineLineSize() const
{
return m_underlineLineSize;
}
void TextItem::setUnderlineLineSize(int value)
{
int oldValue = m_underlineLineSize;
m_underlineLineSize = value;
update();
notify("underlineLineSize",oldValue,value);
}
int TextItem::lineSpacing() const
{
return m_lineSpacing;
}
void TextItem::setLineSpacing(int value)
{
int oldValue = m_lineSpacing;
m_lineSpacing = value;
// if (autoHeight())
// initTextSizes();
update();
notify("lineSpacing",oldValue,value);
}
void TextItem::initTextSizes() const
{
TextPtr text = textDocument();
m_textSize= text->size();
@ -325,37 +460,163 @@ QString TextItem::formatFieldValue()
}
}
TextItem::TextPtr TextItem::textDocument()
TextItem::TextPtr TextItem::textDocument() const
{
TextPtr text(new QTextDocument);
if (allowHTML())
text->setHtml(m_strText);
else
text->setPlainText(m_strText);
QTextOption to;
to.setAlignment(m_alignment);
to.setTextDirection(m_textLayoutDirection);
//to.setTextDirection(QApplication::layoutDirection());
if (m_autoWidth!=MaxStringLength)
to.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
if (m_adaptFontToSize && (!(m_autoHeight || m_autoWidth)))
to.setWrapMode(QTextOption::WordWrap);
else
to.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
else to.setWrapMode(QTextOption::NoWrap);
text->setDocumentMargin(0);
text->setDefaultTextOption(to);
text->setDefaultFont(transformToSceneFont(font()));
if (allowHTML())
text->setHtml(replaceReturns(m_strText.trimmed()));
else
text->setPlainText(m_strText);
if ((m_angle==Angle0)||(m_angle==Angle180)){
text->setTextWidth(rect().width()-fakeMarginSize()*2);
QFont _font = transformToSceneFont(font());
if (m_adaptFontToSize && (!(m_autoHeight || m_autoWidth))){
adaptFontSize(text);
} else {
text->setTextWidth(rect().height()-fakeMarginSize()*2);
setTextFont(text,_font);
}
m_textSize = text->size();
text->documentLayout();
for ( QTextBlock block = text->begin(); block.isValid(); block = block.next())
{
QTextCursor tc = QTextCursor(block);
QTextBlockFormat fmt = block.blockFormat();
fmt.setTextIndent(m_textIndent);
if(fmt.lineHeight() != m_lineSpacing) {
fmt.setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight);
tc.setBlockFormat( fmt );
}
}
return text;
}
qreal TextItem::textIndent() const
{
return m_textIndent;
}
void TextItem::setTextIndent(const qreal &textIndent)
{
if (m_textIndent != textIndent){
qreal oldValue = m_textIndent;
m_textIndent = textIndent;
update();
notify("textIndent", oldValue, textIndent);
}
}
Qt::LayoutDirection TextItem::textLayoutDirection() const
{
return m_textLayoutDirection;
}
void TextItem::setTextLayoutDirection(const Qt::LayoutDirection &textLayoutDirection)
{
if (m_textLayoutDirection != textLayoutDirection){
int oldValue = int(m_textLayoutDirection);
m_textLayoutDirection = textLayoutDirection;
update();
notify("textLayoutDirection",oldValue,int(textLayoutDirection));
}
}
QString TextItem::followTo() const
{
return m_followTo;
}
void TextItem::setFollowTo(const QString &followTo)
{
if (m_followTo != followTo){
QString oldValue = m_followTo;
m_followTo = followTo;
if (!isLoading()){
TextItem* fi = scene()->findChild<TextItem*>(oldValue);
if (fi) fi->clearFollower();
fi = scene()->findChild<TextItem*>(followTo);
if (fi && fi != this){
if (initFollower(followTo)){
notify("followTo",oldValue,followTo);
} else {
m_followTo = "";
QMessageBox::critical(
0,
tr("Error"),
tr("TextItem \" %1 \" already has folower \" %2 \" ")
.arg(fi->objectName())
.arg(fi->follower()->objectName())
);
notify("followTo",followTo,"");
}
} else if (m_followTo != ""){
QMessageBox::critical(
0,
tr("Error"),
tr("TextItem \" %1 \" not found !")
.arg(m_followTo)
);
notify("followTo",followTo,"");
}
}
}
}
void TextItem::setFollower(TextItem *follower)
{
if (!m_follower){
m_follower = follower;
}
}
void TextItem::clearFollower()
{
m_follower = 0;
}
bool TextItem::hasFollower() const
{
return m_follower != 0;
}
bool TextItem::initFollower(QString follower)
{
TextItem* fi = scene()->findChild<TextItem*>(follower);
if (fi){
if (!fi->hasFollower()){
fi->setFollower(this);
return true;
}
}
return false;
}
void TextItem::pageObjectHasBeenLoaded()
{
if (!m_followTo.isEmpty()){
initFollower(m_followTo);
}
}
TextItem::ValueType TextItem::valueType() const
{
return m_valueType;
@ -399,6 +660,13 @@ void TextItem::setAllowHTML(bool allowHTML)
{
if (m_allowHTML!=allowHTML){
m_allowHTML = allowHTML;
// if (m_text){
// if (allowHTML)
// m_text->setHtml(m_strText);
// else
// m_text->setPlainText(m_strText);
// update();
// }
update();
notify("allowHTML",!m_allowHTML,allowHTML);
}
@ -408,28 +676,28 @@ bool TextItem::trimValue() const
return m_trimValue;
}
void TextItem::setTrimValue(bool trimValue)
void TextItem::setTrimValue(bool value)
{
m_trimValue = trimValue;
bool oldValue = m_trimValue;
m_trimValue = value;
notify("trimValue",oldValue,value);
}
void TextItem::geometryChangedEvent(QRectF , QRectF)
{
// if ((m_angle==Angle0)||(m_angle==Angle180)){
// m_text->setTextWidth(rect().width()-fakeMarginSize()*2);
// } else {
// m_text->setTextWidth(rect().height()-fakeMarginSize()*2);
// }
// m_textSize=m_text->size();
if (itemMode() == DesignMode) initTextSizes();
}
{}
bool TextItem::isNeedUpdateSize(RenderPass pass) const
{
Q_UNUSED(pass)
if ((autoHeight() && autoWidth()) || hasFollower()){
initTextSizes();
}
bool res = (m_textSize.height()>geometry().height()&&autoHeight()) ||
(m_textSize.width()>geometry().width()&&autoWidth()) ||
m_follower ||
isNeedExpandContent();
return res;
}
@ -441,7 +709,6 @@ void TextItem::setAlignment(Qt::Alignment value)
m_alignment=value;
//m_layout.setTextOption(QTextOption(m_alignment));
if (!isLoading()){
initTextSizes();
update(rect());
notify("alignment",QVariant(oldValue),QVariant(value));
}
@ -468,6 +735,7 @@ void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass)
} else {
setContent(context);
}
}
void TextItem::setAutoHeight(bool value)
@ -488,70 +756,97 @@ void TextItem::setAutoWidth(TextItem::AutoWidth value)
}
}
void TextItem::setAdaptFontToSize(bool value)
{
if (m_adaptFontToSize!=value){
bool oldValue = m_adaptFontToSize;
m_adaptFontToSize=value;
// initText();
invalidateRect(rect());
notify("updateFontToSize",oldValue,value);
}
}
bool TextItem::canBeSplitted(int height) const
{
return height>m_firstLineSize;
QFontMetrics fm(font());
return height > m_firstLineSize;
}
QString TextItem::getTextPart(int height, int skipHeight){
int linesHeight = 0;
int curLine = 0;
int textPos = 0;
TextPtr text = textDocument();
QTextBlock curBlock = text->begin();
QString resultText = "";
if (skipHeight > 0){
for (;curBlock != text->end(); curBlock=curBlock.next()){
for (curLine = 0; curLine < curBlock.layout()->lineCount(); curLine++){
linesHeight += curBlock.layout()->lineAt(curLine).height() + lineSpacing();
if (linesHeight > (skipHeight-(/*fakeMarginSize()*2+*/borderLineSize() * 2))) {goto loop_exit;}
}
}
loop_exit:;
}
linesHeight = 0;
for (;curBlock != text->end() || curLine<curBlock.lineCount(); curBlock = curBlock.next(), curLine = 0, resultText += '\n'){
for (; curLine<curBlock.layout()->lineCount(); curLine++){
if (resultText == "") textPos= curBlock.layout()->lineAt(curLine).textStart();
linesHeight += curBlock.layout()->lineAt(curLine).height() + lineSpacing();
if ( (height>0) && (linesHeight>(height-(/*fakeMarginSize()*2+*/borderLineSize()*2))) ) {
linesHeight-=curBlock.layout()->lineAt(curLine).height();
goto loop_exit1;
}
resultText+=curBlock.text().mid(curBlock.layout()->lineAt(curLine).textStart(),
curBlock.layout()->lineAt(curLine).textLength());
}
}
loop_exit1:;
resultText.chop(1);
QScopedPointer<HtmlContext> context(new HtmlContext(m_strText));
return context->extendTextByTags(resultText,textPos);
}
void TextItem::restoreLinksEvent()
{
if (!followTo().isEmpty()){
BaseDesignIntf* pi = dynamic_cast<BaseDesignIntf*>(parentItem());
if (pi){
foreach (BaseDesignIntf* bi, pi->childBaseItems()) {
if (bi->patternName().compare(followTo())==0){
TextItem* ti = dynamic_cast<TextItem*>(bi);
if (ti){
ti->setFollower(this);
}
}
}
}
}
}
BaseDesignIntf *TextItem::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent)
{
TextPtr text = textDocument();
int linesHeight=0;
QString tmpText="";
TextItem* upperPart = dynamic_cast<TextItem*>(cloneItem(itemMode(),owner,parent));
for (QTextBlock it=text->begin();it!=text->end();it=it.next()){
for (int i=0;i<it.layout()->lineCount();i++){
linesHeight+=it.layout()->lineAt(i).height();
if (linesHeight>(height-(fakeMarginSize()*2+borderLineSize()*2))) {
linesHeight-=it.layout()->lineAt(i).height();
goto loop_exit;
}
tmpText+=it.text().mid(it.layout()->lineAt(i).textStart(),it.layout()->lineAt(i).textLength())+'\n';
}
}
loop_exit:
tmpText.chop(1);
upperPart->setHeight(linesHeight+fakeMarginSize()*2+borderLineSize()*2);
QScopedPointer<HtmlContext> context(new HtmlContext(m_strText));
upperPart->setContent(context->extendTextByTags(tmpText,0));
upperPart->setContent(getTextPart(height,0));
upperPart->initTextSizes();
upperPart->setHeight(upperPart->textSize().height()+borderLineSize()*2);
return upperPart;
}
BaseDesignIntf *TextItem::cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent)
{
TextPtr text = textDocument();
TextItem* bottomPart = dynamic_cast<TextItem*>(cloneItem(itemMode(),owner,parent));
int linesHeight=0;
int curLine=0;
QTextBlock curBlock;
QString tmpText="";
for (curBlock=text->begin();curBlock!=text->end();curBlock=curBlock.next()){
for (curLine=0;curLine<curBlock.layout()->lineCount();curLine++){
linesHeight+=curBlock.layout()->lineAt(curLine).height();
if (linesHeight>(height-(fakeMarginSize()*2+borderLineSize()*2))) {goto loop_exit;}
}
}
loop_exit:;
int textPos=0;
for (;curBlock!=text->end();curBlock=curBlock.next(),curLine=0){
for (;curLine<curBlock.layout()->lineCount();curLine++){
if (tmpText=="") textPos= curBlock.layout()->lineAt(curLine).textStart();
tmpText+=curBlock.text().mid(curBlock.layout()->lineAt(curLine).textStart(),
curBlock.layout()->lineAt(curLine).textLength()) + "\n";
}
}
tmpText.chop(1);
QScopedPointer<HtmlContext> context(new HtmlContext(m_strText));
bottomPart->setContent(context->extendTextByTags(tmpText,textPos));
bottomPart->setContent(getTextPart(0,height));
bottomPart->initTextSizes();
bottomPart->setHeight(bottomPart->m_textSize.height()+borderLineSize()*2);
bottomPart->setHeight(bottomPart->textSize().height()+borderLineSize()*2);
return bottomPart;
}
@ -571,9 +866,10 @@ BaseDesignIntf *TextItem::cloneEmpty(int height, QObject *owner, QGraphicsItem *
void TextItem::objectLoadFinished()
{
ItemDesignIntf::objectLoadFinished();
if (itemMode() == DesignMode || !isNeedExpandContent()){
initTextSizes();
}
// if (itemMode() == DesignMode || !isNeedExpandContent()){
// if (autoHeight() && autoWidth())
// initTextSizes();
// }
}
void TextItem::setTextItemFont(QFont value)
@ -643,7 +939,6 @@ void TextItem::setAngle(const AngleType& value)
AngleType oldValue = m_angle;
m_angle = value;
if (!isLoading()){
initTextSizes();
update();
notify("angle",oldValue,value);
}
@ -665,6 +960,16 @@ void TextItem::setForegroundOpacity(int value)
}
}
void TextItem::setUnderlines(bool value)
{
if (m_underlines != value){
bool oldValue = m_underlines;
m_underlines = value;
update();
notify("underlines",oldValue,value);
}
}
} //namespace LimeReport

View File

@ -32,15 +32,16 @@
#include <QGraphicsTextItem>
#include <QtGui>
#include <QLabel>
#include "lritemdesignintf.h"
#include <qnamespace.h>
#include <QTextDocument>
#include "lritemdesignintf.h"
#include "lritemdesignintf.h"
#include "lrpageinitintf.h"
namespace LimeReport {
class Tag;
class TextItem : public LimeReport::ContentItemDesignIntf {
class TextItem : public LimeReport::ContentItemDesignIntf, IPageInit {
Q_OBJECT
Q_ENUMS(AutoWidth)
Q_ENUMS(AngleType)
@ -57,11 +58,19 @@ class TextItem : public LimeReport::ContentItemDesignIntf {
Q_PROPERTY(QColor fontColor READ fontColor WRITE setFontColorProperty)
Q_PROPERTY(AngleType angle READ angle WRITE setAngle)
Q_PROPERTY(int foregroundOpacity READ foregroundOpacity WRITE setForegroundOpacity)
Q_PROPERTY(bool underlines READ underlines WRITE setUnderlines)
Q_PROPERTY(bool adaptFontToSize READ adaptFontToSize WRITE setAdaptFontToSize)
Q_PROPERTY(bool trimValue READ trimValue WRITE setTrimValue)
Q_PROPERTY(int lineSpacing READ lineSpacing WRITE setLineSpacing)
Q_PROPERTY(int underlineLineSize READ underlineLineSize WRITE setUnderlineLineSize)
Q_PROPERTY(bool allowHTML READ allowHTML WRITE setAllowHTML)
Q_PROPERTY(bool allowHTMLInFields READ allowHTMLInFields WRITE setAllowHTMLInFields)
Q_PROPERTY(QString format READ format WRITE setFormat)
Q_PROPERTY(ValueType valueType READ valueType WRITE setValueType)
Q_PROPERTY(QString followTo READ followTo WRITE setFollowTo)
Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle)
Q_PROPERTY(qreal textIndent READ textIndent WRITE setTextIndent)
Q_PROPERTY(Qt::LayoutDirection textLayoutDirection READ textLayoutDirection WRITE setTextLayoutDirection)
public:
enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength};
@ -76,9 +85,6 @@ public:
QString content() const;
void setContent(const QString& value);
//void setMarginSize(int value);
void setAlignment(Qt::Alignment value);
Qt::Alignment alignment(){return m_alignment;}
@ -93,9 +99,12 @@ public:
void setAutoWidth(AutoWidth value);
AutoWidth autoWidth() const {return m_autoWidth;}
void setAdaptFontToSize(bool value);
bool adaptFontToSize() const {return m_adaptFontToSize;}
bool canBeSplitted(int height) const;
bool isSplittable() const { return true;}
bool isEmpty() const{return m_strText.isEmpty();}
bool isEmpty() const{return m_strText.trimmed().isEmpty() /*m_text->isEmpty()*/;}
BaseDesignIntf* cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent);
BaseDesignIntf* cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent);
BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
@ -112,10 +121,18 @@ public:
void setAngle(const AngleType& value);
int foregroundOpacity(){return m_foregroundOpacity;}
void setForegroundOpacity(int value);
bool underlines(){return m_underlines;}
void setUnderlines(bool value);
bool trimValue() const;
void setTrimValue(bool trimValue);
int lineSpacing() const;
void setLineSpacing(int value);
int underlineLineSize() const;
void setUnderlineLineSize(int value);
bool allowHTML() const;
void setAllowHTML(bool allowHTML);
@ -128,37 +145,69 @@ public:
ValueType valueType() const;
void setValueType(const ValueType valueType);
QSizeF textSize(){ return m_textSize;}
QString followTo() const;
void setFollowTo(const QString &followTo);
void setFollower(TextItem* follower);
void clearFollower();
bool hasFollower() const;
TextItem* follower() const { return m_follower;}
bool initFollower(QString follower);
// IPageInit interface
void pageObjectHasBeenLoaded();
typedef QSharedPointer<QTextDocument> TextPtr;
qreal textIndent() const;
void setTextIndent(const qreal &textIndent);
Qt::LayoutDirection textLayoutDirection() const;
void setTextLayoutDirection(const Qt::LayoutDirection &textLayoutDirection);
protected:
void updateLayout();
bool isNeedExpandContent() const;
QString replaceBR(QString text);
QString replaceReturns(QString text);
int fakeMarginSize();
int fakeMarginSize() const;
QString getTextPart(int height, int skipHeight);
void restoreLinksEvent();
void preparePopUpMenu(QMenu &menu);
void processPopUpAction(QAction *action);
private:
void initTextSizes();
void initTextSizes() const;
void setTextFont(TextPtr text, const QFont &value) const;
void adaptFontSize(TextPtr text) const;
QString formatDateTime(const QDateTime &value);
QString formatNumber(const double value);
QString formatFieldValue();
typedef QSharedPointer<QTextDocument> TextPtr;
TextPtr textDocument();
TextPtr textDocument() const;
private:
QString m_strText;
//QTextLayout m_layout;
//QTextDocument* m_text;
//QTextDocument* m_text;
Qt::Alignment m_alignment;
bool m_autoHeight;
AutoWidth m_autoWidth;
QSizeF m_textSize;
qreal m_firstLineSize;
QSizeF mutable m_textSize;
qreal mutable m_firstLineSize;
AngleType m_angle;
int m_foregroundOpacity;
bool m_underlines;
bool m_adaptFontToSize;
bool m_trimValue;
int m_lineSpacing;
int m_underlineLineSize;
bool m_allowHTML;
bool m_allowHTMLInFields;
QString m_format;
ValueType m_valueType;
QString m_followTo;
TextItem* m_follower;
qreal m_textIndent;
Qt::LayoutDirection m_textLayoutDirection;
};
}

View File

@ -88,8 +88,8 @@ SOURCES += \
$$REPORT_PATH/lrgroupfunctions.cpp \
$$REPORT_PATH/lrsimplecrypt.cpp \
$$REPORT_PATH/lraboutdialog.cpp \
$$REPORT_PATH/lrsettingdialog.cpp
$$REPORT_PATH/lrsettingdialog.cpp \
$$REPORT_PATH/scriptbrowser/lrscriptbrowser.cpp
contains(CONFIG, zint){
SOURCES += $$REPORT_PATH/items/lrbarcodeitem.cpp
@ -186,8 +186,10 @@ HEADERS += \
$$REPORT_PATH/lrsimplecrypt.h \
$$REPORT_PATH/lraboutdialog.h \
$$REPORT_PATH/lrcallbackdatasourceintf.h \
$$REPORT_PATH/lrsettingdialog.h
$$REPORT_PATH/lrsettingdialog.h \
$$REPORT_PATH/lrpreviewreportwidget_p.h \
$$REPORT_PATH/scriptbrowser/lrscriptbrowser.h
contains(CONFIG,zint){
HEADERS += $$REPORT_PATH/items/lrbarcodeitem.h
}
@ -202,12 +204,15 @@ FORMS += \
$$REPORT_PATH/lrpreviewreportwidget.ui \
$$REPORT_PATH/items/lrtextitemeditor.ui \
$$REPORT_PATH/lraboutdialog.ui \
$$REPORT_PATH/lrsettingdialog.ui
$$REPORT_PATH/lrsettingdialog.ui \
$$REPORT_PATH/scriptbrowser/lrscriptbrowser.ui \
RESOURCES += \
$$REPORT_PATH/objectinspector/lobjectinspector.qrc \
$$REPORT_PATH/databrowser/lrdatabrowser.qrc \
$$REPORT_PATH/report.qrc \
$$REPORT_PATH/items/items.qrc
$$REPORT_PATH/items/items.qrc \
$$REPORT_PATH/scriptbrowser/lrscriptbrowser.qrc

View File

@ -67,7 +67,7 @@ contains(CONFIG,zint){
####Automatically build required translation files (*.qm)
contains(CONFIG,build_translations){
LANGUAGES = ru es_ES
LANGUAGES = ru es_ES ar
defineReplace(prependAll) {
for(a,$$1):result += $$2$${a}$$3

View File

@ -34,15 +34,15 @@
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;img src=&quot;:/report/images/logo_100.png&quot; height=&quot;100&quot; style=&quot;float: left;&quot; /&gt;&lt;span style=&quot; font-size:12pt; font-weight:600; color:#555555;&quot;&gt;Report engine for &lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-weight:600; color:#7faa18;&quot;&gt;Qt&lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-weight:600; color:#555555;&quot;&gt; framework&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;img src=&quot;:/report/images/logo_100.png&quot; height=&quot;100&quot; style=&quot;float: left;&quot; /&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Report engine for &lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-weight:600; color:#7faa18;&quot;&gt;Qt&lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt; framework&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:11pt;&quot;&gt;LimeReport - multi-platform C++ library written using Qt framework and intended for software developers that would like to add into their application capability to form report or print forms generated using templates.&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:11pt;&quot;&gt;Official web site : &lt;/span&gt;&lt;a href=&quot;www.limereport.ru&quot;&gt;&lt;span style=&quot; font-size:11pt; text-decoration: underline; color:#0000ff;&quot;&gt;www.limereport.ru&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt; text-decoration: underline; color:#0000ff;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt; font-weight:600; color:#000000;&quot;&gt;This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt; font-weight:600;&quot;&gt;This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt; font-weight:600; color:#000000;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt; color:#000000;&quot;&gt;Copyright 2015 Arin Alexander. All rights reserved.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Copyright 2015 Arin Alexander. All rights reserved.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -87,114 +87,114 @@ p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;(c) 2015 Arin Alexander arin_a@bk.ru&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a name=&quot;SEC1&quot;&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#333333;&quot;&gt;G&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#333333;&quot;&gt;NU LESSER GENERAL PUBLIC LICENSE&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;Version 2.1, February 1999&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000; background-color:#ffffff;&quot;&gt;Copyright (C) 1991, 1999 Free Software Foundation, Inc.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000; background-color:#ffffff;&quot;&gt;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000; background-color:#ffffff;&quot;&gt;Everyone is permitted to copy and distribute verbatim copies&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000; background-color:#ffffff;&quot;&gt;of this license document, but changing it is not allowed.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000; background-color:#ffffff;&quot;&gt;[This is the first released version of the Lesser GPL. It also counts&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000; background-color:#ffffff;&quot;&gt; as the successor of the GNU Library Public License, version 2, hence&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000; background-color:#ffffff;&quot;&gt; the version number 2.1.]&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;a name=&quot;SEC2&quot;&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#333333;&quot;&gt;P&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#333333;&quot;&gt;reamble&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;We call this license the &amp;quot;Lesser&amp;quot; General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a &amp;quot;work based on the library&amp;quot; and a &amp;quot;work that uses the library&amp;quot;. The former contains code derived from the library, whereas the latter must be combined with the library in order to run.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;a name=&quot;SEC3&quot;&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#333333;&quot;&gt;T&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#333333;&quot;&gt;ERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#000000;&quot;&gt;0.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000;&quot;&gt; This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called &amp;quot;this License&amp;quot;). Each licensee is addressed as &amp;quot;you&amp;quot;.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;A &amp;quot;library&amp;quot; means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;The &amp;quot;Library&amp;quot;, below, refers to any such software library or work which has been distributed under these terms. A &amp;quot;work based on the Library&amp;quot; means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term &amp;quot;modification&amp;quot;.)&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;&amp;quot;Source code&amp;quot; for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#000000;&quot;&gt;1.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000;&quot;&gt; You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#000000;&quot;&gt;2.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000;&quot;&gt; You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; font-family:'sans-serif'; color:#000000;&quot; style=&quot; margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;a)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; The modified work must itself be a software library.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot; font-family:'sans-serif'; color:#000000;&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;b)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot; font-family:'sans-serif'; color:#000000;&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;c)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot; font-family:'sans-serif'; color:#000000;&quot; style=&quot; margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;d)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p style=&quot; margin-top:15px; margin-bottom:15px; margin-left:38px; margin-right:19px; -qt-block-indent:1; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000;&quot;&gt;(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#000000;&quot;&gt;3.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000;&quot;&gt; You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;This option is useful when you wish to copy part of the code of the Library into a program that is not a library.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#000000;&quot;&gt;4.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000;&quot;&gt; You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#000000;&quot;&gt;5.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000;&quot;&gt; A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a &amp;quot;work that uses the Library&amp;quot;. Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;However, linking a &amp;quot;work that uses the Library&amp;quot; with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a &amp;quot;work that uses the library&amp;quot;. The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;When a &amp;quot;work that uses the Library&amp;quot; uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#000000;&quot;&gt;6.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000;&quot;&gt; As an exception to the Sections above, you may also combine or link a &amp;quot;work that uses the Library&amp;quot; with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; font-family:'sans-serif'; color:#000000;&quot; style=&quot; margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;a)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable &amp;quot;work that uses the Library&amp;quot;, as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot; font-family:'sans-serif'; color:#000000;&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;b)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot; font-family:'sans-serif'; color:#000000;&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;c)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot; font-family:'sans-serif'; color:#000000;&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;d)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot; font-family:'sans-serif'; color:#000000;&quot; style=&quot; margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;e)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; Verify that the user has already received a copy of these materials or that you have already sent this user a copy.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;For an executable, the required form of the &amp;quot;work that uses the Library&amp;quot; must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#000000;&quot;&gt;7.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000;&quot;&gt; You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; font-family:'sans-serif'; color:#000000;&quot; style=&quot; margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;a)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot; font-family:'sans-serif'; color:#000000;&quot; style=&quot; margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;b)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#000000;&quot;&gt;8.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000;&quot;&gt; You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#000000;&quot;&gt;9.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000;&quot;&gt; You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#000000;&quot;&gt;10.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000;&quot;&gt; Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#000000;&quot;&gt;11.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000;&quot;&gt; If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#000000;&quot;&gt;12.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000;&quot;&gt; If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#000000;&quot;&gt;13.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000;&quot;&gt; The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and &amp;quot;any later version&amp;quot;, you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#000000;&quot;&gt;14.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000;&quot;&gt; If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#000000;&quot;&gt;NO WARRANTY&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#000000;&quot;&gt;15.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000;&quot;&gt; BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY &amp;quot;AS IS&amp;quot; WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#000000;&quot;&gt;16.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000;&quot;&gt; IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#333333; background-color:#ffffff;&quot;&gt;END OF TERMS AND CONDITIONS&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;a name=&quot;SEC4&quot;&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#333333;&quot;&gt;H&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#333333;&quot;&gt;ow to Apply These Terms to Your New Libraries&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the &amp;quot;copyright&amp;quot; line and a pointer to where the full notice is found.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; font-style:italic; color:#000000;&quot;&gt;one line to give the library's name and an idea of what it does.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000;&quot;&gt;Copyright (C) &lt;/span&gt;&lt;span style=&quot; font-family:'monospace'; font-style:italic; color:#000000;&quot;&gt;year&lt;/span&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000;&quot;&gt; &lt;/span&gt;&lt;span style=&quot; font-family:'monospace'; font-style:italic; color:#000000;&quot;&gt;name of author&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; font-style:italic; color:#000000; background-color:#ffffff;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000;&quot;&gt;This library is free software; you can redistribute it and/or&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000;&quot;&gt;modify it under the terms of the GNU Lesser General Public&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000;&quot;&gt;License as published by the Free Software Foundation; either&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000;&quot;&gt;version 2.1 of the License, or (at your option) any later version.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000;&quot;&gt;This library is distributed in the hope that it will be useful,&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000;&quot;&gt;but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000;&quot;&gt;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000;&quot;&gt;Lesser General Public License for more details.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000;&quot;&gt;You should have received a copy of the GNU Lesser General Public&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000;&quot;&gt;License along with this library; if not, write to the Free Software&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000;&quot;&gt;Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;Also add information on how to contact you by electronic and paper mail.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;You should also get your employer (if you work as a programmer) or your school, if any, to sign a &amp;quot;copyright disclaimer&amp;quot; for the library, if necessary. Here is a sample; alter the names:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000; background-color:#ffffff;&quot;&gt;Yoyodyne, Inc., hereby disclaims all copyright interest in&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000; background-color:#ffffff;&quot;&gt;the library `Frob' (a library for tweaking knobs) written&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000; background-color:#ffffff;&quot;&gt;by James Random Hacker.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; color:#000000; background-color:#ffffff;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; font-style:italic; color:#000000;&quot;&gt;signature of Ty Coon&lt;/span&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000;&quot;&gt;, 1 April 1990&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; color:#000000;&quot;&gt;Ty Coon, President of Vice&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; color:#000000; background-color:#ffffff;&quot;&gt;That's all there is to it!&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a name=&quot;SEC1&quot;&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;G&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;NU LESSER GENERAL PUBLIC LICENSE&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;Version 2.1, February 1999&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;Copyright (C) 1991, 1999 Free Software Foundation, Inc.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;Everyone is permitted to copy and distribute verbatim copies&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;of this license document, but changing it is not allowed.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;[This is the first released version of the Lesser GPL. It also counts&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt; as the successor of the GNU Library Public License, version 2, hence&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt; the version number 2.1.]&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a name=&quot;SEC2&quot;&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;P&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;reamble&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;We call this license the &amp;quot;Lesser&amp;quot; General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a &amp;quot;work based on the library&amp;quot; and a &amp;quot;work that uses the library&amp;quot;. The former contains code derived from the library, whereas the latter must be combined with the library in order to run.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a name=&quot;SEC3&quot;&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#333333;&quot;&gt;T&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#333333;&quot;&gt;ERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;0.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt; This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called &amp;quot;this License&amp;quot;). Each licensee is addressed as &amp;quot;you&amp;quot;.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;A &amp;quot;library&amp;quot; means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;The &amp;quot;Library&amp;quot;, below, refers to any such software library or work which has been distributed under these terms. A &amp;quot;work based on the Library&amp;quot; means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term &amp;quot;modification&amp;quot;.)&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;&amp;quot;Source code&amp;quot; for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;1.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt; You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;2.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt; You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; font-family:'sans-serif';&quot; style=&quot; margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;a)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; The modified work must itself be a software library.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot; font-family:'sans-serif';&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;b)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot; font-family:'sans-serif';&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;c)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot; font-family:'sans-serif';&quot; style=&quot; margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;d)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p style=&quot; margin-top:15px; margin-bottom:15px; margin-left:38px; margin-right:19px; -qt-block-indent:1; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;3.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt; You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;This option is useful when you wish to copy part of the code of the Library into a program that is not a library.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;4.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt; You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;5.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt; A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a &amp;quot;work that uses the Library&amp;quot;. Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;However, linking a &amp;quot;work that uses the Library&amp;quot; with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a &amp;quot;work that uses the library&amp;quot;. The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;When a &amp;quot;work that uses the Library&amp;quot; uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;6.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt; As an exception to the Sections above, you may also combine or link a &amp;quot;work that uses the Library&amp;quot; with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; font-family:'sans-serif';&quot; style=&quot; margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;a)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable &amp;quot;work that uses the Library&amp;quot;, as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot; font-family:'sans-serif';&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;b)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot; font-family:'sans-serif';&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;c)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot; font-family:'sans-serif';&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;d)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot; font-family:'sans-serif';&quot; style=&quot; margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;e)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; Verify that the user has already received a copy of these materials or that you have already sent this user a copy.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;For an executable, the required form of the &amp;quot;work that uses the Library&amp;quot; must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;7.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt; You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; font-family:'sans-serif';&quot; style=&quot; margin-top:19px; margin-bottom:0px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;a)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot; font-family:'sans-serif';&quot; style=&quot; margin-top:0px; margin-bottom:19px; margin-left:38px; margin-right:19px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px; font-weight:600;&quot;&gt;b)&lt;/span&gt;&lt;span style=&quot; font-size:16px;&quot;&gt; Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;8.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt; You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;9.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt; You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;10.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt; Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;11.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt; If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;12.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt; If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;13.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt; The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and &amp;quot;any later version&amp;quot;, you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;14.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt; If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;NO WARRANTY&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;15.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt; BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY &amp;quot;AS IS&amp;quot; WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600;&quot;&gt;16.&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt; IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#333333;&quot;&gt;END OF TERMS AND CONDITIONS&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:15px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a name=&quot;SEC4&quot;&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#333333;&quot;&gt;H&lt;/span&gt;&lt;span style=&quot; font-family:'sans-serif'; font-weight:600; color:#333333;&quot;&gt;ow to Apply These Terms to Your New Libraries&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the &amp;quot;copyright&amp;quot; line and a pointer to where the full notice is found.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; font-style:italic;&quot;&gt;one line to give the library's name and an idea of what it does.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;Copyright (C) &lt;/span&gt;&lt;span style=&quot; font-family:'monospace'; font-style:italic;&quot;&gt;year&lt;/span&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt; &lt;/span&gt;&lt;span style=&quot; font-family:'monospace'; font-style:italic;&quot;&gt;name of author&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace'; font-style:italic;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;This library is free software; you can redistribute it and/or&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;modify it under the terms of the GNU Lesser General Public&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;License as published by the Free Software Foundation; either&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;version 2.1 of the License, or (at your option) any later version.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;This library is distributed in the hope that it will be useful,&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;Lesser General Public License for more details.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;You should have received a copy of the GNU Lesser General Public&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;License along with this library; if not, write to the Free Software&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;Also add information on how to contact you by electronic and paper mail.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;You should also get your employer (if you work as a programmer) or your school, if any, to sign a &amp;quot;copyright disclaimer&amp;quot; for the library, if necessary. Here is a sample; alter the names:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;Yoyodyne, Inc., hereby disclaims all copyright interest in&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;the library `Frob' (a library for tweaking knobs) written&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;by James Random Hacker.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace'; font-style:italic;&quot;&gt;signature of Ty Coon&lt;/span&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;, 1 April 1990&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:15px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'monospace';&quot;&gt;Ty Coon, President of Vice&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:19px; margin-bottom:19px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'sans-serif';&quot;&gt;That's all there is to it!&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>

View File

@ -33,6 +33,7 @@
#include <algorithm>
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent>
#include <QMenu>
namespace LimeReport {
@ -183,16 +184,20 @@ BandDesignIntf::~BandDesignIntf()
delete m_bandNameLabel;
}
void BandDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget)
void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
if (backgroundColor()!=Qt::white) {
ppainter->fillRect(rect(),backgroundColor());
if ( !(backgroundColor() == Qt::white && backgroundBrushStyle() == SolidPattern) ) {
QBrush brush(backgroundColor(), static_cast<Qt::BrushStyle>(backgroundBrushStyle()));
brush.setTransform(painter->worldTransform().inverted());
painter->fillRect(rect(), brush);
}
if (itemMode()&DesignMode){
ppainter->save();
if (itemMode() & DesignMode){
painter->save();
QString bandText = objectName();
if (parentBand()) bandText+=QLatin1String(" connected to ")+parentBand()->objectName();
QFont font("Arial",7*Const::fontFACTOR,-1,true);
QFont font("Arial", 7 * Const::fontFACTOR, -1, true);
QFontMetrics fontMetrics(font);
QVector<QRectF> bandNameRects;
@ -204,22 +209,22 @@ void BandDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *o
//if (isSelected()) ppainter->setPen(QColor(167,244,167));
// else ppainter->setPen(QColor(220,220,220));
ppainter->setFont(font);
painter->setFont(font);
for (int i=0;i<bandNameRects.count();i++){
QRectF labelRect = bandNameRects[i].adjusted(-2,-2,2,2);
if ((labelRect.height())<height() && (childBaseItems().isEmpty()) && !isSelected()){
ppainter->setRenderHint(QPainter::Antialiasing);
ppainter->setBrush(bandColor());
ppainter->setOpacity(Const::BAND_NAME_AREA_OPACITY);
ppainter->drawRoundedRect(labelRect,8,8);
ppainter->setOpacity(Const::BAND_NAME_TEXT_OPACITY);
ppainter->setPen(Qt::black);
ppainter->drawText(bandNameRects[i],Qt::AlignHCenter,bandText);
painter->setRenderHint(QPainter::Antialiasing);
painter->setBrush(bandColor());
painter->setOpacity(Const::BAND_NAME_AREA_OPACITY);
painter->drawRoundedRect(labelRect,8,8);
painter->setOpacity(Const::BAND_NAME_TEXT_OPACITY);
painter->setPen(Qt::black);
painter->drawText(bandNameRects[i],Qt::AlignHCenter,bandText);
}
}
ppainter->restore();
painter->restore();
}
BaseDesignIntf::paint(ppainter,option,widget);
BaseDesignIntf::paint(painter,option,widget);
}
BandDesignIntf::BandsType BandDesignIntf::bandType() const
@ -357,6 +362,7 @@ bool BandDesignIntf::canBeSplitted(int height) const
bool BandDesignIntf::isEmpty() const
{
if (!isVisible()) return true;
foreach(QGraphicsItem* qgItem,childItems()){
BaseDesignIntf* item = dynamic_cast<BaseDesignIntf*>(qgItem);
if ((item)&&(!item->isEmpty())) return false;
@ -426,6 +432,34 @@ void BandDesignIntf::moveItemsDown(qreal startPos, qreal offset){
}
}
void BandDesignIntf::preparePopUpMenu(QMenu &menu)
{
foreach (QAction* action, menu.actions()) {
if (action->text().compare(tr("Bring to top")) == 0 ||
action->text().compare(tr("Send to back")) == 0 )
action->setEnabled(false);
}
menu.addSeparator();
QAction* autoHeightAction = menu.addAction(tr("Auto height"));
autoHeightAction->setCheckable(true);
autoHeightAction->setChecked(autoHeight());
QAction* autoSplittableAction = menu.addAction(tr("Splittable"));
autoSplittableAction->setCheckable(true);
autoSplittableAction->setChecked(isSplittable());
}
void BandDesignIntf::processPopUpAction(QAction *action)
{
if (action->text().compare(tr("Auto height")) == 0){
setProperty("autoHeight",action->isChecked());
}
if (action->text().compare(tr("Splittable")) == 0){
setProperty("splittable",action->isChecked());
}
}
BaseDesignIntf* BandDesignIntf::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent)
{
int maxBottom = 0;
@ -721,6 +755,13 @@ void BandDesignIntf::initMode(ItemMode mode)
BaseDesignIntf::initMode(mode);
if ((mode==PreviewMode)||(mode==PrintMode)){
m_bandMarker->setVisible(false);
} else {
if (!m_bandMarker->scene() && this->scene()){
this->scene()->addItem(m_bandMarker);
m_bandMarker->setParentItem(this->parentItem());
m_bandMarker->setHeight(this->height());
}
m_bandMarker->setVisible(true);
}
}
@ -792,6 +833,14 @@ void BandDesignIntf::setStartNewPage(bool startNewPage)
m_startNewPage = startNewPage;
}
void BandDesignIntf::setAutoHeight(bool value){
if (m_autoHeight != value){
m_autoHeight=value;
if (!isLoading())
notify("autoHeight",!value,value);
}
}
bool BandDesignIntf::reprintOnEachPage() const
{
return m_reprintOnEachPage;
@ -882,6 +931,7 @@ void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass p
if (borderLines()!=0){
spaceBorder += borderLineSize();
}
restoreLinks();
snapshotItemsLayout();
arrangeSubItems(pass, dataManager);
if (autoHeight()){

View File

@ -92,6 +92,7 @@ class BandDesignIntf : public BaseDesignIntf
Q_PROPERTY(bool keepBottomSpace READ keepBottomSpaceOption WRITE setKeepBottomSpaceOption )
Q_PROPERTY(QString parentBand READ parentBandName WRITE setParentBandName DESIGNABLE false )
Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle)
Q_PROPERTY(bool printIfEmpty READ printIfEmpty WRITE setPrintIfEmpty)
Q_ENUMS(BandColumnsLayoutType)
friend class BandMarker;
@ -121,7 +122,7 @@ public:
BandDesignIntf(BandsType bandType, const QString& xmlTypeName, QObject* owner = 0, QGraphicsItem* parent=0);
~BandDesignIntf();
void paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
virtual BandsType bandType() const;
virtual QString bandTitle() const;
virtual QIcon bandIcon() const;
@ -206,7 +207,7 @@ public:
bool startNewPage() const;
void setStartNewPage(bool startNewPage);
void setAutoHeight(bool value){m_autoHeight=value;}
void setAutoHeight(bool value);
bool autoHeight(){return m_autoHeight;}
bool startFromNewPage() const;
@ -243,6 +244,8 @@ protected:
void setColumnsCount(int value);
void setColumnsFillDirection(BandColumnsLayoutType value);
void moveItemsDown(qreal startPos, qreal offset);
void preparePopUpMenu(QMenu &menu);
void processPopUpAction(QAction *action);
private slots:
void childBandDeleted(QObject* band);
private:

View File

@ -34,8 +34,9 @@
#include "lrreportdesignwidget.h"
#include "qgraphicsitem.h"
#include "lrdesignelementsfactory.h"
#include "lrhorizontallayout.h"
#include "serializators/lrstorageintf.h"
#include "serializators/lrxmlreader.h"
#include <memory>
@ -44,6 +45,8 @@
#include <QApplication>
#include <QDialog>
#include <QVBoxLayout>
#include <QMenu>
#include <QClipboard>
namespace LimeReport
{
@ -64,19 +67,19 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q
m_BGMode(OpaqueMode),
m_opacity(100),
m_borderLinesFlags(0),
m_hintFrame(0),
m_storageTypeName(storageTypeName),
m_itemMode(DesignMode),
m_objectState(ObjectCreated),
m_selectionMarker(0),
m_joinMarker(0),
m_backgroundBrush(Solid),
m_backgroundBrushcolor(Qt::white),
m_backgroundBrushStyle(SolidPattern),
m_backgroundColor(Qt::white),
m_margin(4),
m_itemAlign(DesignedItemAlign),
m_changingItemAlign(false),
m_borderColor(Qt::black),
m_reportSettings(0)
m_reportSettings(0),
m_patternName("")
{
setGeometry(QRectF(0, 0, m_width, m_height));
if (BaseDesignIntf *item = dynamic_cast<BaseDesignIntf *>(parent)) {
@ -85,9 +88,6 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q
m_font = QFont("Arial",10);
}
initFlags();
//connect(this,SIGNAL(objectNameChanged(QString)),this,SLOT(slotObjectNameChanged(QString)));
}
QRectF BaseDesignIntf::boundingRect() const
@ -124,21 +124,23 @@ QString BaseDesignIntf::parentReportItemName() const
else return "";
}
void BaseDesignIntf::setBackgroundBrushMode(BaseDesignIntf::BrushMode value)
void BaseDesignIntf::setBackgroundBrushStyle(BrushStyle value)
{
if ( value != m_backgroundBrush ){
m_backgroundBrush=value;
if ( value != m_backgroundBrushStyle ){
BrushStyle oldValue = m_backgroundBrushStyle;
m_backgroundBrushStyle=value;
if (!isLoading()) update();
notify("backgroundBrushStyle", static_cast<int>(oldValue), static_cast<int>(value));
}
}
void BaseDesignIntf::setBackgroundColor(QColor value)
{
if (value != m_backgroundBrushcolor){
QColor oldValue = m_backgroundBrushcolor;
m_backgroundBrushcolor=value;
if (value != m_backgroundColor){
QColor oldValue = m_backgroundColor;
m_backgroundColor=value;
if (!isLoading()) update();
notify("backgroundColor",oldValue,m_backgroundBrushcolor);
notify("backgroundColor", oldValue, value);
}
}
@ -242,6 +244,31 @@ QFont BaseDesignIntf::transformToSceneFont(const QFont& value) const
return f;
}
QString BaseDesignIntf::expandDataFields(QString context, ExpandType expandType, DataSourceManager* dataManager)
{
ScriptEngineManager& sm = ScriptEngineManager::instance();
if (sm.dataManager() != dataManager) sm.setDataManager(dataManager);
return sm.expandDataFields(context, expandType, m_varValue, this);
}
QString BaseDesignIntf::expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager* dataManager)
{
ScriptEngineManager& sm = ScriptEngineManager::instance();
if (sm.dataManager() != dataManager) sm.setDataManager(dataManager);
return sm.expandUserVariables(context, pass, expandType, m_varValue);
}
QString BaseDesignIntf::expandScripts(QString context, DataSourceManager* dataManager)
{
ScriptEngineManager& sm = ScriptEngineManager::instance();
if (sm.dataManager() != dataManager) sm.setDataManager(dataManager);
return sm.expandScripts(context,m_varValue,this);
}
void BaseDesignIntf::setupPainter(QPainter *painter) const
{
if (!painter) {
@ -352,7 +379,6 @@ void BaseDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *o
Q_UNUSED(option);
Q_UNUSED(widget);
setupPainter(ppainter);
drawBorder(ppainter, rect());
if (isSelected()) {drawSelection(ppainter, rect());}
drawResizeZone(ppainter);
@ -368,24 +394,28 @@ QColor calcColor(QColor color){
return Qt::white;
else
return Qt::black;
};
}
void BaseDesignIntf::prepareRect(QPainter *ppainter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
void BaseDesignIntf::prepareRect(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
{
ppainter->save();
painter->save();
QBrush brush(m_backgroundColor,static_cast<Qt::BrushStyle>(m_backgroundBrushStyle));
brush.setTransform(painter->worldTransform().inverted());
if (isSelected() && (opacity() == 100) && (m_BGMode!=TransparentMode)) {
ppainter->fillRect(rect(), QBrush(QColor(m_backgroundBrushcolor)));
painter->fillRect(rect(), brush);
}
else {
if (m_BGMode == OpaqueMode) {
ppainter->setOpacity(qreal(m_opacity) / 100);
ppainter->fillRect(rect(), QBrush(m_backgroundBrushcolor));
painter->setOpacity(qreal(m_opacity) / 100);
painter->fillRect(rect(), brush);
} else if (itemMode() & DesignMode){
ppainter->setOpacity(0.1);
ppainter->fillRect(rect(), QBrush(QPixmap(":/report/empty")));
painter->setOpacity(0.1);
painter->fillRect(rect(), QBrush(QPixmap(":/report/images/empty")));
}
}
ppainter->restore();
painter->restore();
}
void BaseDesignIntf::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
@ -672,6 +702,16 @@ void BaseDesignIntf::turnOnSelectionMarker(bool value)
}
}
QString BaseDesignIntf::patternName() const
{
return (m_patternName.isEmpty()) ? objectName() : m_patternName;
}
void BaseDesignIntf::setPatternName(const QString &patternName)
{
m_patternName = patternName;
}
ReportSettings *BaseDesignIntf::reportSettings() const
{
return m_reportSettings;
@ -737,7 +777,7 @@ void BaseDesignIntf::emitObjectNamePropertyChanged(const QString &oldName, const
int BaseDesignIntf::borderLineSize() const
{
return m_borderLineSize;
return 0 /*m_borderLineSize*/;
}
void BaseDesignIntf::setBorderLineSize(int value)
@ -987,6 +1027,19 @@ void BaseDesignIntf::parentChangedEvent(BaseDesignIntf *)
}
void BaseDesignIntf::restoreLinks()
{
#ifdef HAVE_QT5
foreach(QObject * child, children()) {
#else
foreach(QObject * child, QObject::children()) {
#endif
BaseDesignIntf *childItem = dynamic_cast<BaseDesignIntf *>(child);
if (childItem) {childItem->restoreLinks();}
}
restoreLinksEvent();
}
QPainterPath BaseDesignIntf::shape() const
{
QPainterPath path;
@ -1098,6 +1151,53 @@ void BaseDesignIntf::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
QGraphicsItem::mouseDoubleClickEvent(event);
}
void BaseDesignIntf::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
PageDesignIntf* page = dynamic_cast<PageDesignIntf*>(scene());
if (!page->selectedItems().contains(this)){
page->clearSelection();
this->setSelected(true);
}
QMenu menu;
QAction* copyAction = menu.addAction(QIcon(":/report/images/copy.png"), tr("Copy"));
copyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
QAction* cutAction = menu.addAction(QIcon(":/report//images/cut"), tr("Cut"));
cutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X));
QAction* pasteAction = menu.addAction(QIcon(":/report/images/paste.png"), tr("Paste"));
pasteAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V));
pasteAction->setEnabled(false);
QClipboard *clipboard = QApplication::clipboard();
ItemsReaderIntf::Ptr reader = StringXMLreader::create(clipboard->text());
if (reader->first() && reader->itemType() == "Object"){
pasteAction->setEnabled(true);
}
menu.addSeparator();
QAction* brinToTopAction = menu.addAction(QIcon(":/report//images/bringToTop"), tr("Bring to top"));
QAction* sendToBackAction = menu.addAction(QIcon(":/report//images/sendToBack"), tr("Send to back"));
menu.addSeparator();
QAction* noBordersAction = menu.addAction(QIcon(":/report//images/noLines"), tr("No borders"));
QAction* allBordersAction = menu.addAction(QIcon(":/report//images/allLines"), tr("All borders"));
preparePopUpMenu(menu);
QAction* a = menu.exec(event->screenPos());
if (a){
if (a == cutAction)
page->cut();
if (a == copyAction)
page->copy();
if (a == pasteAction)
page->paste();
if (a == brinToTopAction)
page->bringToFront();
if (a == sendToBackAction)
page->sendToBack();
if (a == noBordersAction)
page->setBorders(BaseDesignIntf::NoLine);
if (a == allBordersAction)
page->setBorders(BaseDesignIntf::AllLines);
processPopUpAction(a);
}
}
int BaseDesignIntf::possibleMoveDirectionFlags() const
{
return m_possibleMoveDirectionFlags;
@ -1229,6 +1329,7 @@ void BaseDesignIntf::collectionLoadFinished(const QString &collectionName)
BaseDesignIntf *BaseDesignIntf::cloneItem(ItemMode mode, QObject *owner, QGraphicsItem *parent)
{
BaseDesignIntf *clone = cloneItemWOChild(mode, owner, parent);
clone->setPatternName(this->objectName());
#ifdef HAVE_QT5
foreach(QObject * child, children()) {
#else

View File

@ -83,7 +83,7 @@ class BaseDesignIntf :
Q_INTERFACES(QGraphicsItem)
Q_ENUMS(BGMode)
Q_ENUMS(Qt::BrushStyle)
Q_ENUMS(BrushMode)
Q_ENUMS(BrushStyle)
Q_ENUMS(ItemAlign)
Q_FLAGS(BorderLines)
Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometryProperty NOTIFY geometryChanged)
@ -96,8 +96,23 @@ class BaseDesignIntf :
Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor)
public:
enum BGMode { TransparentMode,OpaqueMode};
enum BrushMode{Solid,None};
enum BGMode { TransparentMode, OpaqueMode};
enum BrushStyle{ NoBrush,
SolidPattern,
Dense1Pattern,
Dense2Pattern,
Dense3Pattern,
Dense4Pattern,
Dense5Pattern,
Dense6Pattern,
Dense7Pattern,
HorPattern,
VerPattern,
CrossPattern,
BDiagPattern,
FDiagPattern };
enum ResizeFlags { Fixed = 0,
ResizeLeft = 1,
ResizeRight = 2,
@ -109,13 +124,17 @@ public:
TopBotom=2,
All=3
};
enum BorderSide { TopLine = 1,
BottomLine = 2,
LeftLine = 4,
RightLine = 8
enum BorderSide {
NoLine = 0,
TopLine = 1,
BottomLine = 2,
LeftLine = 4,
RightLine = 8,
AllLines = 15
};
enum ObjectState {ObjectLoading, ObjectLoaded, ObjectCreated};
enum ItemAlign {LeftItemAlign,RightItemAlign,CenterItemAlign,ParentWidthItemAlign,DesignedItemAlign};
// enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols};
Q_DECLARE_FLAGS(BorderLines, BorderSide)
Q_DECLARE_FLAGS(ItemMode,ItemModes)
friend class SelectionMarker;
@ -123,13 +142,13 @@ public:
BaseDesignIntf(const QString& storageTypeName, QObject* owner = 0, QGraphicsItem* parent = 0);
virtual ~BaseDesignIntf();
void setParentReportItem(const QString& value);
void setParentReportItem(const QString& value);
QString parentReportItemName() const;
BrushMode backgroundBrushMode() const {return m_backgroundBrush;}
void setBackgroundBrushMode(BrushMode value);
QColor backgroundColor() const {return m_backgroundBrushcolor;}
void setBackgroundColor(QColor value);
BrushStyle backgroundBrushStyle() const {return m_backgroundBrushStyle;}
void setBackgroundBrushStyle(BrushStyle value);
QColor backgroundColor() const {return m_backgroundColor;}
void setBackgroundColor(QColor value);
QPen pen() const;
void setPen(QPen& pen);
@ -154,7 +173,7 @@ public:
virtual QSizeF sizeMM() const;
void paint(QPainter* ppainter, const QStyleOptionGraphicsItem* option, QWidget* widget);
void prepareRect(QPainter* ppainter, const QStyleOptionGraphicsItem*, QWidget*);
void prepareRect(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*);
virtual QPainterPath shape() const;
void setFixedPos(bool fixedPos);
@ -249,6 +268,8 @@ public:
ReportSettings* reportSettings() const;
void setReportSettings(ReportSettings *reportSettings);
void setZValueProperty(qreal value);
QString patternName() const;
void setPatternName(const QString &patternName);
Q_INVOKABLE QString setItemWidth(qreal width);
Q_INVOKABLE QString setItemHeight(qreal height);
@ -258,6 +279,7 @@ public:
Q_INVOKABLE qreal getItemPosY();
Q_INVOKABLE QString setItemPosX(qreal xValue);
Q_INVOKABLE QString setItemPosY(qreal yValue);
protected:
//ICollectionContainer
@ -274,6 +296,7 @@ protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
virtual void geometryChangedEvent(QRectF newRect, QRectF oldRect);
virtual QPen borderPen(BorderSide side) const;
@ -283,6 +306,8 @@ protected:
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
virtual void childAddedEvent(BaseDesignIntf* child);
virtual void parentChangedEvent(BaseDesignIntf*);
void restoreLinks();
virtual void restoreLinksEvent(){}
void drawTopLine(QPainter *painter, QRectF rect) const;
void drawBootomLine(QPainter *painter, QRectF rect) const;
@ -305,6 +330,16 @@ protected:
virtual bool drawDesignBorders() const {return true;}
virtual QColor selectionMarkerColor(){ return Const::SELECTION_COLOR;}
QString expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager *dataManager);
QString expandDataFields(QString context, ExpandType expandType, DataSourceManager *dataManager);
QString expandScripts(QString context, DataSourceManager *dataManager);
QVariant m_varValue;
virtual void preparePopUpMenu(QMenu& menu){Q_UNUSED(menu)}
virtual void processPopUpAction(QAction* action){Q_UNUSED(action)}
private:
void updateSelectionMarker();
int resizeDirectionFlags(QPointF position);
@ -314,13 +349,13 @@ private:
void turnOnSelectionMarker(bool value);
private:
QPointF m_startPos;
//QPointF m_startScenePos;
int m_resizeHandleSize;
int m_selectionPenSize;
int m_possibleResizeDirectionFlags;
int m_possibleMoveDirectionFlags;
int m_resizeDirectionFlags;
qreal m_width, m_height;
qreal m_width;
qreal m_height;
QPen m_pen;
QFont m_font;
QColor m_fontColor;
@ -342,7 +377,6 @@ private:
QRectF m_rightRect;
QVector<QRectF*> m_resizeAreas;
QFrame* m_hintFrame;
QString m_storageTypeName;
ItemMode m_itemMode;
@ -350,8 +384,9 @@ private:
SelectionMarker* m_selectionMarker;
Marker* m_joinMarker;
BrushMode m_backgroundBrush;
QColor m_backgroundBrushcolor;
BrushStyle m_backgroundBrushStyle;
QColor m_backgroundColor;
RenderPass m_currentPass;
int m_margin;
QString m_itemTypeName;
@ -359,6 +394,7 @@ private:
bool m_changingItemAlign;
QColor m_borderColor;
ReportSettings* m_reportSettings;
QString m_patternName;
signals:
void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
void posChanged(QObject* object, QPointF newPos, QPointF oldPos);
@ -371,6 +407,10 @@ signals:
void propertyesChanged(QVector<QString> propertyNames);
void itemAlignChanged(BaseDesignIntf* item, const ItemAlign& oldValue, const ItemAlign& newValue);
void itemVisibleHasChanged(BaseDesignIntf* item);
void beforeRender();
void afterData();
void afterRender();
};
} //namespace LimeReport

View File

@ -350,12 +350,14 @@ void ModelToDataSource::slotModelDestroed()
ConnectionDesc::ConnectionDesc(QSqlDatabase db, QObject *parent)
: QObject(parent), m_connectionName(db.connectionName()), m_connectionHost(db.hostName()), m_connectionDriver(db.driverName()),
m_databaseName(db.databaseName()), m_user(db.userName()), m_password(db.password()), m_autoconnect(false)
m_databaseName(db.databaseName()), m_user(db.userName()), m_password(db.password()), m_autoconnect(false),
m_internal(false), m_keepDBCredentials(true)
{}
ConnectionDesc::ConnectionDesc(QObject *parent)
:QObject(parent),m_connectionName(""),m_connectionHost(""),m_connectionDriver(""),
m_databaseName(""), m_user(""), m_password(""), m_autoconnect(false)
m_databaseName(""), m_user(""), m_password(""), m_autoconnect(false),
m_internal(false), m_keepDBCredentials(true)
{}
ConnectionDesc::Ptr ConnectionDesc::create(QSqlDatabase db, QObject *parent)
@ -376,7 +378,27 @@ bool ConnectionDesc::isEqual(const QSqlDatabase &db)
(db.hostName() == m_connectionHost) &&
(db.connectionName() == m_connectionName) &&
(db.userName() == m_user) &&
(db.password() == m_password);
(db.password() == m_password);
}
QString ConnectionDesc::connectionNameForUser(const QString &connectionName)
{
return connectionName.compare(QSqlDatabase::defaultConnection) == 0 ? tr("defaultConnection") : connectionName;
}
QString ConnectionDesc::connectionNameForReport(const QString &connectionName)
{
return connectionName.compare(tr("defaultConnection")) == 0 ? QSqlDatabase::defaultConnection : connectionName;
}
bool ConnectionDesc::keepDBCredentials() const
{
return m_keepDBCredentials;
}
void ConnectionDesc::setKeepDBCredentials(bool keepDBCredentals)
{
m_keepDBCredentials = keepDBCredentals;
}
QueryDesc::QueryDesc(QString queryName, QString queryText, QString connection)
@ -736,11 +758,15 @@ bool CallbackDatasource::checkIfEmpty(){
if (m_rowCount == 0) {
return true;
} else {
QVariant result = true;
QVariant isEmpty = true;
QVariant recordCount = 0;
CallbackInfo info;
info.dataType = CallbackInfo::RowCount;
emit getCallbackData(info, recordCount);
if (recordCount.toInt()>0) return false;
info.dataType = CallbackInfo::IsEmpty;
emit getCallbackData(info,result);
return result.toBool();
emit getCallbackData(info,isEmpty);
return isEmpty.toBool();
}
}

View File

@ -110,6 +110,7 @@ class ConnectionDesc : public QObject{
Q_PROPERTY(QString password READ password WRITE setPassword)
Q_PROPERTY(QString host READ host WRITE setHost)
Q_PROPERTY(bool autoconnect READ autoconnect WRITE setAutoconnect)
Q_PROPERTY(bool keepDBCredentials READ keepDBCredentials WRITE setKeepDBCredentials)
public:
typedef QSharedPointer<ConnectionDesc> Ptr;
ConnectionDesc(QSqlDatabase db, QObject* parent=0);
@ -124,12 +125,19 @@ public:
void setDatabaseName(const QString &value){m_databaseName=value;}
QString databaseName(){return m_databaseName;}
void setUserName(const QString &value){m_user=value;}
QString userName(){return m_user;}
QString userName(){ return m_user; }
void setPassword(const QString &value){m_password=value;}
QString password(){return m_password;}
QString password(){ return m_password; }
void setAutoconnect(bool value){m_autoconnect=value;}
bool autoconnect(){return m_autoconnect;}
bool isEqual(const QSqlDatabase& db);
bool isInternal(){ return m_internal; }
void setInternal(bool value) {m_internal = value;}
bool keepDBCredentials() const;
void setKeepDBCredentials(bool keepDBCredentials);
public:
static QString connectionNameForUser(const QString& connectionName);
static QString connectionNameForReport(const QString& connectionName);
signals:
void nameChanged(const QString& oldName,const QString& newName);
private:
@ -140,6 +148,8 @@ private:
QString m_user;
QString m_password;
bool m_autoconnect;
bool m_internal;
bool m_keepDBCredentials;
};
class IConnectionController{
@ -147,6 +157,7 @@ public:
virtual void addConnectionDesc(ConnectionDesc* connection) = 0;
virtual void changeConnectionDesc(ConnectionDesc* connection) = 0;
virtual bool checkConnectionDesc(ConnectionDesc* connection) = 0;
virtual bool containsDefaultConnection() = 0;
virtual QString lastError() const = 0;
};

View File

@ -217,7 +217,7 @@ void DataSourceModel::updateModel()
}
DataSourceManager::DataSourceManager(QObject *parent) :
QObject(parent), m_lastError(""), m_designTime(true), m_needUpdate(false)
QObject(parent), m_lastError(""), m_designTime(true), m_needUpdate(false), m_dbCredentialsProvider(0)
{
m_groupFunctionFactory.registerFunctionCreator(QLatin1String("COUNT"),new ConstructorGroupFunctionCreator<CountGroupFunction>);
m_groupFunctionFactory.registerFunctionCreator(QLatin1String("SUM"),new ConstructorGroupFunctionCreator<SumGroupFunction>);
@ -238,6 +238,29 @@ void DataSourceManager::setDefaultDatabasePath(const QString &defaultDatabasePat
{
m_defaultDatabasePath = defaultDatabasePath;
}
QString DataSourceManager::putGroupFunctionsExpressions(QString expression)
{
if (m_groupFunctionsExpressionsMap.contains(expression)){
return QString::number(m_groupFunctionsExpressionsMap.value(expression));
} else {
m_groupFunctionsExpressions.append(expression);
m_groupFunctionsExpressionsMap.insert(expression, m_groupFunctionsExpressions.size()-1);
return QString::number(m_groupFunctionsExpressions.size()-1);
}
}
void DataSourceManager::clearGroupFuntionsExpressions()
{
m_groupFunctionsExpressionsMap.clear();
m_groupFunctionsExpressions.clear();
}
QString DataSourceManager::getExpression(QString index)
{
return m_groupFunctionsExpressions.at(index.toInt());
}
bool DataSourceManager::designTime() const
{
return m_designTime;
@ -301,6 +324,11 @@ ICallbackDatasource *DataSourceManager::createCallbackDatasouce(const QString& n
return ds;
}
void DataSourceManager::registerDbCredentialsProvider(IDbCredentialsProvider *provider)
{
m_dbCredentialsProvider = provider;
}
void DataSourceManager::addCallbackDatasource(ICallbackDatasource *datasource, const QString& name)
{
IDataSource* datasourceIntf = dynamic_cast<IDataSource*>(datasource);
@ -544,6 +572,11 @@ int DataSourceManager::connectionIndexByName(const QString &connectionName)
return -1;
}
QList<ConnectionDesc *>& DataSourceManager::conections()
{
return m_connections;
}
bool DataSourceManager::dataSourceIsValid(const QString &name)
{
if (m_datasources.value(name.toLower())) return !m_datasources.value(name.toLower())->isInvalid();
@ -597,16 +630,19 @@ void DataSourceManager::removeDatasource(const QString &name)
emit datasourcesChanged();
}
void DataSourceManager::removeConnection(const QString &name)
void DataSourceManager::removeConnection(const QString &connectionName)
{
for(int i=0;i<m_connections.count();++i){
if (m_connections.at(i)->name()==name){
QSqlDatabase db = QSqlDatabase::database(name);
db.close();
QSqlDatabase::removeDatabase(name);
delete m_connections.at(i);
m_connections.removeAt(i);
QList<ConnectionDesc*>::iterator cit = m_connections.begin();
while( cit != m_connections.end() ){
if ( ((*cit)->name().compare(connectionName) == 0) && (*cit)->isInternal() ){
{
QSqlDatabase db = QSqlDatabase::database(connectionName);
db.close();
}
QSqlDatabase::removeDatabase(connectionName);
}
delete (*cit);
cit = m_connections.erase(cit);
}
emit datasourcesChanged();
}
@ -631,10 +667,14 @@ void DataSourceManager::addConnectionDesc(ConnectionDesc * connection)
bool DataSourceManager::checkConnectionDesc(ConnectionDesc *connection)
{
if (connectConnection(connection)){
QSqlDatabase::removeDatabase(connection->name());
if (connection->isInternal()){
QSqlDatabase::removeDatabase(connection->name());
if (designTime()) emit datasourcesChanged();
}
return true;
}
QSqlDatabase::removeDatabase(connection->name());
if (connection->isInternal())
QSqlDatabase::removeDatabase(connection->name());
return false;
}
@ -676,10 +716,19 @@ void DataSourceManager::putProxyDesc(ProxyDesc *proxyDesc)
bool DataSourceManager::initAndOpenDB(QSqlDatabase& db, ConnectionDesc& connectionDesc){
bool connected = false;
db.setHostName(replaceVariables(connectionDesc.host()));
db.setUserName(replaceVariables(connectionDesc.userName()));
db.setPassword(replaceVariables(connectionDesc.password()));
if (!connectionDesc.keepDBCredentials() && m_dbCredentialsProvider){
if (!m_dbCredentialsProvider->getUserName(connectionDesc.name()).isEmpty())
db.setUserName(m_dbCredentialsProvider->getUserName(connectionDesc.name()));
if (!m_dbCredentialsProvider->getPassword(connectionDesc.name()).isEmpty())
db.setPassword(m_dbCredentialsProvider->getPassword(connectionDesc.name()));
}
QString dbName = replaceVariables(connectionDesc.databaseName());
if (connectionDesc.driver().compare("QSQLITE")==0){
if (!defaultDatabasePath().isEmpty()){
@ -702,7 +751,17 @@ bool DataSourceManager::initAndOpenDB(QSqlDatabase& db, ConnectionDesc& connecti
return connected;
}
bool DataSourceManager::checkConnection(QSqlDatabase& db){
ReportSettings *DataSourceManager::reportSettings() const
{
return m_reportSettings;
}
void DataSourceManager::setReportSettings(ReportSettings *reportSettings)
{
m_reportSettings = reportSettings;
}
bool DataSourceManager::checkConnection(QSqlDatabase db){
QSqlQuery query("Select 1",db);
return query.first();
}
@ -712,34 +771,41 @@ bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc)
bool connected = false;
clearErrors();
QString lastError = "";
QString lastError ="";
foreach(QString datasourceName, dataSourceNames()){
dataSourceHolder(datasourceName)->clearErrors();
}
if (!QSqlDatabase::contains(connectionDesc->name())){
QSqlDatabase db = QSqlDatabase::addDatabase(connectionDesc->driver(),connectionDesc->name());
connected = initAndOpenDB(db, *connectionDesc);
QString dbError;
{
QSqlDatabase db = QSqlDatabase::addDatabase(connectionDesc->driver(),connectionDesc->name());
connectionDesc->setInternal(true);
connected=initAndOpenDB(db, *connectionDesc);
dbError = db.lastError().text();
}
if (!connected){
setLastError(db.lastError().text());
if (!dbError.trimmed().isEmpty())
setLastError(dbError);
QSqlDatabase::removeDatabase(connectionDesc->name());
return false;
}
} else {
QSqlDatabase db = QSqlDatabase::database(connectionDesc->name());
if (!connectionDesc->isEqual(db)){
if (!connectionDesc->isEqual(db) && connectionDesc->isInternal()){
db.close();
connected = initAndOpenDB(db, *connectionDesc);
} else {
// connected = db.isOpen();
connected = checkConnection(db);
if (!connected)
if (!connected && connectionDesc->isInternal())
connected = initAndOpenDB(db, *connectionDesc);
}
}
if (!connected) {
QSqlDatabase::removeDatabase(connectionDesc->name());
if (connectionDesc->isInternal())
QSqlDatabase::removeDatabase(connectionDesc->name());
return false;
} else {
foreach(QString datasourceName, dataSourceNames()){
@ -829,8 +895,9 @@ bool DataSourceManager::isConnection(const QString &connectionName)
bool DataSourceManager::isConnectionConnected(const QString &connectionName)
{
if (isConnection(connectionName)){
return QSqlDatabase::database(connectionName).isOpen();
if (isConnection(connectionName) && QSqlDatabase::contains(connectionName)){
QSqlDatabase db = QSqlDatabase::database(connectionName);
return db.isValid() && QSqlDatabase::database(connectionName).isOpen();
}
return false;
}
@ -851,11 +918,15 @@ void DataSourceManager::disconnectConnection(const QString& connectionName)
}
}
}
{
QSqlDatabase db = QSqlDatabase::database(connectionName);
if (db.isOpen()) db.close();
ConnectionDesc* connectionDesc = connectionByName(connectionName);
if (connectionDesc->isInternal()){
{
QSqlDatabase db = QSqlDatabase::database(connectionName);
if (db.isOpen()) db.close();
}
if (QSqlDatabase::contains(connectionName)) QSqlDatabase::removeDatabase(connectionName);
}
if (QSqlDatabase::contains(connectionName)) QSqlDatabase::removeDatabase(connectionName);
}
@ -1152,7 +1223,8 @@ void DataSourceManager::clear(ClearMethod method)
QList<ConnectionDesc*>::iterator cit = m_connections.begin();
while( cit != m_connections.end() ){
QSqlDatabase::removeDatabase( (*cit)->name() );
if ( (*cit)->isInternal() )
QSqlDatabase::removeDatabase( (*cit)->name() );
delete (*cit);
cit = m_connections.erase(cit);
}

View File

@ -73,8 +73,8 @@ class DataSourceModel : public QAbstractItemModel{
public:
DataSourceModel():m_rootNode(new DataNode()){}
DataSourceModel(DataSourceManager* dataManager);
QModelIndex index(int row, int column, const QModelIndex &parent) const;
~DataSourceModel();
QModelIndex index(int row, int column, const QModelIndex &parent) const;
QModelIndex parent(const QModelIndex &child) const;
int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const;
@ -115,6 +115,7 @@ public:
bool addModel(const QString& name, QAbstractItemModel *model, bool owned);
void removeModel(const QString& name);
ICallbackDatasource* createCallbackDatasouce(const QString &name);
void registerDbCredentialsProvider(IDbCredentialsProvider *provider);
void addCallbackDatasource(ICallbackDatasource *datasource, const QString &name);
void setReportVariable(const QString& name, const QVariant& value);
void deleteVariable(const QString& name);
@ -131,7 +132,7 @@ public:
QString queryText(const QString& dataSourceName);
QString connectionName(const QString& dataSourceName);
void removeDatasource(const QString& name);
void removeConnection(const QString& name);
void removeConnection(const QString& connectionName);
bool isQuery(const QString& dataSourceName);
bool containsDatasource(const QString& dataSourceName);
bool isSubQuery(const QString& dataSourceName);
@ -150,6 +151,7 @@ public:
int proxyIndexByName(const QString& dataSourceName);
int connectionIndexByName(const QString& connectionName);
QList<ConnectionDesc *> &conections();
bool dataSourceIsValid(const QString& name);
IDataSource* dataSource(const QString& name);
IDataSourceHolder* dataSourceHolder(const QString& name);
@ -192,6 +194,13 @@ public:
QString defaultDatabasePath() const;
void setDefaultDatabasePath(const QString &defaultDatabasePath);
QString putGroupFunctionsExpressions(QString expression);
void clearGroupFuntionsExpressions();
QString getExpression(QString index);
ReportSettings *reportSettings() const;
void setReportSettings(ReportSettings *reportSettings);
signals:
void loadCollectionFinished(const QString& collectionName);
void cleared();
@ -214,8 +223,7 @@ protected:
void setSystemVariable(const QString& name, const QVariant& value, RenderPass pass);
void setLastError(const QString& value);
void invalidateLinkedDatasources(QString datasourceName);
bool checkConnection(QSqlDatabase &db);
bool checkConnection(QSqlDatabase db);
private slots:
void slotConnectionRenamed(const QString& oldName,const QString& newName);
void slotQueryTextChanged(const QString& queryName, const QString& queryText);
@ -241,7 +249,12 @@ private:
bool m_designTime;
bool m_needUpdate;
QString m_defaultDatabasePath;
ReportSettings* m_reportSettings;
QHash<QString,int> m_groupFunctionsExpressionsMap;
QVector<QString> m_groupFunctionsExpressions;
IDbCredentialsProvider* m_dbCredentialsProvider;
};
}
#endif // LRDATASOURCEMANAGER_H

View File

@ -37,18 +37,25 @@ class QString;
class QAbstractItemModel;
namespace LimeReport{
class IDbCredentialsProvider{
public:
virtual QString getUserName(const QString& connectionName) = 0;
virtual QString getPassword(const QString& connectionName) = 0;
};
class IDataSourceManager{
public:
virtual void setReportVariable(const QString& name, const QVariant& value)=0;
virtual void setDefaultDatabasePath(const QString &defaultDatabasePath)=0;
virtual void deleteVariable(const QString& name)=0;
virtual bool containsVariable(const QString& variableName)=0;
virtual QVariant variable(const QString& variableName)=0;
virtual bool addModel(const QString& name, QAbstractItemModel *model, bool owned)=0;
virtual void removeModel(const QString& name)=0;
virtual bool containsDatasource(const QString& dataSourceName)=0;
virtual void setReportVariable(const QString& name, const QVariant& value) = 0;
virtual void setDefaultDatabasePath(const QString &defaultDatabasePath) = 0;
virtual void deleteVariable(const QString& name) = 0;
virtual bool containsVariable(const QString& variableName) = 0;
virtual QVariant variable(const QString& variableName) = 0;
virtual bool addModel(const QString& name, QAbstractItemModel *model, bool owned) = 0;
virtual void removeModel(const QString& name) = 0;
virtual bool containsDatasource(const QString& dataSourceName) = 0;
virtual void clearUserVariables()=0;
virtual ICallbackDatasource* createCallbackDatasouce(const QString& name) = 0;
virtual void registerDbCredentialsProvider(IDbCredentialsProvider* provider) = 0;
//virtual void addCallbackDatasource(ICallbackDatasource* datasource, const QString& name) = 0;
};

View File

@ -51,4 +51,20 @@ void ReportSettings::setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentF
m_suppressAbsentFieldsAndVarsWarnings = suppressAbsentFieldsAndVarsWarnings;
}
QString escapeSimbols(const QString &value)
{
QString result = value;
result.replace("\"","\\\"");
result.replace('\n',"\\n");
return result;
}
QString replaceHTMLSymbols(const QString &value)
{
QString result = value;
result.replace("<","&lt;");
result.replace(">","&gt;");
return result;
}
} //namespace LimeReport

View File

@ -77,14 +77,26 @@ namespace Const{
const QString FIELD_RX = "\\$D\\s*\\{\\s*([^{}]*)\\s*\\}";
const QString VARIABLE_RX = "\\$V\\s*\\{\\s*([^{}]*)\\s*\\}";
const QString SCRIPT_RX = "\\$S\\s*\\{(.*)\\}";
const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)";
const int DATASOURCE_INDEX = 6;
const int VALUE_INDEX = 2;
//const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)";
//const int DATASOURCE_INDEX = 6;
//const int VALUE_INDEX = 2;
//const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:((?:(?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"?\\$S\\s*\\{\\s*)|(?:\\\"))((?:\\w+\\.?\\w+)|(?:\\w+))(?:(?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,)|(?:))\\s*\\\"(\\w+)\\\"\\s*\\)";
const QString GROUP_FUNCTION_PARAM_RX = "\\((?:(.+),|(?:))(?:\\\"(\\w+)\\\")\\)";
const int DATASOURCE_INDEX = 3;//4;
const int VALUE_INDEX = 2; //2;
const int EXPRESSION_ARGUMENT_INDEX = 1;//3;
const QString GROUP_FUNCTION_RX = "(%1\\s*"+GROUP_FUNCTION_PARAM_RX+")";
const QString GROUP_FUNCTION_NAME_RX = "%1\\s*\\((.*[^\\)])\\)";
const int SCENE_MARGIN = 50;
}
QString extractClassName(QString className);
QString escapeSimbols(const QString& value);
QString replaceHTMLSymbols(const QString &value);
enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols};
enum RenderPass {FirstPass, SecondPass};
enum ArrangeType {AsNeeded, Force};
enum PreviewHint{ShowAllPreviewBars = 0,
@ -93,6 +105,7 @@ namespace Const{
HidePreviewStatusBar = 4,
HideAllPreviewBar = 7,
PreviewBarsUserSetting = 8};
Q_DECLARE_FLAGS(PreviewHints, PreviewHint)
Q_FLAGS(PreviewHints)

View File

@ -29,7 +29,17 @@ void GraphicsViewZoomer::setModifiers(Qt::KeyboardModifiers modifiers) {
}
void GraphicsViewZoomer::setZoomFactorBase(double value) {
m_zoomFactorBase = value;
m_zoomFactorBase = value;
}
void GraphicsViewZoomer::setView(QGraphicsView *view)
{
if (m_view!=view){
m_view->viewport()->removeEventFilter(this);
m_view = view;
m_view->viewport()->installEventFilter(this);
m_view->setMouseTracking(true);
}
}
bool GraphicsViewZoomer::eventFilter(QObject *object, QEvent *event) {

View File

@ -13,6 +13,7 @@ public:
void gentleZoom(double factor);
void setModifiers(Qt::KeyboardModifiers modifiers);
void setZoomFactorBase(double value);
void setView(QGraphicsView* view);
private:
QGraphicsView* m_view;
Qt::KeyboardModifiers m_modifiers;

View File

@ -31,6 +31,7 @@
#include "lrdatasourcemanager.h"
#include "lrbanddesignintf.h"
#include "lritemdesignintf.h"
#include "lrscriptenginemanager.h"
#include <QRegExp>
@ -38,26 +39,51 @@ namespace LimeReport {
void GroupFunction::slotBandRendered(BandDesignIntf *band)
{
ScriptEngineManager& sm = ScriptEngineManager::instance();
QRegExp rxField(Const::FIELD_RX);
QRegExp rxVar(Const::VARIABLE_RX);
switch (m_dataType){
case Field:
if (m_dataManager->containsField(m_data)){
m_values.push_back(m_dataManager->fieldData(m_data));
} else {
setInvalid(tr("Field \"%1\" not found").arg(m_data));
if (rxField.indexIn(m_data) != -1){
QString field = rxField.cap(1);
if (m_dataManager->containsField(field)){
m_values.push_back(m_dataManager->fieldData(field));
} else {
setInvalid(tr("Field \"%1\" not found").arg(m_data));
}
}
break;
case Variable:
if (m_dataManager->containsVariable(m_data)){
m_values.push_back(m_dataManager->variable(m_data));
} else {
setInvalid(tr("Variable \"%1\" not found").arg(m_data));
if (rxVar.indexIn(m_data) != -1){
QString var = rxVar.cap(1);
if (m_dataManager->containsVariable(var)){
m_values.push_back(m_dataManager->variable(var));
} else {
setInvalid(tr("Variable \"%1\" not found").arg(m_data));
}
}
break;
case Script:
{
QVariant value = sm.evaluateScript(m_data);
if (value.isValid()){
m_values.push_back(value);
} else {
setInvalid(tr("Wrong script syntax \"%1\" ").arg(m_data));
}
break;
}
case ContentItem:{
ContentItemDesignIntf* item = dynamic_cast<ContentItemDesignIntf*>(band->childByName(m_data));
QString itemName = m_data;
ContentItemDesignIntf* item = dynamic_cast<ContentItemDesignIntf*>(band->childByName(itemName.remove('"')));
if (item)
m_values.push_back(item->content());
else setInvalid(tr("Item \"%1\" not found").arg(m_data));
else if (m_name.compare("COUNT",Qt::CaseInsensitive) == 0) {
m_values.push_back(1);
} else setInvalid(tr("Item \"%1\" not found").arg(m_data));
break;
}
default:
@ -88,24 +114,27 @@ QVariant GroupFunction::multiplication(QVariant value1, QVariant value2)
GroupFunction::GroupFunction(const QString &expression, const QString &dataBandName, DataSourceManager* dataManager)
:m_dataBandName(dataBandName), m_dataManager(dataManager),m_isValid(true), m_errorMessage("")
{
m_data = expression;
QRegExp rxField(Const::FIELD_RX,Qt::CaseInsensitive);
if (rxField.indexIn(expression)>=0){
m_dataType=Field;
m_data = rxField.cap(1);
QRegExp rxVariable(Const::VARIABLE_RX,Qt::CaseInsensitive);
QRegExp rxScript(Const::SCRIPT_RX,Qt::CaseInsensitive);
if (rxScript.indexIn(expression) != -1){
m_dataType = Script;
return;
}
QRegExp rxVariable(Const::VARIABLE_RX,Qt::CaseInsensitive);
if (rxVariable.indexIn(expression)>=0){
m_dataType=Variable;
m_data = rxVariable.cap(1);
if (rxField.indexIn(expression) != -1){
m_dataType=Field;
return;
}
if (rxVariable.indexIn(expression) != -1){
m_dataType = Variable;
return;
}
m_dataType = ContentItem;
m_data = expression;
m_data = m_data.remove('"');
}
GroupFunction *GroupFunctionFactory::createGroupFunction(const QString &functionName, const QString &expression, const QString& dataBandName, DataSourceManager *dataManager)

View File

@ -42,7 +42,7 @@ class BandDesignIntf;
class GroupFunction : public QObject{
Q_OBJECT
public:
enum DataType{Variable,Field,Srcipt,ContentItem};
enum DataType{Variable, Field, Script, ContentItem};
GroupFunction(const QString& expression, const QString& dataBandName, DataSourceManager *dataManager);
bool isValid(){return m_isValid;}
void setInvalid(QString message){m_isValid=false,m_errorMessage=message;}

View File

@ -113,157 +113,6 @@ void ItemDesignIntf::initFlags()
}
}
QString ContentItemDesignIntf::expandDataFields(QString context, ExpandType expandType, DataSourceManager* dataManager)
{
QRegExp rx(Const::FIELD_RX);
if (context.contains(rx)){
while ((rx.indexIn(context))!=-1){
QString field=rx.cap(1);
if (dataManager->containsField(field)) {
QString fieldValue;
m_varValue = dataManager->fieldData(field);
if (expandType == EscapeSymbols) {
if (dataManager->fieldData(field).isNull()) {
fieldValue="\"\"";
} else {
fieldValue = escapeSimbols(m_varValue.toString());
switch (dataManager->fieldData(field).type()) {
case QVariant::Char:
case QVariant::String:
case QVariant::StringList:
case QVariant::Date:
case QVariant::DateTime:
fieldValue = "\""+fieldValue+"\"";
break;
default:
break;
}
}
} else {
if (expandType == ReplaceHTMLSymbols)
fieldValue = replaceHTMLSymbols(m_varValue.toString());
else fieldValue = m_varValue.toString();
}
context.replace(rx.cap(0),fieldValue);
} else {
QString error = QString("Field %1 not found in %2 !!! ").arg(field).arg(this->objectName());
dataManager->putError(error);
if (!reportSettings() || !reportSettings()->suppressAbsentFieldsAndVarsWarnings())
context.replace(rx.cap(0),error);
else
context.replace(rx.cap(0),"");
}
}
}
return context;
}
QString ContentItemDesignIntf::expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager* dataManager)
{
QRegExp rx(Const::VARIABLE_RX);
if (context.contains(rx)){
int pos = 0;
while ((pos = rx.indexIn(context,pos))!=-1){
QString variable=rx.cap(1);
pos += rx.matchedLength();
if (dataManager->containsVariable(variable) ){
try {
if (pass==dataManager->variablePass(variable)){
m_varValue = dataManager->variable(variable);
switch (expandType){
case EscapeSymbols:
context.replace(rx.cap(0),escapeSimbols(m_varValue.toString()));
break;
case NoEscapeSymbols:
context.replace(rx.cap(0),m_varValue.toString());
break;
case ReplaceHTMLSymbols:
context.replace(rx.cap(0),replaceHTMLSymbols(m_varValue.toString()));
break;
}
pos=0;
}
} catch (ReportError e){
dataManager->putError(e.what());
if (!reportSettings() || reportSettings()->suppressAbsentFieldsAndVarsWarnings())
context.replace(rx.cap(0),e.what());
else
context.replace(rx.cap(0),"");
}
} else {
QString error;
error = tr("Variable %1 not found").arg(variable);
dataManager->putError(error);
if (!reportSettings() || reportSettings()->suppressAbsentFieldsAndVarsWarnings())
context.replace(rx.cap(0),error);
else
context.replace(rx.cap(0),"");
}
}
}
return context;
}
QString ContentItemDesignIntf::expandScripts(QString context, DataSourceManager* dataManager)
{
QRegExp rx(Const::SCRIPT_RX);
if (context.contains(rx)){
ScriptEngineManager::instance().setDataManager(dataManager);
QScriptEngine* se = ScriptEngineManager::instance().scriptEngine();
QScriptValue svThis = se->globalObject().property("THIS");
if (svThis.isValid()){
se->newQObject(svThis, this);
} else {
svThis = se->newQObject(this);
se->globalObject().setProperty("THIS",svThis);
}
ScriptExtractor scriptExtractor(context);
if (scriptExtractor.parse()){
for(int i=0; i<scriptExtractor.count();++i){
QString scriptBody = expandDataFields(scriptExtractor.bodyAt(i),EscapeSymbols, dataManager);
scriptBody = expandUserVariables(scriptBody, FirstPass, EscapeSymbols, dataManager);
QScriptValue value = se->evaluate(scriptBody);
if (!se->hasUncaughtException()) {
m_varValue = value.toVariant();
context.replace(scriptExtractor.scriptAt(i),value.toString());
} else {
context.replace(scriptExtractor.scriptAt(i),se->uncaughtException().toString());
}
}
}
}
return context;
}
QString ContentItemDesignIntf::content() const
{
return "";
}
QString ContentItemDesignIntf::escapeSimbols(const QString &value)
{
QString result = value;
result.replace("\"","\\\"");
result.replace('\n',"\\n");
return result;
}
QString ContentItemDesignIntf::replaceHTMLSymbols(const QString &value)
{
QString result = value;
result.replace("<","&lt;");
result.replace(">","&gt;");
return result;
}
Spacer::Spacer(QObject *owner, QGraphicsItem *parent)
:ItemDesignIntf("Spacer",owner,parent){}

View File

@ -73,17 +73,8 @@ class ContentItemDesignIntf : public ItemDesignIntf
public:
ContentItemDesignIntf(const QString& xmlTypeName, QObject* owner = 0,QGraphicsItem* parent = 0)
:ItemDesignIntf(xmlTypeName,owner,parent){}
virtual QString content() const;
virtual void setContent(const QString& value)=0;
enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols};
protected:
QString escapeSimbols(const QString& value);
QString replaceHTMLSymbols(const QString& value);
virtual QString expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager *dataManager);
virtual QString expandDataFields(QString context, ExpandType expandType, DataSourceManager *dataManager);
virtual QString expandScripts(QString context, DataSourceManager *dataManager);
QVariant m_varValue;
virtual QString content() const = 0;
virtual void setContent(const QString& value) = 0;
};
class LayoutDesignIntf : public ItemDesignIntf{

View File

@ -56,6 +56,7 @@
#include <QApplication>
#include <QMessageBox>
namespace LimeReport
{
@ -744,6 +745,15 @@ void PageDesignIntf::dropEvent(QGraphicsSceneDragDropEvent* event)
QString data = event->mimeData()->text().remove(0,event->mimeData()->text().indexOf(":")+1);
if (isVar) data = data.remove(QRegExp(" \\[.*\\]"));
ti->setContent(data);
if (!isVar){
BandDesignIntf* parentBand = dynamic_cast<BandDesignIntf*>(ti->parentItem());
if (parentBand && parentBand->datasourceName().isEmpty()){
QRegExp dataSource("(?:\\$D\\{\\s*(.*)\\..*\\})");
if (dataSource.indexIn(data) != -1){
parentBand->setProperty("datasource",dataSource.cap(1));
}
}
}
}
}
@ -1231,8 +1241,13 @@ BaseDesignIntf* PageDesignIntf::findDestObject(BaseDesignIntf* item){
void PageDesignIntf::paste()
{
QClipboard *clipboard = QApplication::clipboard();
if (!selectedItems().isEmpty()) {
BaseDesignIntf* destItem = findDestObject(dynamic_cast<BaseDesignIntf*>(selectedItems().at(0)));
BaseDesignIntf* destItem = 0;
ItemsReaderIntf::Ptr reader = StringXMLreader::create(clipboard->text());
if (reader->first() && reader->itemType() == "Object"){
if (!selectedItems().isEmpty())
destItem = findDestObject(dynamic_cast<BaseDesignIntf*>(selectedItems().at(0)));
else
destItem = this->pageItem();
if (destItem){
CommandIf::Ptr command = PasteCommand::create(this, clipboard->text(), destItem);
saveCommand(command);

View File

@ -123,6 +123,7 @@ namespace LimeReport {
PageItemDesignIntf *pageItem();
void setPageItem(PageItemDesignIntf::Ptr pageItem);
void setPageItems(QList<PageItemDesignIntf::Ptr> pages);
QList<PageItemDesignIntf::Ptr> pageItems(){return m_reportPages;}
bool isItemInsertMode();
ReportEnginePrivate* reportEditor();

View File

@ -0,0 +1,9 @@
#ifndef LRPAGEINITINTF_H
#define LRPAGEINITINTF_H
class IPageInit{
public:
virtual void pageObjectHasBeenLoaded() = 0;
};
#endif // LRPAGEINITINTF_H

View File

@ -33,6 +33,7 @@
#include <QGraphicsScene>
#include <QPrinter>
#include <QMenu>
namespace LimeReport {
@ -48,7 +49,7 @@ PageItemDesignIntf::PageItemDesignIntf(QObject *owner, QGraphicsItem *parent) :
BaseDesignIntf("PageItem",owner,parent),
m_topMargin(0), m_bottomMargin(0), m_leftMargin(0), m_rightMargin(0),
m_pageOrientaion(Portrait), m_pageSize(A4), m_sizeChainging(false),
m_fullPage(false), m_oldPrintMode(false)
m_fullPage(false), m_oldPrintMode(false), m_resetPageNumber(false)
{
setFixedPos(true);
setPossibleResizeDirectionFlags(Fixed);
@ -59,7 +60,7 @@ PageItemDesignIntf::PageItemDesignIntf(const PageSize pageSize, const QRectF &re
BaseDesignIntf("PageItem",owner,parent),
m_topMargin(0), m_bottomMargin(0), m_leftMargin(0), m_rightMargin(0),
m_pageOrientaion(Portrait), m_pageSize(pageSize), m_sizeChainging(false),
m_fullPage(false), m_oldPrintMode(false)
m_fullPage(false), m_oldPrintMode(false), m_resetPageNumber(false)
{
setFixedPos(true);
setPossibleResizeDirectionFlags(Fixed);
@ -300,6 +301,21 @@ void PageItemDesignIntf::initColumnsPos(QVector<qreal> &posByColumns, qreal pos,
}
}
bool PageItemDesignIntf::resetPageNumber() const
{
return m_resetPageNumber;
}
void PageItemDesignIntf::setResetPageNumber(bool resetPageNumber)
{
if (m_resetPageNumber!=resetPageNumber){
m_resetPageNumber = resetPageNumber;
if (!isLoading()){
notify("resetPageNumber",!m_resetPageNumber,m_resetPageNumber);
}
}
}
bool PageItemDesignIntf::oldPrintMode() const
{
return m_oldPrintMode;
@ -504,6 +520,14 @@ void PageItemDesignIntf::initPageSize(const QSizeF& size)
setHeight(size.height());
m_sizeChainging=false;
}
void PageItemDesignIntf::preparePopUpMenu(QMenu &menu)
{
foreach (QAction* action, menu.actions()) {
if (action->text().compare(tr("Paste")) != 0)
action->setVisible(false);
}
}
void PageItemDesignIntf::initPageSize(const PageItemDesignIntf::PageSize &size)
{
m_sizeChainging = true;

View File

@ -51,6 +51,7 @@ class PageItemDesignIntf : public LimeReport::BaseDesignIntf
Q_PROPERTY(int gridStep READ gridStep WRITE setGridStep)
Q_PROPERTY(bool fullPage READ fullPage WRITE setFullPage)
Q_PROPERTY(bool oldPrintMode READ oldPrintMode WRITE setOldPrintMode)
Q_PROPERTY(bool resetPageNumber READ resetPageNumber WRITE setResetPageNumber)
friend class ReportRender;
public:
enum Orientation { Portrait, Landscape };
@ -112,6 +113,9 @@ public:
bool oldPrintMode() const;
void setOldPrintMode(bool oldPrintMode);
bool canContainChildren(){ return true;}
bool resetPageNumber() const;
void setResetPageNumber(bool resetPageNumber);
protected slots:
void bandDeleted(QObject* band);
void bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
@ -123,6 +127,7 @@ protected:
void initPageSize(const PageSize &size);
void initPageSize(const QSizeF &size);
QColor selectionMarkerColor(){return Qt::transparent;}
void preparePopUpMenu(QMenu &menu);
private:
void paintGrid(QPainter *ppainter);
void initColumnsPos(QVector<qreal>&posByColumns, qreal pos, int columnCount);
@ -138,6 +143,10 @@ private:
QList<BandDesignIntf*> m_bands;
bool m_fullPage;
bool m_oldPrintMode;
bool m_resetPageNumber;
};
typedef QList<PageItemDesignIntf::Ptr> ReportPages;
}
#endif // LRPAGEITEM_H

View File

@ -174,8 +174,12 @@ void PreviewReportWidget::print()
void PreviewReportWidget::printToPDF()
{
QString fileName = QFileDialog::getSaveFileName(this,tr("PDF file name"),"","PDF(*.pdf)" );
QString filter = "PDF (*.pdf)";
QString fileName = QFileDialog::getSaveFileName(this,tr("PDF file name"),"","PDF (*.pdf)");
if (!fileName.isEmpty()){
QFileInfo fi(fileName);
if (fi.suffix().isEmpty())
fileName+=".pdf";
QPrinter printer;
printer.setOutputFileName(fileName);
printer.setOutputFormat(QPrinter::PdfFormat);

View File

@ -61,12 +61,25 @@ 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)) );
connect(m_previewReportWidget->d_ptr->m_previewPage,SIGNAL(selectionChanged()),this,SLOT(slotSelectionChanged()));
connect(m_pagesNavigator,SIGNAL(valueChanged(int)),this,SLOT(slotPageNavigatorChanged(int)));
m_fontEditor = new FontEditorWidget(m_previewReportWidget->d_ptr->m_previewPage,tr("Font"),this);
m_fontEditor->setObjectName("fontTools");
m_fontEditor->setIconSize(ui->toolBar->iconSize());
m_textAlignmentEditor = new TextAlignmentEditorWidget(m_previewReportWidget->d_ptr->m_previewPage,tr("Text align"),this);
m_textAlignmentEditor->setObjectName("textAlignmentTools");
m_textAlignmentEditor->setIconSize(ui->toolBar->iconSize());
addToolBar(Qt::TopToolBarArea,m_fontEditor);
addToolBar(Qt::TopToolBarArea,m_textAlignmentEditor);
m_scalePercent = new QComboBox(this);
m_scalePercent->setEditable(true);
ui->toolBar->insertWidget(ui->actionZoomOut, m_scalePercent);
initPercentCombobox();
// connect(ui->graphicsView->verticalScrollBar(),SIGNAL(valueChanged(int)), this, SLOT(slotSliderMoved(int)));
connect(ui->actionShowMessages, SIGNAL(triggered()), this, SLOT(slotShowErrors()));
connect(m_previewReportWidget, SIGNAL(scalePercentChanged(int)), this, SLOT(slotScalePercentChanged(int)));
connect(m_scalePercent, SIGNAL(currentIndexChanged(QString)), this, SLOT(scaleComboboxChanged(QString)));
restoreSetting();
@ -153,6 +166,11 @@ void PreviewReportWindow::setMenuVisible(bool value)
ui->menubar->setVisible(value);
}
void PreviewReportWindow::setHideResultEditButton(bool value)
{
ui->actionEdit_Mode->setVisible(value);
}
QSettings*PreviewReportWindow::settings()
{
if (m_settings){
@ -226,6 +244,11 @@ void PreviewReportWindow::moveEvent(QMoveEvent* e)
#endif
}
void PreviewReportWindow::showEvent(QShowEvent *)
{
m_fontEditor->setVisible(ui->actionEdit_Mode->isChecked());
m_textAlignmentEditor->setVisible(ui->actionEdit_Mode->isChecked());
}
void PreviewReportWindow::selectStateIcon()
{
if (ui->toolBar->isHidden()){
@ -270,6 +293,28 @@ void PreviewReportWindow::slotShowErrors()
m_previewReportWidget->setErrorsMesagesVisible(ui->actionShowMessages->isChecked());
}
void PreviewReportWindow::on_actionEdit_Mode_triggered(bool checked)
{
m_previewReportWidget->d_ptr->m_previewPage->setItemMode((checked)?ItemModes(DesignMode):PreviewMode);
m_textAlignmentEditor->setVisible(checked);
m_fontEditor->setVisible(checked);
//m_reportPages.at(m_currentPage)->setItemMode((checked)?DesignMode:PreviewMode);
}
void PreviewReportWindow::slotSelectionChanged()
{
QGraphicsScene* page=dynamic_cast<QGraphicsScene*>(sender());
if (page){
if (page->selectedItems().count()==1){
BaseDesignIntf* item = dynamic_cast<BaseDesignIntf*>(page->selectedItems().at(0));
if (item) {
m_fontEditor->setItem(item);
m_textAlignmentEditor->setItem(item);
}
}
}
}
ItemsReaderIntf *PreviewReportWindow::reader()
{
return m_reader.data();

View File

@ -41,6 +41,9 @@
#include "serializators/lrxmlreader.h"
#include "lrpreviewreportwidget.h"
#include "items/editors/lrfonteditorwidget.h"
#include "items/editors/lrtextalignmenteditorwidget.h"
namespace LimeReport {
namespace Ui {
@ -62,6 +65,7 @@ public:
void setToolBarVisible(bool value);
void setStatusBarVisible(bool value);
void setMenuVisible(bool value);
void setHideResultEditButton(bool value);
QSettings* settings();
protected:
void writeSetting();
@ -69,6 +73,7 @@ protected:
void closeEvent(QCloseEvent *);
void resizeEvent(QResizeEvent *e);
void moveEvent(QMoveEvent *e);
void showEvent(QShowEvent *);
void selectStateIcon();
public slots:
void slotPrint();
@ -79,6 +84,8 @@ public slots:
void slotPageNavigatorChanged(int value);
void slotShowErrors();
void on_actionSaveToFile_triggered();
void slotSelectionChanged();
void on_actionEdit_Mode_triggered(bool checked);
void slotFirstPage();
void slotLastPage();
void slotPrintToPDF();
@ -91,12 +98,9 @@ private slots:
void slotScalePercentChanged(int percent);
void on_actionShowMessages_toggled(bool value);
void on_actionShow_Toolbar_triggered();
private:
ItemsReaderIntf* reader();
void initPercentCombobox();
//bool pageIsVisible(PageItemDesignIntf::Ptr page);
//QRectF calcPageShift(PageItemDesignIntf::Ptr page);
private:
Ui::PreviewReportWindow *ui;
QSpinBox* m_pagesNavigator;
@ -105,6 +109,9 @@ private:
bool m_changingPage;
QSettings* m_settings;
bool m_ownedSettings;
FontEditorWidget* m_fontEditor;
TextAlignmentEditorWidget* m_textAlignmentEditor;
int m_priorScrolValue;
PreviewReportWidget* m_previewReportWidget;
QComboBox* m_scalePercent;
};

View File

@ -35,7 +35,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>20</height>
<height>19</height>
</rect>
</property>
<widget class="QMenu" name="menuView">
@ -75,6 +75,8 @@
<bool>false</bool>
</attribute>
<addaction name="actionPrint"/>
<addaction name="actionEdit_Mode"/>
<addaction name="actionSaveToFile"/>
<addaction name="actionPrint_To_PDF"/>
<addaction name="separator"/>
<addaction name="actionZoomIn"/>
@ -156,6 +158,9 @@
<property name="toolTip">
<string>Close Preview</string>
</property>
<property name="shortcut">
<string>Esc</string>
</property>
</action>
<action name="actionEdit_Mode">
<property name="checkable">

View File

@ -41,6 +41,8 @@
#include <QVBoxLayout>
#include <QFileDialog>
#include <QApplication>
#include <QTabWidget>
#include <QMessageBox>
namespace LimeReport {
@ -49,11 +51,10 @@ namespace LimeReport {
ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow *mainWindow, QWidget *parent) :
QWidget(parent), m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setContentsMargins(1,1,1,1);
m_view = new QGraphicsView(qobject_cast<QWidget*>(this));
m_view->setBackgroundBrush(QBrush(Qt::gray));
mainLayout->addWidget(m_view);
m_tabWidget = new QTabWidget(this);
m_tabWidget->setTabPosition(QTabWidget::South);
QVBoxLayout* mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(m_tabWidget);
setLayout(mainLayout);
if (!report) {
@ -66,16 +67,15 @@ ReportDesignWidget::ReportDesignWidget(ReportEnginePrivate *report, QMainWindow
if (!m_report->pageCount()) m_report->appendPage("page1");
}
setActivePage(m_report->pageAt(0));
foreach(QGraphicsItem* item, activePage()->selectedItems()){
item->setSelected(false);
}
createTabs();
connect(m_report,SIGNAL(pagesLoadFinished()),this,SLOT(slotPagesLoadFinished()));
connect(m_report,SIGNAL(cleared()),this,SIGNAL(cleared()));
m_view->scale(0.5,0.5);
connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentTabChanged(int)));
//m_instance=this;
//m_view->viewport()->installEventFilter(this);
m_zoomer = new GraphicsViewZoomer(m_view);
m_scriptEditor->setPlainText(report->scriptContext()->initScript());
m_zoomer = new GraphicsViewZoomer(activeView());
#ifdef Q_OS_WIN
m_defaultFont = QFont("Arial",10);
#endif
@ -133,20 +133,43 @@ void ReportDesignWidget::loadState(QSettings* settings)
if (v.isValid()){
m_useGrid = v.toBool();
}
settings->endGroup();
applySettings();
}
void ReportDesignWidget::createTabs(){
for (int i = 0; i<m_report->pageCount();++i){
QGraphicsView* view = new QGraphicsView(qobject_cast<QWidget*>(this));
view->setBackgroundBrush(QBrush(Qt::gray));
view->setFrameShape(QFrame::NoFrame);
view->setScene(m_report->pageAt(i));
foreach(QGraphicsItem* item, m_report->pageAt(i)->selectedItems()){
item->setSelected(false);
}
view->centerOn(0,0);
view->scale(0.5,0.5);
connectPage(m_report->pageAt(i));
m_tabWidget->addTab(view,QIcon(),tr("Page")+QString::number(i+1));
}
m_scriptEditor = new QTextEdit(this);
m_tabWidget->addTab(m_scriptEditor,QIcon(),tr("Script"));
m_tabWidget->setCurrentIndex(0);
}
ReportDesignWidget::~ReportDesignWidget()
{
delete m_zoomer;
}
void ReportDesignWidget::setActivePage(PageDesignIntf *page)
QGraphicsView* ReportDesignWidget::activeView(){
return dynamic_cast<QGraphicsView*>(m_tabWidget->currentWidget());
}
void ReportDesignWidget::connectPage(PageDesignIntf *page)
{
m_view->setScene(page);
connect(page,SIGNAL(itemInserted(LimeReport::PageDesignIntf*,QPointF,QString)),this,SIGNAL(itemInserted(LimeReport::PageDesignIntf*,QPointF,QString)));
connect(page,SIGNAL(itemInsertCanceled(QString)),this,SIGNAL(itemInsertCanceled(QString)));
connect(page,SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)),this,SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)));
@ -166,48 +189,55 @@ void ReportDesignWidget::setActivePage(PageDesignIntf *page)
connect(page, SIGNAL(pageUpdateFinished(LimeReport::PageDesignIntf*)),
this, SIGNAL(activePageUpdated(LimeReport::PageDesignIntf*)));
m_view->centerOn(0, 0);
//activeView()->centerOn(0,0);
emit activePageChanged();
}
void ReportDesignWidget::createStartPage()
{
PageDesignIntf* reportPage = m_report->appendPage("page1");
setActivePage(reportPage);
m_report->appendPage("page1");
createTabs();
}
void ReportDesignWidget::removeDatasource(const QString &datasourceName)
{
m_report->dataManager()->removeDatasource(datasourceName);
if (m_report->dataManager())
m_report->dataManager()->removeDatasource(datasourceName);
}
void ReportDesignWidget::addBand(const QString &bandType)
{
activePage()->addBand(bandType);
if (activePage())
activePage()->addBand(bandType);
}
void ReportDesignWidget::addBand(BandDesignIntf::BandsType bandType)
{
activePage()->addBand(bandType);
if (activePage())
activePage()->addBand(bandType);
}
void ReportDesignWidget::startInsertMode(const QString &itemType)
{
activePage()->startInsertMode(itemType);
if (activePage())
activePage()->startInsertMode(itemType);
}
void ReportDesignWidget::startEditMode()
{
activePage()->startEditMode();
if (activePage())
activePage()->startEditMode();
}
PageDesignIntf * ReportDesignWidget::activePage()
{
return qobject_cast<PageDesignIntf*>(m_view->scene());
if (activeView())
return qobject_cast<PageDesignIntf*>(activeView()->scene());
return 0;
}
QList<QGraphicsItem *> ReportDesignWidget::selectedItems(){
return m_view->scene()->selectedItems();
return activePage()->selectedItems();
}
void ReportDesignWidget::deleteItem(QGraphicsItem *item){
@ -227,6 +257,7 @@ void ReportDesignWidget::slotItemSelected(BaseDesignIntf *item){
}
void ReportDesignWidget::saveToFile(const QString &fileName){
m_report->scriptContext()->setInitScript(m_scriptEditor->toPlainText());
if (m_report->saveToFile(fileName)) {
m_report->emitSaveFinished();
}
@ -234,6 +265,7 @@ void ReportDesignWidget::saveToFile(const QString &fileName){
bool ReportDesignWidget::save()
{
m_report->scriptContext()->setInitScript(m_scriptEditor->toPlainText());
if (!m_report->reportFileName().isEmpty()){
if (m_report->saveToFile()){
m_report->emitSaveFinished();
@ -256,24 +288,36 @@ bool ReportDesignWidget::save()
bool ReportDesignWidget::loadFromFile(const QString &fileName)
{
if (!m_report->loadFromFile(fileName)) return false;
setActivePage(m_report->pageAt(0));
return true;
if (m_report->loadFromFile(fileName)){
createTabs();
//connectPage(m_report->pageAt(0));
m_scriptEditor->setPlainText(m_report->scriptContext()->initScript());
emit loaded();
return true;
} else {
QMessageBox::critical(this,tr("Error"),tr("Wrong file format"));
return false;
}
}
void ReportDesignWidget::scale(qreal sx, qreal sy)
{
m_view->scale(sx,sy);
//m_view->scale(sx,sy);
if (activeView()) activeView()->scale(sx,sy);
}
QString ReportDesignWidget::reportFileName()
{
return m_report->reportFileName();
if (m_report)
return m_report->reportFileName();
return QString();
}
bool ReportDesignWidget::isNeedToSave()
{
return m_report->isNeedToSave();
if(m_report)
return m_report->isNeedToSave();
return false;
}
bool ReportDesignWidget::emitLoadReport()
@ -283,82 +327,98 @@ bool ReportDesignWidget::emitLoadReport()
void ReportDesignWidget::updateSize()
{
activePage()->slotUpdateItemSize();
if (activePage())
activePage()->slotUpdateItemSize();
}
void ReportDesignWidget::undo()
{
activePage()->undo();
if (activePage())
activePage()->undo();
}
void ReportDesignWidget::redo()
{
activePage()->redo();
if (activePage())
activePage()->redo();
}
void ReportDesignWidget::copy()
{
activePage()->copy();
if (activePage())
activePage()->copy();
}
void ReportDesignWidget::paste()
{
activePage()->paste();
if (activePage())
activePage()->paste();
}
void ReportDesignWidget::cut()
{
activePage()->cut();
if (activePage())
activePage()->cut();
}
void ReportDesignWidget::brinToFront()
{
activePage()->bringToFront();
if (activePage())
activePage()->bringToFront();
}
void ReportDesignWidget::sendToBack()
{
activePage()->sendToBack();
if (activePage())
activePage()->sendToBack();
}
void ReportDesignWidget::alignToLeft()
{
activePage()->alignToLeft();
if (activePage())
activePage()->alignToLeft();
}
void ReportDesignWidget::alignToRight()
{
activePage()->alignToRigth();
if (activePage())
activePage()->alignToRigth();
}
void ReportDesignWidget::alignToVCenter()
{
activePage()->alignToVCenter();
if (activePage())
activePage()->alignToVCenter();
}
void ReportDesignWidget::alignToTop()
{
activePage()->alignToTop();
if (activePage())
activePage()->alignToTop();
}
void ReportDesignWidget::alignToBottom()
{
activePage()->alignToBottom();
if (activePage())
activePage()->alignToBottom();
}
void ReportDesignWidget::alignToHCenter()
{
activePage()->alignToHCenter();
if (activePage())
activePage()->alignToHCenter();
}
void ReportDesignWidget::sameHeight()
{
activePage()->sameHeight();
if (activePage())
activePage()->sameHeight();
}
void ReportDesignWidget::sameWidth()
{
activePage()->sameWidth();
if (activePage())
activePage()->sameWidth();
}
void ReportDesignWidget::editLayoutMode(bool value)
@ -372,22 +432,75 @@ void ReportDesignWidget::editLayoutMode(bool value)
void ReportDesignWidget::addHLayout()
{
activePage()->addHLayout();
if (activePage())
activePage()->addHLayout();
}
void ReportDesignWidget::setFont(const QFont& font)
{
activePage()->setFont(font);
if (activePage())
activePage()->setFont(font);
}
void ReportDesignWidget::setTextAlign(const bool& horizontalAlign, const Qt::AlignmentFlag& alignment)
{
activePage()->changeSelectedGrpoupTextAlignPropperty(horizontalAlign, alignment);
if (activePage())
activePage()->changeSelectedGrpoupTextAlignPropperty(horizontalAlign, alignment);
}
void ReportDesignWidget::setBorders(const BaseDesignIntf::BorderLines& borders)
{
activePage()->setBorders(borders);
if (activePage())
activePage()->setBorders(borders);
}
void ReportDesignWidget::previewReport()
{
report()->scriptContext()->setInitScript(m_scriptEditor->toPlainText());
report()->previewReport();
}
void ReportDesignWidget::printReport()
{
report()->scriptContext()->setInitScript(m_scriptEditor->toPlainText());
setCursor(Qt::WaitCursor);
report()->printReport();
setCursor(Qt::ArrowCursor);
}
void ReportDesignWidget::addPage()
{
QGraphicsView* view = new QGraphicsView(qobject_cast<QWidget*>(this));
view->setBackgroundBrush(QBrush(Qt::gray));
view->setFrameShape(QFrame::NoFrame);
PageDesignIntf* page = m_report->appendPage("page"+QString::number(m_report->pageCount()+1));
view->setScene(page);
int index = m_report->pageCount()-1;
m_tabWidget->insertTab(index,view,QIcon(),tr("Page")+QString::number(m_report->pageCount()));
m_tabWidget->setCurrentIndex(index);
connectPage(page);
view->scale(0.5,0.5);
view->centerOn(0,0);
applyUseGrid();
emit pageAdded(page);
}
void ReportDesignWidget::deleteCurrentPage()
{
if (m_report->pageCount()>1){
QGraphicsView* view = dynamic_cast<QGraphicsView*>(m_tabWidget->currentWidget());
if (view){
PageDesignIntf* page = dynamic_cast<PageDesignIntf*>(view->scene());
if (page){
if (m_report->deletePage(page)){
int index = m_tabWidget->currentIndex();
m_tabWidget->removeTab(m_tabWidget->currentIndex());
if (index>0) m_tabWidget->setCurrentIndex(index-1);
emit pageDeleted();
}
}
}
}
}
void ReportDesignWidget::editSetting()
@ -425,12 +538,16 @@ void ReportDesignWidget::setUseGrid(bool value)
bool ReportDesignWidget::isCanUndo()
{
return activePage()->isCanUndo();
if (activePage())
return activePage()->isCanUndo();
return false;
}
bool ReportDesignWidget::isCanRedo()
{
return activePage()->isCanRedo();
if (activePage())
return activePage()->isCanRedo();
return false;
}
void ReportDesignWidget::slotSelectionChanged()
@ -453,10 +570,20 @@ DataSourceManager* ReportDesignWidget::dataManager()
return m_report->dataManager();
}
ScriptEngineManager* ReportDesignWidget::scriptManager()
{
return m_report->scriptManager();
}
ScriptEngineContext*ReportDesignWidget::scriptContext()
{
return m_report->scriptContext();
}
void ReportDesignWidget::slotPagesLoadFinished()
{
applySettings();
setActivePage(m_report->pageAt(0));
//setActivePage(m_report->pageAt(0));
emit loaded();
}
@ -466,7 +593,19 @@ void ReportDesignWidget::slotDatasourceCollectionLoaded(const QString & /*collec
void ReportDesignWidget::slotSceneRectChanged(QRectF)
{
m_view->centerOn(0,0);
if (activeView()) activeView()->centerOn(0,0);
}
void ReportDesignWidget::slotCurrentTabChanged(int index)
{
QGraphicsView* view = dynamic_cast<QGraphicsView*>(m_tabWidget->widget(index));
if (view) {
if (view->scene()){
foreach (QGraphicsItem* item, view->scene()->selectedItems()) item->setSelected(false);
}
m_zoomer->setView(view);
}
emit activePageChanged();
}
bool ReportDesignWidget::eventFilter(QObject *target, QEvent *event)
@ -484,6 +623,10 @@ bool ReportDesignWidget::eventFilter(QObject *target, QEvent *event)
void ReportDesignWidget::clear()
{
m_report->clearReport();
m_tabWidget->clear();
m_report->setReportFileName("");
m_report->scriptContext()->setInitScript("");
m_scriptEditor->setPlainText("");
}
}

View File

@ -33,6 +33,7 @@
#include <QObject>
#include <QGraphicsView>
#include <QMainWindow>
#include <QTextEdit>
#include "lrpagedesignintf.h"
#include "lrdatadesignintf.h"
@ -59,6 +60,8 @@ public:
void createStartPage();
void clear();
DataSourceManager* dataManager();
ScriptEngineManager* scriptManager();
ScriptEngineContext* scriptContext();
void removeDatasource(const QString& datasourceName);
void addBand(const QString& bandType);
void addBand(BandDesignIntf::BandsType bandType);
@ -69,6 +72,7 @@ public:
bool isCanRedo();
void deleteItem(QGraphicsItem *item);
PageDesignIntf* activePage();
QGraphicsView* activeView();
QList<QGraphicsItem *> selectedItems();
QStringList datasourcesNames();
void scale( qreal sx, qreal sy);
@ -90,7 +94,7 @@ public slots:
bool save();
bool loadFromFile(const QString&);
void deleteSelectedItems();
void setActivePage(PageDesignIntf* page);
void connectPage(PageDesignIntf* page);
void undo();
void redo();
void copy();
@ -113,12 +117,17 @@ public slots:
void setBorders(const BaseDesignIntf::BorderLines& borders);
void editSetting();
void setUseGrid(bool value);
void previewReport();
void printReport();
void addPage();
void deleteCurrentPage();
private slots:
void slotItemSelected(LimeReport::BaseDesignIntf *item);
void slotSelectionChanged();
void slotPagesLoadFinished();
void slotDatasourceCollectionLoaded(const QString&);
void slotSceneRectChanged(QRectF);
void slotCurrentTabChanged(int index);
signals:
void insertModeStarted();
void itemInserted(LimeReport::PageDesignIntf*,QPointF,const QString&);
@ -135,13 +144,19 @@ signals:
void bandDeleted(LimeReport::PageDesignIntf*, LimeReport::BandDesignIntf*);
void itemAdded(LimeReport::PageDesignIntf*, LimeReport::BaseDesignIntf*);
void itemDeleted(LimeReport::PageDesignIntf*, LimeReport::BaseDesignIntf*);
void pageAdded(PageDesignIntf* page);
void pageDeleted();
protected:
void createTabs();
private:
bool eventFilter(QObject *target, QEvent *event);
ReportDesignWidget(ReportEnginePrivate* report,QMainWindow *mainWindow,QWidget *parent = 0);
private:
ReportEnginePrivate* m_report;
QGraphicsView *m_view;
QTextEdit* m_scriptEditor;
QMainWindow *m_mainWindow;
QTabWidget* m_tabWidget;
GraphicsViewZoomer* m_zoomer;
QFont m_defaultFont;
int m_verticalGridStep;

View File

@ -47,6 +47,7 @@
#include "lrbasedesignobjectmodel.h"
#include "lrreportdesignwidget.h"
#include "lrdatabrowser.h"
#include "scriptbrowser/lrscriptbrowser.h"
#include "lrbasedesignintf.h"
#include "lrpagedesignintf.h"
@ -70,6 +71,7 @@ ReportDesignWindow::ReportDesignWindow(ReportEnginePrivate *report, QWidget *par
createToolBars();
createObjectInspector();
createDataWindow();
createScriptWindow();
createObjectsBrowser();
m_instance=this;
m_statusBar=new QStatusBar(this);
@ -96,6 +98,15 @@ void ReportDesignWindow::createActions()
m_newReportAction->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_N));
connect(m_newReportAction,SIGNAL(triggered()),this,SLOT(slotNewReport()));
m_newPageAction = new QAction(tr("New Report Page"),this);
m_newPageAction->setIcon(QIcon(":/report/images/addPage"));
connect(m_newPageAction,SIGNAL(triggered()),this,SLOT(slotNewPage()));
m_deletePageAction = new QAction(tr("Delete Report Page"),this);
m_deletePageAction->setIcon(QIcon(":/report/images/deletePage"));
connect(m_deletePageAction,SIGNAL(triggered()),this,SLOT(slotDeletePage()));
m_deletePageAction->setEnabled(false);
m_editModeAction = new QAction(tr("Edit Mode"),this);
m_editModeAction->setIcon(QIcon(":/report/images/editMode"));
m_editModeAction->setCheckable(true);
@ -261,6 +272,10 @@ void ReportDesignWindow::createToolBars()
m_mainToolBar->addAction(m_settingsAction);
m_mainToolBar->addSeparator();
m_mainToolBar->addAction(m_newPageAction);
m_mainToolBar->addAction(m_deletePageAction);
m_mainToolBar->addSeparator();
m_mainToolBar->addAction(m_copyAction);
m_mainToolBar->addAction(m_pasteAction);
m_mainToolBar->addAction(m_cutAction);
@ -426,18 +441,18 @@ void ReportDesignWindow::initReportEditor(ReportEnginePrivate* report)
{
m_reportDesignWidget=new ReportDesignWidget(report,this,this);
setCentralWidget(m_reportDesignWidget);
connect(m_reportDesignWidget, SIGNAL(itemSelected(LimeReport::BaseDesignIntf*)),
this, SLOT(slotItemSelected(LimeReport::BaseDesignIntf*)));
connect(m_reportDesignWidget, SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)),
this, SLOT(slotItemPropertyChanged(QString,QString,QVariant,QVariant)));
connect(m_reportDesignWidget, SIGNAL(insertModeStarted()), this, SLOT(slotInsertModeStarted()));
connect(m_reportDesignWidget, SIGNAL(multiItemSelected()), this, SLOT(slotMultiItemSelected()));
connect(m_reportDesignWidget, SIGNAL(itemInserted(LimeReport::PageDesignIntf*,QPointF,QString)),
this, SLOT(slotItemInserted(LimeReport::PageDesignIntf*,QPointF,QString)));
connect(m_reportDesignWidget, SIGNAL(itemInsertCanceled(QString)), this, SLOT(slotItemInsertCanceled(QString)));
connect(m_reportDesignWidget->report(),SIGNAL(datasourceCollectionLoadFinished(QString)), this, SLOT(slotUpdateDataBrowser(QString)));
connect(m_reportDesignWidget, SIGNAL(commandHistoryChanged()),this,SLOT(slotCommandHistoryChanged()));
connect(m_reportDesignWidget,SIGNAL(itemSelected(LimeReport::BaseDesignIntf*)),
this,SLOT(slotItemSelected(LimeReport::BaseDesignIntf*)));
connect(m_reportDesignWidget,SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)),
this,SLOT(slotItemPropertyChanged(QString,QString,QVariant,QVariant)));
connect(m_reportDesignWidget,SIGNAL(insertModeStarted()),this,SLOT(slotInsertModeStarted()));
connect(m_reportDesignWidget,SIGNAL(multiItemSelected()),this,SLOT(slotMultiItemSelected()));
connect(m_reportDesignWidget,SIGNAL(itemInserted(LimeReport::PageDesignIntf*,QPointF,QString)),
this,SLOT(slotItemInserted(LimeReport::PageDesignIntf*,QPointF,QString)));
connect(m_reportDesignWidget,SIGNAL(itemInsertCanceled(QString)),this,SLOT(slotItemInsertCanceled(QString)));
connect(m_reportDesignWidget->report(),SIGNAL(datasourceCollectionLoadFinished(QString)),this,SLOT(slotUpdateDataBrowser(QString)));
connect(m_reportDesignWidget,SIGNAL(commandHistoryChanged()),this,SLOT(slotCommandHistoryChanged()));
connect(m_reportDesignWidget,SIGNAL(activePageChanged()),this,SLOT(slotActivePageChanged()));
connect(m_reportDesignWidget, SIGNAL(bandAdded(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)),
this, SLOT(slotBandAdded(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)));
connect(m_reportDesignWidget, SIGNAL(bandDeleted(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)),
@ -445,6 +460,8 @@ void ReportDesignWindow::initReportEditor(ReportEnginePrivate* report)
connect(m_reportDesignWidget->report(), SIGNAL(renderStarted()), this, SLOT(renderStarted()));
connect(m_reportDesignWidget->report(), SIGNAL(renderPageFinished(int)), this, SLOT(renderPageFinished(int)));
connect(m_reportDesignWidget->report(), SIGNAL(renderFinished()), this, SLOT(renderFinished()));
connect(m_reportDesignWidget, SIGNAL(pageAdded(PageDesignIntf*)), this, SLOT(slotPageAdded(PageDesignIntf*)));
connect(m_reportDesignWidget, SIGNAL(pageDeleted()), this, SLOT(slotPageDeleted()));
}
void ReportDesignWindow::createObjectInspector()
@ -496,6 +513,20 @@ void ReportDesignWindow::createDataWindow()
m_dataBrowser->setReportEditor(m_reportDesignWidget);
}
void ReportDesignWindow::createScriptWindow()
{
QDockWidget *dataDoc = new QDockWidget(this);
dataDoc->setWindowTitle(tr("Script Browser"));
m_scriptBrowser=new ScriptBrowser(dataDoc);
dataDoc->setWidget(m_scriptBrowser);
dataDoc->setObjectName("scriptDoc");
addDockWidget(Qt::LeftDockWidgetArea,dataDoc);
m_scriptBrowser->setReportEditor(m_reportDesignWidget);
#ifdef HAVE_UI_LOADER
m_scriptBrowser->updateDialogsTree();
#endif
}
void ReportDesignWindow::updateRedoUndo()
{
m_undoAction->setEnabled(m_reportDesignWidget->isCanUndo());
@ -508,6 +539,7 @@ void ReportDesignWindow::startNewReport()
m_reportDesignWidget->createStartPage();
m_lblReportName->setText("");
updateRedoUndo();
m_reportDesignWidget->slotPagesLoadFinished();
m_newPageHeader->setEnabled(true);
m_newPageFooter->setEnabled(true);
m_newReportHeader->setEnabled(true);
@ -706,7 +738,24 @@ QSettings*ReportDesignWindow::settings()
void ReportDesignWindow::slotNewReport()
{
if (checkNeedToSave()) startNewReport();
if (checkNeedToSave()) {
m_lblReportName->setText("");
startNewReport();
m_deletePageAction->setEnabled(false);
}
}
void ReportDesignWindow::slotNewPage(){
if (m_reportDesignWidget){
m_reportDesignWidget->addPage();
}
}
void ReportDesignWindow::slotDeletePage()
{
if (m_reportDesignWidget && m_reportDesignWidget->report()->pageCount()>1){
m_reportDesignWidget->deleteCurrentPage();
}
}
void ReportDesignWindow::slotNewTextItem()
@ -878,12 +927,32 @@ void ReportDesignWindow::slotLoadReport()
QApplication::processEvents();
setCursor(Qt::WaitCursor);
m_reportDesignWidget->clear();
m_reportDesignWidget->loadFromFile(fileName);
m_lblReportName->setText(fileName);
m_propertyModel->setObject(0);
updateRedoUndo();
if (m_reportDesignWidget->loadFromFile(fileName)){
m_lblReportName->setText(fileName);
m_propertyModel->setObject(0);
updateRedoUndo();
setWindowTitle(m_reportDesignWidget->report()->reportName() + " - Lime Report Designer");
if (!m_recentFiles.contains(fileName)){
if (m_recentFiles.count()==10){
QMap<QString, QDateTime>::const_iterator it = m_recentFiles.constBegin();
QDateTime minDate = QDateTime::currentDateTime();
while (it != m_recentFiles.constEnd()) {
if (minDate>it.value()) minDate = it.value();
++it;
}
m_recentFiles.remove(m_recentFiles.key(minDate));
}
m_recentFiles.insert(fileName,QDateTime::currentDateTime());
} else {
m_recentFiles[fileName] = QDateTime::currentDateTime();
}
createRecentFilesMenu();
m_deletePageAction->setEnabled(m_reportDesignWidget->report()->pageCount()>1);
} else {
slotNewReport();
}
unsetCursor();
setWindowTitle(m_reportDesignWidget->report()->reportName() + " - Lime Report Designer");
setWindowTitle(m_reportDesignWidget->report()->reportName() + " - Lime Report Designer");
addRecentFile(fileName);
}
}
@ -957,13 +1026,13 @@ void ReportDesignWindow::slotTest()
void ReportDesignWindow::slotPrintReport()
{
setCursor(Qt::WaitCursor);
m_reportDesignWidget->report()->printReport();
m_reportDesignWidget->printReport();
setCursor(Qt::ArrowCursor);
}
void ReportDesignWindow::slotPreviewReport()
{
m_reportDesignWidget->report()->previewReport();
m_reportDesignWidget->previewReport();
}
void ReportDesignWindow::slotItemActionCliked()
@ -1020,6 +1089,44 @@ void ReportDesignWindow::slotBandDeleted(PageDesignIntf *, BandDesignIntf *band)
}
}
void ReportDesignWindow::updateAvaibleBands(){
if (!m_reportDesignWidget || !m_reportDesignWidget->activePage()) return;
m_newPageHeader->setEnabled(true);
m_newPageFooter->setEnabled(true);
m_newReportHeader->setEnabled(true);
m_newReportFooter->setEnabled(true);
m_newTearOffBand->setEnabled(true);
foreach(BandDesignIntf* band, m_reportDesignWidget->activePage()->pageItem()->bands()){
switch (band->bandType()) {
case BandDesignIntf::PageHeader:
m_newPageHeader->setEnabled(false);
break;
case BandDesignIntf::PageFooter:
m_newPageFooter->setEnabled(false);
break;
case BandDesignIntf::ReportHeader:
m_newReportHeader->setEnabled(false);
break;
case BandDesignIntf::ReportFooter:
m_newReportFooter->setEnabled(false);
case BandDesignIntf::TearOffBand:
m_newTearOffBand->setEnabled(false);
default:
break;
}
}
}
void ReportDesignWindow::slotActivePageChanged()
{
m_propertyModel->setObject(0);
updateRedoUndo();
updateAvaibleBands();
}
void ReportDesignWindow::renderStarted()
{
if (m_showProgressDialog){
@ -1114,6 +1221,16 @@ void ReportDesignWindow::slotLoadRecentFile(const QString fileName)
}
}
void ReportDesignWindow::slotPageAdded(PageDesignIntf *)
{
m_deletePageAction->setEnabled(m_reportDesignWidget->report()->pageCount()>1);
}
void ReportDesignWindow::slotPageDeleted()
{
m_deletePageAction->setEnabled(m_reportDesignWidget->report()->pageCount()>1);
}
void ReportDesignWindow::closeEvent(QCloseEvent * event)
{
if (checkNeedToSave()){

View File

@ -50,6 +50,7 @@ class ObjectInspectorWidget;
class QObjectPropertyModel;
class ReportDesignWidget;
class DataBrowser;
class ScriptBrowser;
class BaseDesignIntf;
class PageDesignIntf;
class ObjectBrowser;
@ -72,6 +73,8 @@ public:
private slots:
void slotNewReport();
void slotNewPage();
void slotDeletePage();
void slotNewTextItem();
void slotNewBand(const QString& bandType);
void slotNewBand(int bandType);
@ -103,6 +106,7 @@ private slots:
void slotItemActionCliked();
void slotBandAdded(LimeReport::PageDesignIntf*, LimeReport::BandDesignIntf*band);
void slotBandDeleted(LimeReport::PageDesignIntf*, LimeReport::BandDesignIntf*band);
void slotActivePageChanged();
void renderStarted();
void renderPageFinished(int renderedPageCount);
void renderFinished();
@ -113,6 +117,8 @@ private slots:
void slotUseGrid(bool value);
void slotUseMagnet(bool value);
void slotLoadRecentFile(const QString fileName);
void slotPageAdded(PageDesignIntf* );
void slotPageDeleted();
protected:
void closeEvent(QCloseEvent *event);
void resizeEvent(QResizeEvent *);
@ -130,7 +136,9 @@ private:
void createObjectsBrowser();
void initReportEditor(ReportEnginePrivate* report);
void createDataWindow();
void createScriptWindow();
void updateRedoUndo();
void updateAvaibleBands();
void startNewReport();
void writePosition();
void writeState();
@ -174,6 +182,8 @@ private:
QAction* m_settingsAction;
QAction* m_useGridAction;
QAction* m_useMagnetAction;
QAction* m_newPageAction;
QAction* m_deletePageAction;
QAction* m_newPageHeader;
QAction* m_newPageFooter;
@ -203,6 +213,7 @@ private:
ReportDesignWidget* m_reportDesignWidget;
DataBrowser * m_dataBrowser;
ScriptBrowser* m_scriptBrowser;
ObjectBrowser* m_objectsBrowser;

View File

@ -58,9 +58,12 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) :
QObject(parent), m_fileName(""), m_settings(0), m_ownedSettings(false),
m_printer(new QPrinter(QPrinter::HighResolution)), m_printerSelected(false),
m_showProgressDialog(true), m_reportName(""), m_activePreview(0),
m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")), m_reportRendering(false)
m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")),
m_reportRendering(false), m_resultIsEditable(true), m_passPhrase("HjccbzHjlbyfCkjy")
{
m_datasources= new DataSourceManager(this);
m_datasources = new DataSourceManager(this);
m_datasources->setReportSettings(&m_reportSettings);
m_scriptEngineContext = new ScriptEngineContext(this);
m_datasources->setObjectName("datasources");
connect(m_datasources,SIGNAL(loadCollectionFinished(QString)),this,SLOT(slotDataSourceCollectionLoaded(QString)));
}
@ -104,6 +107,17 @@ PageDesignIntf *ReportEnginePrivate::appendPage(const QString &pageName)
return page;
}
bool ReportEnginePrivate::deletePage(PageDesignIntf *page){
QList<PageDesignIntf*>::iterator it = m_pages.begin();
while (it != m_pages.end()){
if (*it == page) {
it = m_pages.erase(it);
return true;
} else ++it;
}
return false;
}
PageDesignIntf *ReportEnginePrivate::createPreviewPage()
{
return createPage();
@ -154,6 +168,7 @@ void ReportEnginePrivate::clearReport()
m_pages.clear();
m_datasources->clear(DataSourceManager::Owned);
m_fileName="";
m_scriptEngineContext->clear();
m_reportSettings.setDefaultValues();
emit cleared();
}
@ -264,9 +279,44 @@ bool ReportEnginePrivate::printReport(QPrinter* printer)
printer =(printer)?printer:m_printer.data();
if (printer&&printer->isValid()){
try{
dataManager()->setDesignTime(false);
printReport(renderToPages(),*printer,PrintRange());
dataManager()->setDesignTime(false);
ReportPages pages = renderToPages();
dataManager()->setDesignTime(true);
if (pages.count()>0){
printReport(pages,*printer,PrintRange());
}
} catch(ReportError &exception){
saveError(exception.what());
}
return true;
} else return false;
}
bool ReportEnginePrivate::printPages(ReportPages pages, QPrinter *printer, PrintRange printRange)
{
if (!printer&&!m_printerSelected){
QPrintDialog dialog(m_printer.data(),QApplication::activeWindow());
m_printerSelected = dialog.exec()!=QDialog::Rejected;
if (m_printerSelected){
printRange.setRangeType(dialog.printRange());
printRange.setFromPage(dialog.fromPage());
printRange.setToPage(dialog.toPage());
}
}
if (!printer&&!m_printerSelected) return false;
printer =(printer)?printer:m_printer.data();
if (printer&&printer->isValid()){
try{
if (pages.count()>0){
printReport(
pages,
*printer,
printRange
);
}
} catch(ReportError &exception){
saveError(exception.what());
}
@ -334,6 +384,8 @@ void ReportEnginePrivate::previewReport(PreviewHints hints)
w->setToolBarVisible(!hints.testFlag(HidePreviewToolBar));
}
w->setHideResultEditButton(resultIsEditable());
m_activePreview = w;
connect(w,SIGNAL(destroyed(QObject*)), this, SLOT(slotPreviewWindowDestroed(QObject*)));
qDebug()<<"render time ="<<start.msecsTo(QTime::currentTime());
@ -412,6 +464,11 @@ void ReportEnginePrivate::cancelRender()
m_reportRendering = false;
}
PageDesignIntf* ReportEngine::createPreviewScene(QObject* parent){
Q_D(ReportEngine);
return d->createPreviewScene(parent);
}
void ReportEnginePrivate::designReport()
{
if (!m_designerWindow) {
@ -456,18 +513,34 @@ bool ReportEnginePrivate::loadFromFile(const QString &fileName)
{
if (!QFile::exists(fileName)) return false;
clearReport();
clearReport();
ItemsReaderIntf::Ptr reader = FileXMLReader::create(fileName);
reader->setPassPhrase(m_passPhrase);
if (reader->first()){
if (reader->readItem(this)){
m_fileName=fileName;
QFileInfo fi(fileName);
m_reportName = fi.fileName();
QString dbSettingFileName = fi.absolutePath()+"/"+fi.baseName()+".db";
if (QFile::exists(dbSettingFileName)){
QSettings dbcredentals(dbSettingFileName, QSettings::IniFormat);
foreach (ConnectionDesc* connection, dataManager()->conections()) {
if (!connection->keepDBCredentials()){
dbcredentals.beginGroup(connection->name());
connection->setUserName(dbcredentals.value("user").toString());
connection->setPassword(dbcredentals.value("password").toString());
dbcredentals.endGroup();
}
}
}
dataManager()->connectAutoConnections();
return true;
};
}
}
m_lastError = reader->lastError();
return false;
}
@ -475,6 +548,7 @@ bool ReportEnginePrivate::loadFromByteArray(QByteArray* data, const QString &nam
clearReport();
ItemsReaderIntf::Ptr reader = ByteArrayXMLReader::create(data);
reader->setPassPhrase(m_passPhrase);
if (reader->first()){
if (reader->readItem(this)){
m_fileName = "";
@ -490,6 +564,7 @@ bool ReportEnginePrivate::loadFromString(const QString &report, const QString &n
clearReport();
ItemsReaderIntf::Ptr reader = StringXMLreader::create(report);
reader->setPassPhrase(m_passPhrase);
if (reader->first()){
if (reader->readItem(this)){
m_fileName = "";
@ -508,10 +583,35 @@ bool ReportEnginePrivate::saveToFile(const QString &fileName)
if (fi.suffix().isEmpty())
fn+=".lrxml";
QString dbSettingFileName = fi.absolutePath()+"/"+fi.baseName()+".db";
QSettings dbcredentals(dbSettingFileName, QSettings::IniFormat);
foreach (ConnectionDesc* connection, dataManager()->conections()) {
if (!connection->keepDBCredentials()){
dbcredentals.beginGroup(connection->name());
dbcredentals.setValue("user",connection->userName());
dbcredentals.setValue("password",connection->password());
dbcredentals.endGroup();
connection->setPassword("");
connection->setUserName("");
}
}
QScopedPointer< ItemsWriterIntf > writer(new XMLWriter());
writer->setPassPhrase(m_passPhrase);
writer->putItem(this);
m_fileName=fn;
m_fileName=fn;
bool saved = writer->saveToFile(fn);
foreach (ConnectionDesc* connection, dataManager()->conections()) {
if (!connection->keepDBCredentials()){
dbcredentals.beginGroup(connection->name());
connection->setUserName(dbcredentals.value("user").toString());
connection->setPassword(dbcredentals.value("password").toString());
dbcredentals.endGroup();
}
}
if (saved){
foreach(PageDesignIntf* page, m_pages){
page->setToSaved();
@ -523,6 +623,7 @@ bool ReportEnginePrivate::saveToFile(const QString &fileName)
QByteArray ReportEnginePrivate::saveToByteArray()
{
QScopedPointer< ItemsWriterIntf > writer(new XMLWriter());
writer->setPassPhrase(m_passPhrase);
writer->putItem(this);
QByteArray result = writer->saveToByteArray();
if (!result.isEmpty()){
@ -535,6 +636,7 @@ QByteArray ReportEnginePrivate::saveToByteArray()
QString ReportEnginePrivate::saveToString(){
QScopedPointer< ItemsWriterIntf > writer(new XMLWriter());
writer->setPassPhrase(m_passPhrase);
writer->putItem(this);
QString result = writer->saveToString();
if (!result.isEmpty()){
@ -566,10 +668,26 @@ QString ReportEnginePrivate::renderToString()
dataManager()->setDesignTime(false);
if (m_pages.count()){
render.setDatasources(dataManager());
render.setScriptContext(scriptContext());
return render.renderPageToString(m_pages.at(0));
}else return QString();
}
void ReportEnginePrivate::setPassPhrase(const QString &passPhrase)
{
m_passPhrase = passPhrase;
}
bool ReportEnginePrivate::resultIsEditable() const
{
return m_resultIsEditable;
}
void ReportEnginePrivate::setResultEditable(bool value)
{
m_resultIsEditable = value;
}
bool ReportEnginePrivate::suppressFieldAndVarError() const
{
return m_reportSettings.suppressAbsentFieldsAndVarsWarnings();
@ -618,15 +736,23 @@ ReportPages ReportEnginePrivate::renderToPages()
connect(m_reportRender.data(),SIGNAL(pageRendered(int)),
this, SIGNAL(renderPageFinished(int)));
if (m_pages.count()){
ReportPages result;
m_reportRendering = true;
emit renderStarted();
m_reportRender->setDatasources(dataManager());
m_pages.at(0)->setReportSettings(&m_reportSettings);
ReportPages result = m_reportRender->renderPageToPages(m_pages.at(0));
m_reportRender->setScriptContext(scriptContext());
foreach(PageDesignIntf* page , m_pages){
m_pages.at(0)->setReportSettings(&m_reportSettings);
result.append(m_reportRender->renderPageToPages(page));
}
m_reportRender->secondRenderPass(result);
emit renderFinished();
m_reportRender.clear();
m_reportRendering = false;
return result;
}else {
} else {
return ReportPages();
}
}
@ -661,6 +787,11 @@ bool ReportEngine::printReport(QPrinter *printer)
return d->printReport(printer);
}
bool ReportEngine::printPages(ReportPages pages, QPrinter *printer, PrintRange printRange){
Q_D(ReportEngine);
return d->printPages(pages,printer, printRange);
}
void ReportEngine::printToFile(const QString &fileName)
{
Q_D(ReportEngine);
@ -707,12 +838,30 @@ void ReportEngine::setPreviewWindowIcon(const QIcon &icon)
d->setPreviewWindowIcon(icon);
}
void ReportEngine::setResultEditable(bool value)
{
Q_D(ReportEngine);
d->setResultEditable(value);
}
bool ReportEngine::resultIsEditable()
{
Q_D(ReportEngine);
return d->resultIsEditable();
}
bool ReportEngine::isBusy()
{
Q_D(ReportEngine);
return d->isBusy();
}
void ReportEngine::setPassPharse(QString &passPharse)
{
Q_D(ReportEngine);
d->setPassPhrase(passPharse);
}
void ReportEngine::setShowProgressDialog(bool value)
{
Q_D(ReportEngine);

View File

@ -60,6 +60,10 @@ private:
class DataSourceManager;
class ReportEnginePrivate;
class PageDesignIntf;
class PageItemDesignIntf;
typedef QList< QSharedPointer<PageItemDesignIntf> > ReportPages;
class LIMEREPORT_EXPORT ReportEngine : public QObject{
Q_OBJECT
@ -69,7 +73,9 @@ public:
explicit ReportEngine(QObject *parent = 0);
~ReportEngine();
bool printReport(QPrinter *printer=0);
bool printPages(ReportPages pages, QPrinter *printer, PrintRange printRange = PrintRange());
void printToFile(const QString& fileName);
PageDesignIntf *createPreviewScene(QObject *parent = 0);
bool printToPDF(const QString& fileName);
void previewReport(PreviewHints hints = PreviewBarsUserSetting);
void designReport();
@ -92,7 +98,10 @@ public:
PreviewReportWidget *createPreviewWidget(QWidget *parent = 0);
void setPreviewWindowTitle(const QString& title);
void setPreviewWindowIcon(const QIcon& icon);
void setResultEditable(bool value);
bool resultIsEditable();
bool isBusy();
void setPassPharse(QString& passPharse);
signals:
void renderStarted();
void renderFinished();

View File

@ -55,7 +55,8 @@ class ReportEnginePrivate : public QObject, public ICollectionContainer
Q_OBJECT
Q_DECLARE_PUBLIC(ReportEngine)
Q_PROPERTY(ACollectionProperty pages READ fakeCollectionReader())
Q_PROPERTY(QObject* datasourcesManager READ dataManager())
Q_PROPERTY(QObject* datasourcesManager READ dataManager)
Q_PROPERTY(QObject* scriptContext READ scriptContext)
Q_PROPERTY(bool suppressFieldAndVarError READ suppressFieldAndVarError WRITE setSuppressFieldAndVarError)
friend class PreviewReportWidget;
public:
@ -64,12 +65,16 @@ public:
public:
explicit ReportEnginePrivate(QObject *parent = 0);
virtual ~ReportEnginePrivate();
PageDesignIntf* appendPage(const QString &pageName = "");
PageDesignIntf* createPreviewPage();
PageDesignIntf* pageAt(int index){return (index<=(m_pages.count()-1)) ? m_pages.at(index):0;}
int pageCount() {return m_pages.count();}
DataSourceManager* dataManager(){return m_datasources;}
IDataSourceManager* dataManagerIntf(){return m_datasources;}
PageDesignIntf* appendPage(const QString& pageName="");
bool deletePage(PageDesignIntf *page);
PageDesignIntf* createPreviewPage();
PageDesignIntf* pageAt(int index){return (index<=(m_pages.count()-1)) ? m_pages.at(index):0;}
int pageCount() {return m_pages.count();}
DataSourceManager* dataManager(){return m_datasources;}
ScriptEngineContext* scriptContext(){return m_scriptEngineContext;}
ScriptEngineManager* scriptManager(){return &ScriptEngineManager::instance();}
IDataSourceManager* dataManagerIntf(){return m_datasources;}
IScriptEngineManager* scriptManagerIntf(){
ScriptEngineManager::instance().setDataManager(dataManager());
@ -78,6 +83,7 @@ public:
void clearReport();
bool printReport(QPrinter *printer=0);
bool printPages(ReportPages pages, QPrinter *printer, PrintRange printRange = PrintRange());
void printToFile(const QString& fileName);
bool printToPDF(const QString& fileName);
void previewReport(PreviewHints hints = PreviewBarsUserSetting);
@ -116,6 +122,11 @@ public:
bool suppressFieldAndVarError() const;
void setSuppressFieldAndVarError(bool suppressFieldAndVarError);
bool isBusy();
bool resultIsEditable() const;
void setResultEditable(bool value);
void setPassPhrase(const QString &passPhrase);
signals:
void pagesLoadFinished();
void datasourceCollectionLoadFinished(const QString& collectionName);
@ -148,6 +159,7 @@ private:
private:
QList<PageDesignIntf*> m_pages;
DataSourceManager* m_datasources;
ScriptEngineContext* m_scriptEngineContext;
ReportRender::Ptr m_reportRender;
QString m_fileName;
QString m_lastError;
@ -164,6 +176,8 @@ private:
QPointer<ReportDesignWindow> m_designerWindow;
ReportSettings m_reportSettings;
bool m_reportRendering;
bool m_resultIsEditable;
QString m_passPhrase;
};
}

View File

@ -156,13 +156,37 @@ ReportRender::ReportRender(QObject *parent)
void ReportRender::setDatasources(DataSourceManager *value)
{
m_datasources=value;
initVariables();
resetPageNumber(BandReset);
}
void ReportRender::setScriptContext(ScriptEngineContext* scriptContext)
{
m_scriptEngineContext=scriptContext;
}
bool ReportRender::runInitScript(){
if (m_scriptEngineContext){
QScriptEngine* engine = ScriptEngineManager::instance().scriptEngine();
engine->pushContext();
QScriptValue res = engine->evaluate(m_scriptEngineContext->initScript());
if (res.isBool()) return res.toBool();
if (engine->hasUncaughtException()) {
QMessageBox::critical(0,tr("Error"),
QString("Line %1: %2 ").arg(engine->uncaughtExceptionLineNumber())
.arg(engine->uncaughtException().toString())
);
return false;
}
}
return true;
}
void ReportRender::initDatasources(){
try{
datasources()->setAllDatasourcesToFirst();
} catch(ReportError &exception){
//TODO posible should thow exeption
//TODO possible should thow exeption
QMessageBox::critical(0,tr("Error"),exception.what());
return;
}
@ -185,42 +209,69 @@ void ReportRender::renderPage(PageDesignIntf* patternPage)
{
m_curentNameIndex = 0;
m_patternPageItem = patternPage->pageItem();
m_pageCount = 1;
if (m_patternPageItem->resetPageNumber() && m_pageCount>0) {
resetPageNumber(PageReset);
}
m_renderCanceled = false;
BandDesignIntf* reportFooter = m_patternPageItem->bandByType(BandDesignIntf::ReportFooter);
m_reportFooterHeight = 0;
if (reportFooter)
m_reportFooterHeight = reportFooter->height();
initVariables();
initGroups();
#ifdef HAVE_UI_LOADER
initDialogs();
#endif
clearPageMap();
resetPageNumber();
startNewPage();
renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader),StartNewPageAsNeeded);
BandDesignIntf* lastRenderedBand = 0;
for (int i=0;i<m_patternPageItem->dataBandCount() && !m_renderCanceled;i++){
lastRenderedBand = m_patternPageItem->dataBandAt(i);
initDatasource(lastRenderedBand->datasourceName());
renderDataBand(lastRenderedBand);
if (i<m_patternPageItem->dataBandCount()-1) closeFooterGroup(lastRenderedBand);
if (m_scriptEngineContext){
baseDesignIntfToScript(patternPage->pageItem());
foreach (BaseDesignIntf* item, patternPage->pageItem()->childBaseItems()){
baseDesignIntfToScript(item);
}
}
if (reportFooter)
renderBand(reportFooter,StartNewPageAsNeeded);
if (lastRenderedBand && lastRenderedBand->keepFooterTogether())
closeFooterGroup(lastRenderedBand);
if (runInitScript()){
BandDesignIntf* tearOffBand = m_patternPageItem->bandByType(BandDesignIntf::TearOffBand);
if (tearOffBand)
renderBand(tearOffBand,StartNewPageAsNeeded);
clearPageMap();
savePage(true);
if (!m_renderCanceled)
secondRenderPass();
try{
datasources()->setAllDatasourcesToFirst();
datasources()->clearGroupFuntionsExpressions();
} catch(ReportError &exception){
//TODO possible should thow exeption
QMessageBox::critical(0,tr("Error"),exception.what());
return;
}
clearPageMap();
startNewPage();
renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader), 0, StartNewPageAsNeeded);
BandDesignIntf* lastRenderedBand = 0;
for (int i=0;i<m_patternPageItem->dataBandCount() && !m_renderCanceled;i++){
lastRenderedBand = m_patternPageItem->dataBandAt(i);
initDatasource(lastRenderedBand->datasourceName());
renderDataBand(lastRenderedBand);
if (i<m_patternPageItem->dataBandCount()-1) closeFooterGroup(lastRenderedBand);
}
if (reportFooter)
renderBand(reportFooter, 0, StartNewPageAsNeeded);
if (lastRenderedBand && lastRenderedBand->keepFooterTogether())
closeFooterGroup(lastRenderedBand);
BandDesignIntf* tearOffBand = m_patternPageItem->bandByType(BandDesignIntf::TearOffBand);
if (tearOffBand)
renderBand(tearOffBand, 0, StartNewPageAsNeeded);
savePage(true);
ScriptEngineManager::instance().scriptEngine()->popContext();
}
}
int ReportRender::pageCount()
@ -230,7 +281,7 @@ int ReportRender::pageCount()
PageItemDesignIntf::Ptr ReportRender::pageAt(int index)
{
if ((index>m_renderedPages.count()-1)||(index<0)) throw ReportError("page index out of range");
if ((index>m_renderedPages.count()-1)||(index<0)) throw ReportError(tr("page index out of range"));
else return m_renderedPages.at(index);
}
@ -252,6 +303,7 @@ void ReportRender::initRenderPage()
m_renderPageItem = new PageItemDesignIntf(m_patternPageItem->pageSize(), m_patternPageItem->pageRect());
m_renderPageItem->initFromItem(m_patternPageItem);
m_renderPageItem->setItemMode(PreviewMode);
m_renderPageItem->setPatternName(m_patternPageItem->objectName());
}
}
@ -261,6 +313,18 @@ void ReportRender::initVariables()
m_datasources->setReportVariable("#PAGE_COUNT",0);
}
#ifdef HAVE_UI_LOADER
void ReportRender::initDialogs(){
if (m_scriptEngineContext){
QScriptEngine* se = ScriptEngineManager::instance().scriptEngine();
foreach(DialogDescriber::Ptr dialog, m_scriptEngineContext->dialogsDescriber()){
QScriptValue sv = se->newQObject(m_scriptEngineContext->getDialog(dialog->name()));
se->globalObject().setProperty(dialog->name(),sv);
}
}
}
#endif
void ReportRender::clearPageMap()
{
m_renderedPages.clear();
@ -309,7 +373,8 @@ void ReportRender::replaceGroupsFunction(BandDesignIntf *band)
if (rx.indexIn(content)>=0){
int pos = 0;
while ( (pos = rx.indexIn(content,pos))!= -1 ){
content.replace(rx.capturedTexts().at(0),QString("%1(%2,%3)").arg(functionName).arg('"'+rx.cap(4)+'"').arg('"'+band->objectName()+'"'));
QString expressionIndex = datasources()->putGroupFunctionsExpressions(rx.cap(Const::VALUE_INDEX));
content.replace(rx.capturedTexts().at(0),QString("%1(%2,%3)").arg(functionName).arg('"'+expressionIndex+'"').arg('"'+band->objectName()+'"'));
pos += rx.matchedLength();
}
contentItem->setContent(content);
@ -319,11 +384,19 @@ void ReportRender::replaceGroupsFunction(BandDesignIntf *band)
}
}
void ReportRender::renderBand(BandDesignIntf *patternBand, ReportRender::DataRenderMode mode, bool isLast)
BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesignIntf* bandData, ReportRender::DataRenderMode mode, bool isLast)
{
QApplication::processEvents();
if (patternBand){
BandDesignIntf* bandClone = 0;
if (bandData){
bandClone = bandData;
} else {
bandClone=renderData(patternBand);
}
if (mode == ForcedStartPage){
savePage();
startNewPage();
@ -332,14 +405,16 @@ void ReportRender::renderBand(BandDesignIntf *patternBand, ReportRender::DataRen
if (patternBand->isFooter())
m_lastRenderedFooter = patternBand;
BandDesignIntf* bandClone=renderData(patternBand);
bandClone->setBackgroundColor(
(datasources()->variable(QLatin1String("line_")+patternBand->objectName().toLower()).toInt()%2!=0 ?
patternBand->backgroundColor():
patternBand->alternateBackgroundColor()
bandClone->backgroundColor():
bandClone->alternateBackgroundColor()
)
);
patternBand->emitBandRendered(bandClone);
emit(patternBand->afterRender());
if ( isLast && bandClone->keepFooterTogether() && bandClone->sliceLastRow() ){
if (m_maxHeightByColumn[m_currentColumn] < (bandClone->height()+m_reportFooterHeight))
@ -384,10 +459,16 @@ void ReportRender::renderBand(BandDesignIntf *patternBand, ReportRender::DataRen
}
}
}
} else {delete bandClone;}
} else {
delete bandClone;
return 0;
}
if (patternBand->isFooter())
datasources()->clearGroupFunctionValues(patternBand->objectName());
return bandClone;
}
return 0;
}
void ReportRender::renderDataBand(BandDesignIntf *dataBand)
@ -400,7 +481,7 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand)
BandDesignIntf* header = dataBand->bandHeader();
BandDesignIntf* footer = dataBand->bandFooter();
if (header && header->printAlways()) renderBand(header);
if (header && header->printAlways()) renderBand(header, 0);
if(bandDatasource && !bandDatasource->eof() && !m_renderCanceled){
@ -408,7 +489,7 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand)
datasources()->setReportVariable(varName,1);
if (header && !header->printAlways())
renderBand(header);
renderBand(header, 0);
if (dataBand->bandHeader() && dataBand->bandHeader()->reprintOnEachPage())
m_reprintableBands.append(dataBand->bandHeader());
@ -418,28 +499,35 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand)
bool firstTime = true;
while(!bandDatasource->eof() && !m_renderCanceled){
if ((firstTime && dataBand->startFromNewPage()) ||
(!firstTime && dataBand->startNewPage())) {
savePage();
startNewPage();
BandDesignIntf* rawData = renderData(dataBand);
if (!rawData->isEmpty() || dataBand->printIfEmpty()){
if ((firstTime && dataBand->startFromNewPage()) ||
(!firstTime && dataBand->startNewPage())) {
savePage();
startNewPage();
}
if (dataBand->tryToKeepTogether()) openDataGroup(dataBand);
if (dataBand->keepFooterTogether() && !bandDatasource->hasNext())
openFooterGroup(dataBand);
datasources()->updateChildrenData(dataBand->datasourceName());
m_lastDataBand = dataBand;
if (header && !firstTime && header->repeatOnEachRow())
renderBand(header, 0, StartNewPageAsNeeded);
renderBand(dataBand, rawData, StartNewPageAsNeeded, !bandDatasource->hasNext());
renderChildBands(dataBand);
}
if (dataBand->tryToKeepTogether()) openDataGroup(dataBand);
if (dataBand->keepFooterTogether() && !bandDatasource->hasNext())
openFooterGroup(dataBand);
datasources()->updateChildrenData(dataBand->datasourceName());
m_lastDataBand = dataBand;
if (header && !firstTime && header->repeatOnEachRow())
renderBand(header,StartNewPageAsNeeded);
renderBand(dataBand,StartNewPageAsNeeded,!bandDatasource->hasNext());
renderChildBands(dataBand);
bandDatasource->next();
datasources()->setReportVariable(varName,datasources()->variable(varName).toInt()+1);
@ -459,16 +547,16 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand)
renderGroupFooter(dataBand);
if (footer && !footer->printAlways())
renderBand(footer,StartNewPageAsNeeded);
renderBand(footer, 0, StartNewPageAsNeeded);
datasources()->deleteVariable(varName);
} else if (bandDatasource==0) {
renderBand(dataBand,StartNewPageAsNeeded);
renderBand(dataBand, 0, StartNewPageAsNeeded);
}
if (footer && footer->printAlways())
renderBand(footer,StartNewPageAsNeeded);
renderBand(footer, 0, StartNewPageAsNeeded);
}
void ReportRender::renderPageHeader(PageItemDesignIntf *patternPage)
@ -478,7 +566,7 @@ void ReportRender::renderPageHeader(PageItemDesignIntf *patternPage)
if (m_datasources->variable("#PAGE").toInt()!=1 ||
band->property("printOnFirstPage").toBool()
)
renderBand(band);
renderBand(band, 0);
}
}
@ -500,15 +588,21 @@ void ReportRender::renderPageFooter(PageItemDesignIntf *patternPage)
void ReportRender::renderPageItems(PageItemDesignIntf* patternPage)
{
QList<BaseDesignIntf*> pageItems;
foreach (BaseDesignIntf* item, patternPage->childBaseItems()) {
ItemDesignIntf* id = dynamic_cast<ItemDesignIntf*>(item);
if (id&&id->itemLocation()==ItemDesignIntf::Page){
BaseDesignIntf* cloneItem = item->cloneItem(m_renderPageItem->itemMode(),
m_renderPageItem,
m_renderPageItem);
cloneItem->updateItemSize(m_datasources);
pageItems.append(cloneItem);
//cloneItem->updateItemSize(m_datasources);
}
}
m_renderPageItem->restoreLinks();
foreach(BaseDesignIntf* item, pageItems){
item->updateItemSize(m_datasources);
}
}
qreal ReportRender::calcPageFooterHeight(PageItemDesignIntf *patternPage)
@ -530,7 +624,7 @@ void ReportRender::renderChildHeader(BandDesignIntf *parent, BandPrintMode print
if (band->metaObject()->indexOfProperty("printAlways")>0){
printAlways=band->property("printAlways").toBool();
}
if (printAlways == (printMode==PrintAlwaysPrintable) ) renderBand(band,StartNewPageAsNeeded);
if (printAlways == (printMode==PrintAlwaysPrintable) ) renderBand(band, 0, StartNewPageAsNeeded);
}
}
@ -543,14 +637,16 @@ void ReportRender::renderChildFooter(BandDesignIntf *parent, BandPrintMode print
}
if ( (band != m_lastRenderedFooter) && (printAlways == (printMode == PrintAlwaysPrintable)) )
renderBand(band,StartNewPageAsNeeded);
renderBand(band, 0, StartNewPageAsNeeded);
}
}
void ReportRender::renderChildBands(BandDesignIntf *parentBand)
{
foreach(BandDesignIntf* band,parentBand->childrenByType(BandDesignIntf::SubDetailBand)){
IDataSource* ds = m_datasources->dataSource(band->datasourceName());
IDataSource* ds = 0;
if (!band->datasourceName().isEmpty())
ds = m_datasources->dataSource(band->datasourceName());
if (ds) ds->first();
renderChildHeader(band,PrintAlwaysPrintable);
renderDataBand(band);
@ -568,18 +664,22 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da
dataSource->prior();
foreach (BandDesignIntf* subBand, band->childrenByType(BandDesignIntf::GroupHeader)) {
foreach(BandDesignIntf* footer, subBand->childrenByType(BandDesignIntf::GroupFooter)){
renderBand(footer);
renderBand(footer, 0);
closeDataGroup(subBand);
}
}
foreach (BandDesignIntf* footer, band->childrenByType(BandDesignIntf::GroupFooter)) {
renderBand(footer,StartNewPageAsNeeded);
renderBand(footer, 0, StartNewPageAsNeeded);
}
dataSource->next();
}
closeDataGroup(band);
// if (gb->isNeedToStartNewPage()){
// savePage();
// startNewPage();
// }
}
if (!gb->isStarted()){
@ -588,10 +688,10 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da
gb->startGroup(m_datasources);
openDataGroup(band);
if (!firstTime && gb->startNewPage()){
if (gb->resetPageNumber()) resetPageNumber();
renderBand(band,ForcedStartPage);
if (gb->resetPageNumber()) resetPageNumber(BandReset);
renderBand(band, 0, ForcedStartPage);
} else {
renderBand(band,StartNewPageAsNeeded);
renderBand(band, 0, StartNewPageAsNeeded);
}
}
@ -606,7 +706,7 @@ void ReportRender::renderGroupFooter(BandDesignIntf *parentBand)
if (gb && gb->isStarted()){
if (band->reprintOnEachPage()) m_reprintableBands.removeOne(band);
if (band->childBands().count()>0){
renderBand(band->childBands().at(0),StartNewPageAsNeeded);
renderBand(band->childBands().at(0), 0, StartNewPageAsNeeded);
}
closeDataGroup(band);
}
@ -844,14 +944,17 @@ BandDesignIntf* ReportRender::sliceBand(BandDesignIntf *band, BandDesignIntf* pa
}
void ReportRender::secondRenderPass()
void ReportRender::secondRenderPass(ReportPages renderedPages)
{
for(int i=0; i<m_renderedPages.count(); ++i){
PageItemDesignIntf::Ptr page = m_renderedPages.at(i);
for(int i=0; i<renderedPages.count(); ++i){
PageItemDesignIntf::Ptr page = renderedPages.at(i);
m_datasources->setReportVariable("#PAGE_COUNT",findLastPageNumber(i));
foreach(BandDesignIntf* band, page->childBands()){
band->updateItemSize(m_datasources, SecondPass);
foreach(BaseDesignIntf* item, page->childBaseItems()){
item->updateItemSize(m_datasources, SecondPass);
}
// foreach(BandDesignIntf* band, page->childBands()){
// band->updateItemSize(m_datasources, SecondPass);
// }
}
}
@ -887,10 +990,18 @@ BandDesignIntf *ReportRender::saveUppperPartReturnBottom(BandDesignIntf *band, i
BandDesignIntf *ReportRender::renderData(BandDesignIntf *patternBand)
{
BandDesignIntf* bandClone = dynamic_cast<BandDesignIntf*>(patternBand->cloneItem(PreviewMode));
baseDesignIntfToScript(bandClone);
emit(patternBand->beforeRender());
if (patternBand->isFooter()){
replaceGroupsFunction(bandClone);
}
bandClone->updateItemSize(m_datasources);
baseDesignIntfToScript(bandClone);
emit(patternBand->afterData());
return bandClone;
}
@ -911,45 +1022,53 @@ void ReportRender::startNewPage()
initColumns();
initRenderPage();
baseDesignIntfToScript(m_renderPageItem);
m_renderPageItem->setObjectName(QLatin1String("ReportPage")+QString::number(m_pageCount));
m_maxHeightByColumn[m_currentColumn]=m_renderPageItem->pageRect().height();
m_currentStartDataPos[m_currentColumn]=m_patternPageItem->topMargin()*Const::mmFACTOR;
m_currentIndex=0;
emit m_patternPageItem->beforeRender();
renderPageHeader(m_patternPageItem);
m_pageFooterHeight = calcPageFooterHeight(m_patternPageItem);
m_maxHeightByColumn[m_currentColumn] -= m_pageFooterHeight;
m_currentIndex=10;
m_dataAreaSize = m_maxHeightByColumn[m_currentColumn];
m_renderedDataBandCount = 0;
foreach (BandDesignIntf* band, m_reprintableBands) {
renderBand(band);
}
checkLostHeadersOnPrevPage();
foreach (BandDesignIntf* band, m_reprintableBands) {
renderBand(band, 0);
}
checkLostHeadersOnPrevPage();
pasteGroups();
renderPageItems(m_patternPageItem);
}
void ReportRender::resetPageNumber()
void ReportRender::resetPageNumber(ResetPageNuberType resetType)
{
PagesRange range;
if (!m_ranges.isEmpty()){
m_ranges.last().lastPage = m_pageCount;
range.firstPage = m_pageCount+1;
m_ranges.last().lastPage = (resetType == BandReset)? m_pageCount : m_pageCount-1;
range.firstPage = m_pageCount+((resetType == BandReset)? 1 : 0);
} else {
range.firstPage = m_pageCount;
}
range.lastPage = 0;
range.lastPage = (resetType == BandReset)? 0 : m_pageCount;
m_ranges.append(range);
if (resetType == PageReset)
m_datasources->setReportVariable("#PAGE",1);
}
int ReportRender::findLastPageNumber(int currentPage)
{
foreach (PagesRange range, m_ranges) {
if ( range.firstPage<= (currentPage+1) && range.lastPage>= (currentPage+1) )
return range.lastPage-(range.firstPage-1);
if ( range.firstPage<= (currentPage) && range.lastPage>= (currentPage) )
return (range.lastPage-(range.firstPage))+1;
}
return 0;
}
@ -1087,9 +1206,9 @@ void ReportRender::savePage(bool isLast)
BandDesignIntf* pageFooter = m_renderPageItem->bandByType(BandDesignIntf::PageFooter);
if (pageFooter) pageFooter->setBandIndex(++m_currentIndex);
m_renderedPages.append(PageItemDesignIntf::Ptr(m_renderPageItem));
emit pageRendered(m_pageCount);
m_pageCount++;
emit pageRendered(m_pageCount);
if (isLast){
BandDesignIntf* ph = m_renderPageItem->bandByType(BandDesignIntf::PageHeader);
if (ph && !ph->property("printOnLastPage").toBool()){
@ -1098,6 +1217,8 @@ void ReportRender::savePage(bool isLast)
}
moveTearOffBand();
emit m_patternPageItem->afterRender();
}
QString ReportRender::toString()
@ -1117,4 +1238,29 @@ void ReportRender::cancelRender(){
m_renderCanceled = true;
}
void ReportRender::baseDesignIntfToScript(BaseDesignIntf *item)
{
if ( item ) {
if (item->metaObject()->indexOfSignal("beforeRender()")!=-1)
item->disconnect(SIGNAL(beforeRender()));
if (item->metaObject()->indexOfSignal("afterData()")!=-1)
item->disconnect(SIGNAL(afterData()));
if (item->metaObject()->indexOfSignal("afterRender()")!=-1)
item->disconnect(SIGNAL(afterRender()));
QScriptEngine* engine = ScriptEngineManager::instance().scriptEngine();
QScriptValue sItem = engine->globalObject().property(item->patternName());
if (sItem.isValid()){
engine->newQObject(sItem, item);
} else {
sItem = engine->newQObject(item);
engine->globalObject().setProperty(item->patternName(),sItem);
}
foreach(BaseDesignIntf* child, item->childBaseItems()){
baseDesignIntfToScript(child);
}
}
}
}

View File

@ -33,6 +33,7 @@
#include "lrcollection.h"
#include "lrdatasourcemanager.h"
#include "lrpageitemdesignintf.h"
#include "lrscriptenginemanager.h"
#include "serializators/lrstorageintf.h"
namespace LimeReport{
@ -55,7 +56,6 @@ private:
bool m_footerGroup;
};
typedef QList<PageItemDesignIntf::Ptr> ReportPages;
struct PagesRange{
int firstPage;
@ -69,27 +69,37 @@ class ReportRender: public QObject
public:
enum DataRenderMode {StartNewPageAsNeeded, NotStartNewPage, ForcedStartPage};
enum BandPrintMode {PrintAlwaysPrintable, PrintNotAlwaysPrintable };
enum ResetPageNuberType{BandReset, PageReset};
typedef QSharedPointer<ReportRender> Ptr;
~ReportRender();
ReportRender(QObject *parent = 0);
void setDatasources(DataSourceManager* value);
void setScriptContext(ScriptEngineContext* scriptContext);
DataSourceManager* datasources(){return m_datasources;}
int pageCount();
PageItemDesignIntf::Ptr pageAt(int index);
QString renderPageToString(PageDesignIntf *patternPage);
ReportPages renderPageToPages(PageDesignIntf *patternPage);
void secondRenderPass(ReportPages renderedPages);
signals:
void pageRendered(int renderedPageCount);
public slots:
void cancelRender();
private:
void baseDesignIntfToScript(BaseDesignIntf* item);
void renderPage(PageDesignIntf *patternPage);
void initDatasources();
void initDatasource(const QString &name);
void initRenderPage();
#ifdef HAVE_UI_LOADER
void initDialogs();
#endif
void initVariables();
bool runInitScript();
void clearPageMap();
void renderBand(BandDesignIntf *patternBand, DataRenderMode mode = NotStartNewPage, bool isLast = false);
BandDesignIntf* renderBand(BandDesignIntf *patternBand, BandDesignIntf *bandData, DataRenderMode mode = NotStartNewPage, bool isLast = false);
void renderDataBand(BandDesignIntf* dataBand);
void renderPageHeader(PageItemDesignIntf* patternPage);
void renderPageFooter(PageItemDesignIntf* patternPage);
@ -124,12 +134,12 @@ private:
BandDesignIntf* findEnclosingGroup();
bool registerBand(BandDesignIntf* band, bool registerInChildren=true);
BandDesignIntf *sliceBand(BandDesignIntf* band, BandDesignIntf *patternBand, bool isLast);
void secondRenderPass();
BandDesignIntf* saveUppperPartReturnBottom(BandDesignIntf *band, int height, BandDesignIntf *patternBand);
BandDesignIntf* renderData(BandDesignIntf* patternBand);
void startNewColumn();
void startNewPage();
void resetPageNumber();
void resetPageNumber(ResetPageNuberType resetType);
int findLastPageNumber(int currentPage);
void savePage(bool isLast = false);
QString toString();
@ -143,6 +153,7 @@ private:
void renameChildItems(BaseDesignIntf *item);
private:
DataSourceManager* m_datasources;
ScriptEngineContext* m_scriptEngineContext;
PageItemDesignIntf* m_renderPageItem;
PageItemDesignIntf* m_patternPageItem;
QList<PageItemDesignIntf::Ptr> m_renderedPages;

View File

@ -32,6 +32,11 @@
#include <QDate>
#include <QStringList>
#include <QScriptValueIterator>
#ifdef HAVE_UI_LOADER
#include <QUiLoader>
#include <QBuffer>
#include <QWidget>
#endif
#include "lrdatasourcemanager.h"
Q_DECLARE_METATYPE(QColor)
@ -215,6 +220,28 @@ QScriptValue setVariable(QScriptContext* pcontext, QScriptEngine* /*pengine*/){
return QScriptValue();
}
QScriptValue getVariable(QScriptContext* pcontext, QScriptEngine* pengine){
QString name = pcontext->argument(0).toString();
ScriptEngineManager* sm = qscriptvalue_cast<ScriptEngineManager*>(pcontext->callee().data());
DataSourceManager* dm = sm->dataManager();
QScriptValue res = pengine->newVariant(dm->variable(name));
return res;
}
QScriptValue getField(QScriptContext* pcontext, QScriptEngine* pengine){
QString name = pcontext->argument(0).toString();
ScriptEngineManager* sm = qscriptvalue_cast<ScriptEngineManager*>(pcontext->callee().data());
DataSourceManager* dm = sm->dataManager();
QScriptValue res = pengine->newVariant(dm->fieldData(name));
return res;
}
QScriptValue numberFormat(QScriptContext* pcontext, QScriptEngine* pengine){
QVariant value = pcontext->argument(0).toVariant();
char format = (pcontext->argumentCount()>1)?pcontext->argument(1).toString()[0].toLatin1():'f';
@ -275,8 +302,17 @@ QScriptValue callGroupFunction(const QString& functionName, QScriptContext* pcon
ScriptEngineManager* sm = qscriptvalue_cast<ScriptEngineManager*>(pcontext->callee().data());
DataSourceManager* dm = sm->dataManager();
QString expression = pcontext->argument(0).toString();
QString band = pcontext->argument(1).toString();
QString expression;
QString band;
if (functionName.compare("COUNT",Qt::CaseInsensitive) == 0 && pcontext->argumentCount()==1){
expression = " ";
band = pcontext->argument(0).toString();
} else {
expression = dm->getExpression(pcontext->argument(0).toString());
band = pcontext->argument(1).toString();
}
QScriptValue res;
GroupFunction* gf = dm->groupFunction(functionName,expression,band);
if (gf){
@ -391,7 +427,7 @@ void ScriptEngineManager::setDataManager(DataSourceManager *dataManager){
if (m_dataManager){
foreach(QString func, m_dataManager->groupFunctionNames()){
if (isFunctionExists(func)) deleteFunction(func);
addFunction(func, groupFunction,"GROUP FUNCTIONS", func+"(\""+tr("FieldName")+"\",\""+tr("BandName")+"\")");
addFunction(func, groupFunction,"GROUP FUNCTIONS", func+"(\""+tr("Value")+"\",\""+tr("BandName")+"\")");
}
foreach(ScriptFunctionDesc func, m_functions){
if (func.type==ScriptFunctionDesc::Native)
@ -401,6 +437,172 @@ void ScriptEngineManager::setDataManager(DataSourceManager *dataManager){
}
}
QString ScriptEngineManager::expandUserVariables(QString context, RenderPass pass, ExpandType expandType, QVariant &varValue)
{
QRegExp rx(Const::VARIABLE_RX);
if (context.contains(rx)){
int pos = 0;
while ((pos = rx.indexIn(context,pos))!=-1){
QString variable=rx.cap(1);
pos += rx.matchedLength();
if (dataManager()->containsVariable(variable) ){
try {
if (pass==dataManager()->variablePass(variable)){
varValue = dataManager()->variable(variable);
switch (expandType){
case EscapeSymbols:
context.replace(rx.cap(0),escapeSimbols(varValue.toString()));
break;
case NoEscapeSymbols:
context.replace(rx.cap(0),varValue.toString());
break;
case ReplaceHTMLSymbols:
context.replace(rx.cap(0),replaceHTMLSymbols(varValue.toString()));
break;
}
pos=0;
}
} catch (ReportError e){
dataManager()->putError(e.what());
if (!dataManager()->reportSettings() || dataManager()->reportSettings()->suppressAbsentFieldsAndVarsWarnings())
context.replace(rx.cap(0),e.what());
else
context.replace(rx.cap(0),"");
}
} else {
QString error;
error = tr("Variable %1 not found").arg(variable);
dataManager()->putError(error);
if (!dataManager()->reportSettings() || dataManager()->reportSettings()->suppressAbsentFieldsAndVarsWarnings())
context.replace(rx.cap(0),error);
else
context.replace(rx.cap(0),"");
}
}
}
return context;
}
QString ScriptEngineManager::expandDataFields(QString context, ExpandType expandType, QVariant &varValue, QObject *reportItem)
{
QRegExp rx(Const::FIELD_RX);
if (context.contains(rx)){
while ((rx.indexIn(context))!=-1){
QString field=rx.cap(1);
if (dataManager()->containsField(field)) {
QString fieldValue;
varValue = dataManager()->fieldData(field);
if (expandType == EscapeSymbols) {
if (dataManager()->fieldData(field).isNull()) {
fieldValue="\"\"";
} else {
fieldValue = escapeSimbols(varValue.toString());
switch (dataManager()->fieldData(field).type()) {
case QVariant::Char:
case QVariant::String:
case QVariant::StringList:
case QVariant::Date:
case QVariant::DateTime:
fieldValue = "\""+fieldValue+"\"";
break;
default:
break;
}
}
} else {
if (expandType == ReplaceHTMLSymbols)
fieldValue = replaceHTMLSymbols(varValue.toString());
else fieldValue = varValue.toString();
}
context.replace(rx.cap(0),fieldValue);
} else {
QString error = QString("Field %1 not found in %2 !!! ").arg(field).arg(reportItem->objectName());
dataManager()->putError(error);
varValue = QVariant();
if (!dataManager()->reportSettings() || !dataManager()->reportSettings()->suppressAbsentFieldsAndVarsWarnings())
context.replace(rx.cap(0),error);
else
context.replace(rx.cap(0),"");
}
}
}
return context;
}
QString ScriptEngineManager::expandScripts(QString context, QVariant& varValue, QObject *reportItem)
{
QRegExp rx(Const::SCRIPT_RX);
if (context.contains(rx)){
if (ScriptEngineManager::instance().dataManager()!=dataManager())
ScriptEngineManager::instance().setDataManager(dataManager());
QScriptEngine* se = ScriptEngineManager::instance().scriptEngine();
if (reportItem){
QScriptValue svThis = se->globalObject().property("THIS");
if (svThis.isValid()){
se->newQObject(svThis, this);
} else {
svThis = se->newQObject(this);
se->globalObject().setProperty("THIS",svThis);
}
}
ScriptExtractor scriptExtractor(context);
if (scriptExtractor.parse()){
for(int i=0; i<scriptExtractor.count();++i){
QString scriptBody = expandDataFields(scriptExtractor.bodyAt(i),EscapeSymbols, varValue, reportItem);
scriptBody = expandUserVariables(scriptBody, FirstPass, EscapeSymbols, varValue);
QScriptValue value = se->evaluate(scriptBody);
if (!se->hasUncaughtException()) {
varValue = value.toVariant();
context.replace(scriptExtractor.scriptAt(i),value.toString());
} else {
context.replace(scriptExtractor.scriptAt(i),se->uncaughtException().toString());
}
}
}
}
return context;
}
QVariant ScriptEngineManager::evaluateScript(const QString& script){
QRegExp rx(Const::SCRIPT_RX);
QVariant varValue;
if (script.contains(rx)){
if (ScriptEngineManager::instance().dataManager()!=dataManager())
ScriptEngineManager::instance().setDataManager(dataManager());
QScriptEngine* se = ScriptEngineManager::instance().scriptEngine();
ScriptExtractor scriptExtractor(script);
if (scriptExtractor.parse()){
QString scriptBody = expandDataFields(scriptExtractor.bodyAt(0),EscapeSymbols, varValue, 0);
scriptBody = expandUserVariables(scriptBody, FirstPass, EscapeSymbols, varValue);
QScriptValue value = se->evaluate(scriptBody);
if (!se->hasUncaughtException()) {
return value.toVariant();
}
}
}
return QVariant();
}
void ScriptEngineManager::updateModel()
{
}
ScriptEngineManager::ScriptEngineManager()
:m_model(0), m_dataManager(0)
{
@ -421,6 +623,8 @@ ScriptEngineManager::ScriptEngineManager()
addFunction("currencyUSBasedFormat",currencyUSBasedFormat,"NUMBER","currencyUSBasedFormat(\""+tr("Value")+",\""+tr("CurrencySymbol")+"\")");
#endif
addFunction("setVariable", setVariable, "GENERAL", "setVariable(\""+tr("Name")+"\",\""+tr("Value")+"\")");
addFunction("getVariable", getVariable, "GENERAL", "getVariable(\""+tr("Name")+"\")");
addFunction("getField", getField, "GENERAL", "getField(\""+tr("Name")+"\")");
QScriptValue colorCtor = m_scriptEngine->newFunction(constructColor);
m_scriptEngine->globalObject().setProperty("QColor", colorCtor);
@ -552,5 +756,196 @@ QString ScriptExtractor::substring(const QString &value, int start, int end)
return value.mid(start,end-start);
}
QString DialogDescriber::name() const
{
return m_name;
}
void DialogDescriber::setName(const QString& name)
{
m_name = name;
}
QByteArray DialogDescriber::description() const
{
return m_description;
}
void DialogDescriber::setDescription(const QByteArray &description)
{
m_description = description;
}
#ifdef HAVE_UI_LOADER
void ScriptEngineContext::addDialog(const QString& name, const QByteArray& description)
{
m_dialogs.push_back(DialogDescriber::create(name,description));
}
bool ScriptEngineContext::previewDialog(const QString& dialogName)
{
QDialog* dialog = getDialog(dialogName);
if (dialog) {
dialog->exec();
return true;
} else {
m_lastError = tr("Dialog with name: %1 can`t be created").arg(dialogName);
return false;
}
}
bool ScriptEngineContext::containsDialog(const QString& dialogName)
{
foreach(DialogDescriber::Ptr dialog, m_dialogs){
if (dialog->name()==dialogName)
return true;
}
return false;
}
void ScriptEngineContext::deleteDialog(const QString& dialogName)
{
{
QVector<DialogDescriber::Ptr>::Iterator it = m_dialogs.begin();
while(it!=m_dialogs.end()){
if ((*it)->name()==dialogName){
it = m_dialogs.erase(it);
} else {
++it;
}
}
}
{
QList<DialogPtr>::Iterator it = m_createdDialogs.begin();
while(it!=m_createdDialogs.end()){
if ((*it)->objectName()==dialogName){
it = m_createdDialogs.erase(it);
} else {
++it;
}
}
}
}
#endif
void ScriptEngineContext::clear()
{
#ifdef HAVE_UI_LOADER
m_dialogs.clear();
m_createdDialogs.clear();
#endif
m_initScript.clear();
m_lastError="";
}
QObject* ScriptEngineContext::createElement(const QString& collectionName, const QString& elementType)
{
Q_UNUSED(elementType)
#ifdef HAVE_UI_LOADER
if (collectionName.compare("dialogs",Qt::CaseInsensitive)==0){
m_dialogs.push_back(DialogDescriber::create());
return m_dialogs.at(m_dialogs.count()-1).data();
}
#else
Q_UNUSED(collectionName)
#endif
return 0;
}
int ScriptEngineContext::elementsCount(const QString& collectionName)
{
#ifdef HAVE_UI_LOADER
if (collectionName.compare("dialogs",Qt::CaseInsensitive)==0){
return m_dialogs.count();
};
#else
Q_UNUSED(collectionName)
#endif
return 0;
}
QObject* ScriptEngineContext::elementAt(const QString& collectionName, int index)
{
#ifdef HAVE_UI_LOADER
if (collectionName.compare("dialogs",Qt::CaseInsensitive)==0){
return m_dialogs.at(index).data();
};
#else
Q_UNUSED(collectionName)
Q_UNUSED(index)
#endif
return 0;
}
void ScriptEngineContext::collectionLoadFinished(const QString& collectionName)
{
Q_UNUSED(collectionName);
}
#ifdef HAVE_UI_LOADER
QDialog* ScriptEngineContext::createDialog(DialogDescriber* cont)
{
QUiLoader loader;
QByteArray desc = cont->description();
QBuffer buffer(&desc);
buffer.open(QIODevice::ReadOnly);
QDialog* dialog = dynamic_cast<QDialog*>(loader.load(&buffer));
m_createdDialogs.push_back(QSharedPointer<QDialog>(dialog));
return dialog;
}
QDialog* ScriptEngineContext::findDialog(const QString& dialogName)
{
foreach(DialogPtr dialog, m_createdDialogs){
if (dialog->objectName()==dialogName)
return dialog.data();
}
return 0;
}
DialogDescriber* ScriptEngineContext::findDialogContainer(const QString& dialogName)
{
foreach (DialogDescriber::Ptr dialogCont , m_dialogs) {
if (dialogCont->name().compare(dialogName,Qt::CaseInsensitive)==0){
return dialogCont.data();
}
}
return 0;
}
QDialog* ScriptEngineContext::getDialog(const QString& dialogName)
{
QDialog* dialog = findDialog(dialogName);
if (dialog){
return dialog;
} else {
DialogDescriber* cont = findDialogContainer(dialogName);
if (cont){
dialog = createDialog(cont);
if (dialog)
return dialog;
}
}
return 0;
}
#endif
QString ScriptEngineContext::initScript() const
{
return m_initScript;
}
void ScriptEngineContext::setInitScript(const QString& initScript)
{
m_initScript = initScript;
}
DialogDescriber::Ptr DialogDescriber::create(const QString& name, const QByteArray& desc) {
Ptr res(new DialogDescriber());
res->setName(name);
res->setDescription(desc);
return res;
}
} //namespace LimeReport

View File

@ -39,8 +39,13 @@
#include <QScriptable>
#include <QFont>
#ifdef HAVE_UI_LOADER
#include <QDialog>
#endif
#include "base/lrsingleton.h"
#include "lrscriptenginemanagerintf.h"
#include "lrcollection.h"
namespace LimeReport{
@ -57,7 +62,7 @@ struct ScriptFunctionDesc{
class ScriptEngineNode {
public:
enum NodeType{Root,Category,Function};
enum NodeType{Root,Category,Function,Dialog,DialogElement};
ScriptEngineNode(const QString& name="", const QString& description ="", NodeType type=Root, ScriptEngineNode* parent=0, const QIcon& icon=QIcon())
:m_name(name), m_description(description), m_icon(icon), m_type(type), m_parent(parent){}
virtual ~ScriptEngineNode();
@ -95,6 +100,7 @@ public:
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
void setScriptEngineManager(ScriptEngineManager* scriptManager);
inline ScriptEngineManager* scriptEngineManager(){return m_scriptManager;}
private slots:
void slotScriptEngineChanged();
private:
@ -105,6 +111,64 @@ private:
ScriptEngineNode* m_rootNode;
};
class DialogDescriber : public QObject
{
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName)
Q_PROPERTY(QByteArray description READ description WRITE setDescription)
public:
typedef QSharedPointer<DialogDescriber> Ptr;
static Ptr create(const QString& name, const QByteArray &desc);
static Ptr create(){return Ptr(new DialogDescriber);}
QString name() const;
void setName(const QString& name);
QByteArray description() const;
void setDescription(const QByteArray& description);
private :
QString m_name;
QByteArray m_description;
};
class ScriptEngineContext : public QObject, public ICollectionContainer
{
Q_OBJECT
Q_PROPERTY(ACollectionProperty dialogs READ fakeCollectionReader)
Q_PROPERTY(QString initScript READ initScript WRITE setInitScript)
public:
#ifdef HAVE_UI_LOADER
typedef QSharedPointer<QDialog> DialogPtr;
#endif
explicit ScriptEngineContext(QObject* parent=0):QObject(parent){}
#ifdef HAVE_UI_LOADER
void addDialog(const QString& name, const QByteArray &description);
bool previewDialog(const QString& dialogName);
bool containsDialog(const QString& dialogName);
const QVector<DialogDescriber::Ptr>& dialogsDescriber(){return m_dialogs;}
void deleteDialog(const QString& dialogName);
QDialog *getDialog(const QString &dialogName);
#endif
void clear();
QString initScript() const;
void setInitScript(const QString& initScript);
protected:
QObject* createElement(const QString& collectionName,const QString& elementType);
int elementsCount(const QString& collectionName);
QObject* elementAt(const QString& collectionName,int index);
void collectionLoadFinished(const QString &collectionName);
#ifdef HAVE_UI_LOADER
QDialog *createDialog(DialogDescriber *cont);
QDialog *findDialog(const QString &dialogName);
DialogDescriber* findDialogContainer(const QString& dialogName);
#endif
private:
#ifdef HAVE_UI_LOADER
QVector<DialogDescriber::Ptr> m_dialogs;
QList<DialogPtr> m_createdDialogs;
#endif
QString m_lastError;
QString m_initScript;
};
class ScriptEngineManager : public QObject, public Singleton<ScriptEngineManager>, public IScriptEngineManager
{
Q_OBJECT
@ -122,8 +186,17 @@ public:
QStringList functionsNames();
const QList<ScriptFunctionDesc>& functionsDescriber(){return m_functions;}
ScriptEngineModel* model(){return m_model;}
void setContext(ScriptEngineContext* context){m_context=context;}
DataSourceManager* dataManager() const {return m_dataManager;}
void setDataManager(DataSourceManager* dataManager);
QString expandUserVariables(QString context, RenderPass pass, ExpandType expandType, QVariant &varValue);
QString expandDataFields(QString context, ExpandType expandType, QVariant &varValue, QObject* reportItem);
QString expandScripts(QString context, QVariant &varValue, QObject* reportItem);
QVariant evaluateScript(const QString &script);
protected:
void updateModel();
bool containsFunction(const QString &functionName);
private:
Q_DISABLE_COPY(ScriptEngineManager)
@ -133,6 +206,7 @@ private:
QString m_lastError;
QList<ScriptFunctionDesc> m_functions;
ScriptEngineModel* m_model;
ScriptEngineContext* m_context;
DataSourceManager* m_dataManager;
};

View File

@ -41,6 +41,8 @@ const int b = 16; /* number of bytes in key */
const int c = 4; /* number words in key = ceil(8*b/w)*/
const int t = 26; /* size of table S = 2*(r+1) words */
const char* passPhrase = "HjccbzHjlbyfCkjy";
WORD P = 0xb7e15163, Q = 0x9e3779b9;
#define ROTL(x,y) (((x)<<(y&(w-1))) | ((x)>>(w-(y&(w-1)))))
@ -64,11 +66,15 @@ namespace LimeReport {
class ChipperPrivate{
friend class Chipper;
public:
ChipperPrivate():m_prepared(false){}
bool isPrepared(){ return m_prepared;}
private:
void RC5_SETUP(const char *K);
void RC5_ENCRYPT(WORD *pt, WORD *ct);
void RC5_DECRYPT(WORD *ct, WORD *pt);
WORD S[26];
bool m_prepared;
};
void ChipperPrivate::RC5_SETUP(const char *K)
@ -82,6 +88,7 @@ void ChipperPrivate::RC5_SETUP(const char *K)
A = S[i] = ROTL(S[i]+(A+B),3);
B = L[j] = ROTL(L[j]+(A+B),(A+B));
}
m_prepared = true;
}
void ChipperPrivate::RC5_ENCRYPT(WORD *pt, WORD *ct)
@ -111,7 +118,8 @@ QByteArray Chipper::cryptString(QString value)
buff += value;
WTB pt, ct, prior;
d->RC5_SETUP("HjccbzHjlbyfCkjy");
if (!d->isPrepared())
d->RC5_SETUP(passPhrase);
prior.word[0]=0;
prior.word[1]=0;
@ -144,7 +152,8 @@ QString Chipper::decryptByteArray(QByteArray value)
QByteArray result;
WTB pt, ct, prior;
d->RC5_SETUP("HjccbzHjlbyfCkjy");
if (!d->isPrepared())
d->RC5_SETUP(passPhrase);
prior.word[0] = 0;
prior.word[1] = 0;
@ -174,6 +183,14 @@ QString Chipper::decryptByteArray(QByteArray value)
Chipper::Chipper(): d(new ChipperPrivate()){}
Chipper::Chipper(QString passphrase): d(new ChipperPrivate())
{
if (!passphrase.trimmed().isEmpty()){
passphrase = passphrase.leftJustified(16,'#');
d->RC5_SETUP(passphrase.toLatin1().data());
}
}
Chipper::~Chipper()
{
delete d;

View File

@ -42,6 +42,7 @@ public:
QByteArray cryptString(QString value);
QString decryptByteArray(QByteArray value);
Chipper();
Chipper(QString passphrase);
~Chipper();
private:
ChipperPrivate* d;

View File

@ -53,6 +53,7 @@ ColorEditor::ColorEditor(QWidget *parent) :
setFocusProxy(m_button);
setAutoFillBackground(true);
setLayout(layout);
setAutoFillBackground(true);
connect(m_button,SIGNAL(clicked()),this,SLOT(slotClicked()));
}

View File

@ -37,13 +37,17 @@ ImageEditor::ImageEditor(QWidget* parent)
:QWidget(parent)
{
m_button.setIcon(QIcon(":items/ImageItem"));
m_clearButton.setIcon(QIcon(":items/clear.png"));
QHBoxLayout* layout = new QHBoxLayout(this);
layout->addWidget(&m_button);
layout->setSpacing(0);
layout->addWidget(&m_clearButton);
layout->setSpacing(1);
layout->setContentsMargins(1,0,1,1);
setLayout(layout);
setFocusProxy(&m_button);
setAutoFillBackground(true);
connect(&m_button,SIGNAL(clicked()),this,SLOT(slotButtonClicked()));
connect(&m_clearButton,SIGNAL(clicked()),this,SLOT(slotClearButtonClicked()));
}
QImage ImageEditor::image()
@ -57,4 +61,10 @@ void ImageEditor::slotButtonClicked()
emit editingFinished();
}
} // namespace LimeReport
void ImageEditor::slotClearButtonClicked()
{
m_image = QImage();
emit editingFinished();
}
} //namespace LimeReport

View File

@ -46,8 +46,10 @@ signals:
void editingFinished();
private slots:
void slotButtonClicked();
void slotClearButtonClicked();
private:
QPushButton m_button;
QPushButton m_clearButton;
QImage m_image;
};

View File

@ -87,7 +87,7 @@ namespace LimeReport{
void setColorIndex(int propertyValue);
void setModel(QAbstractItemModel* model){m_model=model;}
QAbstractItemModel* model(){return m_model;}
void setModelIndex(QModelIndex index){m_index=index;}
void setModelIndex(const QModelIndex& index){m_index=index;}
QModelIndex modelIndex(){return m_index;}
bool isClass(){return m_isClass;}
#ifdef INSPECT_BASEDESIGN

View File

@ -106,6 +106,7 @@ void ObjectBrowser::buildTree(BaseDesignIntf* ignoredItem){
m_treeView->clear();
m_itemsMap.clear();
if (!m_report->activePage()) return;
ObjectBrowserNode *topLevelItem=new ObjectBrowserNode(m_treeView);
topLevelItem->setText(0,m_report->activePage()->objectName());
@ -204,7 +205,7 @@ void ObjectBrowser::slotItemDeleted(PageDesignIntf *, BaseDesignIntf *item)
void ObjectBrowser::slotObjectTreeItemSelectionChanged()
{
if (!m_changingItemSelection){
if (!m_changingItemSelection && m_report->activePage()){
m_changingItemSelection = true;
m_report->activePage()->clearSelection();
foreach(QTreeWidgetItem* item, m_treeView->selectedItems()){
@ -214,6 +215,10 @@ void ObjectBrowser::slotObjectTreeItemSelectionChanged()
if (si) {
m_report->activePage()->animateItem(si);
si->setSelected(true);
QPointF p = si->mapToScene(si->pos());
if (si->parentItem())
p = si->parentItem()->mapToScene(si->pos());
m_report->activeView()->centerOn(p);
}
}
}

View File

@ -121,11 +121,11 @@
<file alias="/images/textBold">images/text_bold1.png</file>
<file alias="/images/textItalic">images/text_italic1.png</file>
<file alias="/images/textUnderline">images/text_underline1.png</file>
<file alias="/images/editMode">images/edit_control_3_24.png</file>
<file>images/edit_control_3_24.png</file>
<file alias="/images/editlayout">images/edit_layout_4_24.png</file>
<file alias="/images/hlayout">images/hlayuot_3_24.png</file>
<file alias="/images/addBand">images/addBand1.png</file>
<file alias="/images/delete">images/delete1.png</file>
<file>images/hlayuot_3_24.png</file>
<file>images/addBand1.png</file>
<file>images/delete1.png</file>
<file alias="/images/copy">images/copy2.png</file>
<file alias="/images/newReport">images/new_leaf1.png</file>
<file alias="/images/paste">images/paste1.png</file>
@ -165,8 +165,14 @@
<file>images/FitWidth.png</file>
<file>images/OneToOne.png</file>
<file alias="/images/logo32">images/logo_32x32.png</file>
<file alias="/images/addPage">images/addPage1.png</file>
<file alias="/images/deletePage">images/deletePage1.png</file>
<file alias="/images/toolbar">images/toolbar.png</file>
<file>images/not_checked.png</file>
<file>images/checked.png</file>
<file alias="/images/hlayout">images/hlayuot_4_24.png</file>
<file alias="/images/delete">images/delete2.png</file>
<file alias="/images/addBand">images/addBand2.png</file>
<file alias="/images/editMode">images/edit_control_4_24.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

Some files were not shown because too many files have changed in this diff Show More