0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-05-12 18:33:45 +03:00

Merge branch 'develop' into 1.4_ChartItem

Conflicts:
	limereport/items/items.qrc
	limereport/limereport.pri
This commit is contained in:
Arin Alex 2017-07-12 21:40:24 +03:00
commit c090883cf1
175 changed files with 12162 additions and 2484 deletions

View File

@ -10,7 +10,7 @@ env:
- QT_BASE=56 - QT_BASE=56
before_install: before_install:
- if [ "$QT_BASE" = "56" ]; then sudo add-apt-repository ppa:beineri/opt-qt561-trusty -y; fi - if [ "$QT_BASE" = "56" ]; then sudo add-apt-repository ppa:beineri/opt-qt562-trusty -y; fi
- sudo apt-get update -qq - sudo apt-get update -qq
install: install:

View File

@ -1,7 +1,15 @@
DEFINES += NO_PNG DEFINES += NO_PNG
TEMPLATE = lib TEMPLATE = lib
CONFIG += dll
contains(CONFIG, static_build){
CONFIG += staticlib
DEFINES += HAVE_STATIC_BUILD
}
!contains(CONFIG, staticlib){
CONFIG += dll
DEFINES += QZINT_LIBRARY
}
include(../../../common.pri) include(../../../common.pri)
@ -18,7 +26,6 @@ unix{
INCLUDEPATH += $$PWD/../backend INCLUDEPATH += $$PWD/../backend
DEFINES += _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS ZINT_VERSION=\\\"$$VERSION\\\" DEFINES += _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS ZINT_VERSION=\\\"$$VERSION\\\"
DEFINES += QZINT_LIBRARY
TARGET = QtZint TARGET = QtZint
!contains(DEFINES, NO_PNG) { !contains(DEFINES, NO_PNG) {

View File

@ -3,10 +3,14 @@
#include <QtCore/qglobal.h> #include <QtCore/qglobal.h>
#ifdef HAVE_STATIC_BUILD
# define QZINTSHARED_EXPORT /**/
#else
#if defined(QZINT_LIBRARY) #if defined(QZINT_LIBRARY)
# define QZINTSHARED_EXPORT Q_DECL_EXPORT # define QZINTSHARED_EXPORT Q_DECL_EXPORT
#else #else
# define QZINTSHARED_EXPORT Q_DECL_IMPORT # define QZINTSHARED_EXPORT Q_DECL_IMPORT
#endif #endif
#endif
#endif // QZINT_GLOBAL_H #endif // QZINT_GLOBAL_H

View File

@ -1,4 +1,6 @@
LimeReport v1.3.11 [![Build Status](https://api.travis-ci.org/fralx/LimeReport.svg?branch=master)](https://travis-ci.org/fralx/LimeReport) LimeReport v1.4.7 [![Build Status](https://api.travis-ci.org/fralx/LimeReport.svg?branch=master)](https://travis-ci.org/fralx/LimeReport)
-----------
Official LimeReport web site [http://limereport.ru](http://limereport.ru)
----------- -----------
##Features ##Features
@ -38,6 +40,17 @@ For more samples see a demo
## Change log ## Change log
###1.4.7
1. Multipage
2. Dialogs
3. Render events
4. Initscript
5. Memory usage has been reduced
6. Datasource manager has been refactored
7. Report items context menus have been added
8. Editable report
And many others minor fixes and improvements
###1.3.11 ###1.3.11
1. LimeReport project structure has been changed 1. LimeReport project structure has been changed
2. Preview widget has been added 2. Preview widget has been added

View File

@ -1,14 +1,27 @@
CONFIG += build_translations CONFIG += build_translations
CONFIG += zint
#greaterThan(QT_MAJOR_VERSION, 4) { !contains(CONFIG, no_zint){
# QT += uitools CONFIG += zint
#} }
#lessThan(QT_MAJOR_VERSION, 5){
# CONFIG += uitools !contains(CONFIG, qtscriptengine){
#} CONFIG += qjsengine
}
!contains(CONFIG, no_formdesigner){
CONFIG += dialogdesigner
}
ZINT_PATH = $$PWD/3rdparty/zint-2.4.4 ZINT_PATH = $$PWD/3rdparty/zint-2.4.4
contains(CONFIG,zint){
DEFINES += HAVE_ZINT
}
greaterThan(QT_MAJOR_VERSION, 4) {
QT += uitools
}
lessThan(QT_MAJOR_VERSION, 5){
CONFIG += uitools
}
CONFIG(release, debug|release){ CONFIG(release, debug|release){
message(Release) message(Release)
@ -55,8 +68,8 @@ OBJECTS_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/obj
RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MAJOR = 1
LIMEREPORT_VERSION_MINOR = 3 LIMEREPORT_VERSION_MINOR = 4
LIMEREPORT_VERSION_RELEASE = 11 LIMEREPORT_VERSION_RELEASE = 22
LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"'
DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\"
@ -68,11 +81,15 @@ TRANSLATIONS_PATH = $$PWD/translations
greaterThan(QT_MAJOR_VERSION, 4) { greaterThan(QT_MAJOR_VERSION, 4) {
DEFINES+=HAVE_QT5 DEFINES+=HAVE_QT5
QT+= printsupport widgets QT+= printsupport widgets qml
contains(QT,uitools){ contains(QT,uitools){
message(uitools) message(uitools)
DEFINES += HAVE_UI_LOADER DEFINES += HAVE_UI_LOADER
} }
contains(CONFIG, qjsengine){
message(qjsengine)
DEFINES += USE_QJSENGINE
}
} }
lessThan(QT_MAJOR_VERSION, 5){ lessThan(QT_MAJOR_VERSION, 5){
@ -82,3 +99,5 @@ lessThan(QT_MAJOR_VERSION, 5){
DEFINES += HAVE_UI_LOADER DEFINES += HAVE_UI_LOADER
} }
} }

View File

@ -27,9 +27,11 @@ macx{
unix:{ unix:{
LIBS += -L$${DEST_LIBS} -llimereport LIBS += -L$${DEST_LIBS} -llimereport
!contains(CONFIG, static_build){
contains(CONFIG,zint){ contains(CONFIG,zint){
LIBS += -L$${DEST_LIBS} -lQtZint LIBS += -L$${DEST_LIBS} -lQtZint
} }
}
DESTDIR = $$DEST_DIR DESTDIR = $$DEST_DIR
# QMAKE_POST_LINK += mkdir -p $$quote($$REPORTS_DIR) | # QMAKE_POST_LINK += mkdir -p $$quote($$REPORTS_DIR) |
QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR) $$quote($$REPORTS_DIR) $$escape_expand(\n\t) QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR) $$quote($$REPORTS_DIR) $$escape_expand(\n\t)
@ -52,10 +54,12 @@ win32 {
DESTDIR = $$DEST_DIR DESTDIR = $$DEST_DIR
RC_FILE += mainicon.rc RC_FILE += mainicon.rc
QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR\\*) $$quote($$REPORTS_DIR\\demo_reports) $$escape_expand(\\n\\t) QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$shell_quote($$EXTRA_DIR\\*) $$shell_quote($$REPORTS_DIR\\demo_reports) $$escape_expand(\\n\\t)
!contains(CONFIG, static_build){
contains(CONFIG,zint){ contains(CONFIG,zint){
LIBS += -L$${DEST_LIBS} -lQtZint LIBS += -L$${DEST_LIBS} -lQtZint
} }
}
LIBS += -L$${DEST_LIBS} -llimereport LIBS += -L$${DEST_LIBS} -llimereport
} }

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

@ -1 +1 @@
DI_ICON1 ICON "main.ico" IDI_ICON1 ICON "main.ico"

View File

@ -33,8 +33,8 @@
#include <QMessageBox> #include <QMessageBox>
#include <QtSql/QSqlQuery> #include <QtSql/QSqlQuery>
#include <QtSql/QSqlRecord> #include <QtSql/QSqlRecord>
#include "lrreportengine.h" #include <LimeReport>
#include "lrcallbackdatasourceintf.h" #include <LRCallbackDS>
#include <QDebug> #include <QDebug>
#include <QStringListModel> #include <QStringListModel>
@ -71,19 +71,21 @@ MainWindow::MainWindow(QWidget *parent) :
}; };
} }
LimeReport::ICallbackDatasource * callbackDatasource = report->dataManager()->createCallbackDatasouce("master"); LimeReport::ICallbackDatasource * callbackDatasource = report->dataManager()->createCallbackDatasource("master");
connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)), connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
this, SLOT(slotGetCallbackData(LimeReport::CallbackInfo,QVariant&))); this, SLOT(slotGetCallbackData(LimeReport::CallbackInfo,QVariant&)));
connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)), connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)),
this, SLOT(slotChangePos(const LimeReport::CallbackInfo::ChangePosType&,bool&))); this, SLOT(slotChangePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)));
//report->dataManager()->addCallbackDatasource(callbackDatasource,"master");
callbackDatasource = report->dataManager()->createCallbackDatasouce("detail"); callbackDatasource = report->dataManager()->createCallbackDatasource("detail");
connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)), connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
this, SLOT(slotGetCallbackChildData(LimeReport::CallbackInfo,QVariant&))); this, SLOT(slotGetCallbackChildData(LimeReport::CallbackInfo,QVariant&)));
connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)), connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)),
this, SLOT(slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosType&,bool&))); this, SLOT(slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosType&,bool&)));
//report->dataManager()->addCallbackDatasource(callbackDatasource,"detail");
callbackDatasource = report->dataManager()->createCallbackDatasource("oneSlotDS");
connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
this, SLOT(slotOneSlotDS(LimeReport::CallbackInfo,QVariant&)));
QStringList simpleData; QStringList simpleData;
simpleData << "value1" << "value2" << "value3"; simpleData << "value1" << "value2" << "value3";
@ -93,8 +95,8 @@ MainWindow::MainWindow(QWidget *parent) :
report->dataManager()->addModel("string_list",stringListModel,true); report->dataManager()->addModel("string_list",stringListModel,true);
QStringList strList; QStringList strList;
strList<<"value1"<<"value2"; strList<<"value1"<<"value2";
QScriptValue value = qScriptValueFromSequence(report->scriptManager()->scriptEngine(),strList); //QScriptValue value = qScriptValueFromSequence(report->scriptManager()->scriptEngine(),strList);
report->scriptManager()->scriptEngine()->globalObject().setProperty("test_list",value); //report->scriptManager()->scriptEngine()->globalObject().setProperty("test_list",value);
} }
@ -102,6 +104,8 @@ MainWindow::MainWindow(QWidget *parent) :
MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
delete ui; delete ui;
delete m_customers;
delete m_orders;
} }
void MainWindow::on_pushButton_clicked() void MainWindow::on_pushButton_clicked()
@ -208,3 +212,32 @@ void MainWindow::slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosTyp
if (type == LimeReport::CallbackInfo::First) result = ds->first(); if (type == LimeReport::CallbackInfo::First) result = ds->first();
else result = ds->next(); 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 slotChangePos(const LimeReport::CallbackInfo::ChangePosType& type, bool& result);
void slotGetCallbackChildData(LimeReport::CallbackInfo info, QVariant& data); void slotGetCallbackChildData(LimeReport::CallbackInfo info, QVariant& data);
void slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosType& type, bool& result); void slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosType& type, bool& result);
void slotOneSlotDS(LimeReport::CallbackInfo info, QVariant& data);
private: private:
void prepareData(QSqlQuery* ds, LimeReport::CallbackInfo info, QVariant &data); void prepareData(QSqlQuery* ds, LimeReport::CallbackInfo info, QVariant &data);
private: private:

View File

@ -27,9 +27,11 @@ macx{
unix:{ unix:{
LIBS += -L$${DEST_LIBS} -llimereport LIBS += -L$${DEST_LIBS} -llimereport
!contains(CONFIG, static_build){
contains(CONFIG,zint){ contains(CONFIG,zint){
LIBS += -L$${DEST_LIBS} -lQtZint LIBS += -L$${DEST_LIBS} -lQtZint
} }
}
DESTDIR = $$DEST_DIR DESTDIR = $$DEST_DIR
QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR) $$quote($$REPORTS_DIR) $$escape_expand(\n\t) QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR) $$quote($$REPORTS_DIR) $$escape_expand(\n\t)
linux{ linux{
@ -50,12 +52,13 @@ win32 {
DESTDIR = $$DEST_DIR DESTDIR = $$DEST_DIR
RC_FILE += mainicon.rc RC_FILE += mainicon.rc
!contains(CONFIG, static_build){
contains(CONFIG,zint){ contains(CONFIG,zint){
LIBS += -L$${DEST_LIBS} -lQtZint LIBS += -L$${DEST_LIBS} -lQtZint
} }
}
LIBS += -L$${DEST_LIBS} -llimereport LIBS += -L$${DEST_LIBS} -llimereport
QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$$EXTRA_DIR\" \"$$REPORTS_DIR\\demo_reports\" $$escape_expand(\\n\\t) QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$shell_quote($$EXTRA_DIR\\*) $$shell_quote($$REPORTS_DIR\\demo_reports) $$escape_expand(\\n\\t)
} }

View File

@ -1 +1 @@
DI_ICON1 ICON "main.ico" IDI_ICON1 ICON "main.ico"

View File

@ -50,10 +50,21 @@ MainWindow::MainWindow(QWidget *parent) :
resize(screenWidth*0.8, screenHeight*0.8); resize(screenWidth*0.8, screenHeight*0.8);
move(x, y); move(x, y);
if (QFile::exists(QApplication::applicationDirPath()+"/demo_reports/categories.lrxml")){
m_report.loadFromFile(QApplication::applicationDirPath()+"/demo_reports/categories.lrxml"); if (ui->treeWidget->topLevelItemCount()>0){
m_preview->refreshPages(); int index = 0;
while (index<ui->treeWidget->topLevelItemCount()){
if (ui->treeWidget->topLevelItem(index)->childCount()>0)
++index;
else {
m_report.loadFromFile(ui->treeWidget->topLevelItem(index)->data(0,Qt::UserRole).toString());
ui->treeWidget->setCurrentItem(ui->treeWidget->topLevelItem(index));
break;
} }
}
}
m_preview->refreshPages();
} }
@ -107,7 +118,6 @@ void MainWindow::slotPagesSet(int pagesCount)
void MainWindow::slotPageChanged(int page) void MainWindow::slotPageChanged(int page)
{ {
// ui->sbPageNavigator->setValue(page);
m_pageNavigator->setValue(page); m_pageNavigator->setValue(page);
} }
@ -118,8 +128,10 @@ void MainWindow::slotPageNavigatorChanged(int page)
void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, int ) void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, int )
{ {
if (!m_report.isBusy()){
m_report.loadFromFile(item->data(0,Qt::UserRole).toString()); m_report.loadFromFile(item->data(0,Qt::UserRole).toString());
m_preview->refreshPages(); m_preview->refreshPages();
}
} }
void MainWindow::initPercentCombobox() void MainWindow::initPercentCombobox()

View File

@ -18,9 +18,11 @@ macx{
unix:{ unix:{
LIBS += -L$${DEST_LIBS} -llimereport LIBS += -L$${DEST_LIBS} -llimereport
!contains(CONFIG, static_build){
contains(CONFIG,zint){ contains(CONFIG,zint){
LIBS += -L$${DEST_LIBS} -lQtZint LIBS += -L$${DEST_LIBS} -lQtZint
} }
}
DESTDIR = $$DEST_DIR DESTDIR = $$DEST_DIR
linux{ linux{
#Link share lib to ../lib rpath #Link share lib to ../lib rpath
@ -40,10 +42,11 @@ win32 {
DESTDIR = $$DEST_DIR DESTDIR = $$DEST_DIR
RC_FILE += mainicon.rc RC_FILE += mainicon.rc
!contains(CONFIG, static_build){
contains(CONFIG,zint){ contains(CONFIG,zint){
LIBS += -L$${DEST_LIBS} -lQtZint LIBS += -L$${DEST_LIBS} -lQtZint
} }
}
LIBS += -L$${DEST_LIBS} -llimereport LIBS += -L$${DEST_LIBS} -llimereport
} }

View File

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

View File

@ -1 +1 @@
DI_ICON1 ICON "main.ico" IDI_ICON1 ICON "main.ico"

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

View File

@ -51,4 +51,29 @@ void ReportSettings::setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentF
m_suppressAbsentFieldsAndVarsWarnings = suppressAbsentFieldsAndVarsWarnings; 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;
}
QVector<QString> normalizeCaptures(const QRegExp& reg){
QVector<QString> result;
foreach (QString cap, reg.capturedTexts()) {
if (!cap.isEmpty())
result.append(cap);
}
return result;
}
} //namespace LimeReport } //namespace LimeReport

View File

@ -42,6 +42,13 @@
# define LIMEREPORT_EXPORT /**/ # define LIMEREPORT_EXPORT /**/
#endif #endif
#ifdef USE_QJSENGINE
//#include <QJSEngine>
#include <QQmlEngine>
#else
#include <QScriptEngine>
#endif
namespace LimeReport { namespace LimeReport {
#ifdef __GNUC__ #ifdef __GNUC__
@ -77,14 +84,30 @@ namespace Const{
const QString FIELD_RX = "\\$D\\s*\\{\\s*([^{}]*)\\s*\\}"; const QString FIELD_RX = "\\$D\\s*\\{\\s*([^{}]*)\\s*\\}";
const QString VARIABLE_RX = "\\$V\\s*\\{\\s*([^{}]*)\\s*\\}"; const QString VARIABLE_RX = "\\$V\\s*\\{\\s*([^{}]*)\\s*\\}";
const QString SCRIPT_RX = "\\$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 QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)";
const int VALUE_INDEX = 2; //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 QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(?:(?:(?:(?:\\\")|(?:))(\\w+)(?:(?:\\\")|(?:)))|(?:(?:(?:\\\")|(?:))(\\s*\\$\\w\\s*\\{.+\\}\\s*)(?:(?:\\\")|(?:))\\s*,\\s*(?:(?:\\\")|(?:))(\\w+)(?:(?:\\\")|(?:))))\\)";
const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*((?:(?:\\\")|(?:))(?:(?:\\$(?:(?:D\\{\\s*\\w*.\\w*\\s*\\})|(?:V\\{\\s*\\w*\\s*\\})|(?:S\\{.+\\})))|(?:\\w*))(?:(?:\\\")|(?:)))(?:(?:\\s*,\\s*(?:\\\"(\\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_RX = "(%1\\s*"+GROUP_FUNCTION_PARAM_RX+")";
const QString GROUP_FUNCTION_NAME_RX = "%1\\s*\\((.*[^\\)])\\)"; const QString GROUP_FUNCTION_NAME_RX = "%1\\s*\\((.*[^\\)])\\)";
const int SCENE_MARGIN = 50; const int SCENE_MARGIN = 50;
const QString FUNCTION_MANAGER_NAME = "LimeReport";
} }
QString extractClassName(QString className); QString extractClassName(QString className);
QString escapeSimbols(const QString& value);
QString replaceHTMLSymbols(const QString &value);
QVector<QString> normalizeCaptures(const QRegExp &reg);
enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols};
enum RenderPass {FirstPass, SecondPass}; enum RenderPass {FirstPass, SecondPass};
enum ArrangeType {AsNeeded, Force}; enum ArrangeType {AsNeeded, Force};
enum PreviewHint{ShowAllPreviewBars = 0, enum PreviewHint{ShowAllPreviewBars = 0,
@ -93,6 +116,7 @@ namespace Const{
HidePreviewStatusBar = 4, HidePreviewStatusBar = 4,
HideAllPreviewBar = 7, HideAllPreviewBar = 7,
PreviewBarsUserSetting = 8}; PreviewBarsUserSetting = 8};
Q_DECLARE_FLAGS(PreviewHints, PreviewHint) Q_DECLARE_FLAGS(PreviewHints, PreviewHint)
Q_FLAGS(PreviewHints) Q_FLAGS(PreviewHints)
@ -117,6 +141,20 @@ namespace Const{
typedef QStyleOptionViewItem StyleOptionViewItem; typedef QStyleOptionViewItem StyleOptionViewItem;
#endif #endif
#ifdef USE_QJSENGINE
typedef QQmlEngine ScriptEngineType;
typedef QJSValue ScriptValueType;
template <typename T>
static inline QJSValue getCppOwnedJSValue(QJSEngine &e, T *p)
{
QJSValue res = e.newQObject(p);
QQmlEngine::setObjectOwnership(p, QQmlEngine::CppOwnership);
return res;
}
#else
typedef QScriptEngine ScriptEngineType;
typedef QScriptValue ScriptValueType;
#endif
} // namespace LimeReport } // namespace LimeReport

View File

@ -12,6 +12,7 @@ class PreviewReportWidget;
class PreviewReportWidgetPrivate; class PreviewReportWidgetPrivate;
class ReportEnginePrivate; class ReportEnginePrivate;
class ReportEngine;
class LIMEREPORT_EXPORT PreviewReportWidget : public QWidget class LIMEREPORT_EXPORT PreviewReportWidget : public QWidget
{ {
@ -20,7 +21,7 @@ class LIMEREPORT_EXPORT PreviewReportWidget : public QWidget
friend class PreviewReportWindow; friend class PreviewReportWindow;
friend class PreviewReportWidgetPrivate; friend class PreviewReportWidgetPrivate;
public: public:
explicit PreviewReportWidget(ReportEnginePrivate *report, QWidget *parent = 0); explicit PreviewReportWidget(ReportEngine *report, QWidget *parent = 0);
~PreviewReportWidget(); ~PreviewReportWidget();
public slots: public slots:
void refreshPages(); void refreshPages();

View File

@ -33,6 +33,7 @@
#include <QObject> #include <QObject>
#include <QSettings> #include <QSettings>
#include <QPrintDialog> #include <QPrintDialog>
//#include <QJSEngine>
#include "lrglobal.h" #include "lrglobal.h"
#include "lrdatasourcemanagerintf.h" #include "lrdatasourcemanagerintf.h"
@ -62,18 +63,22 @@ class DataSourceManager;
class ReportEnginePrivate; class ReportEnginePrivate;
class PageDesignIntf; class PageDesignIntf;
class PageItemDesignIntf; class PageItemDesignIntf;
class ReportDesignWidget;
class PreviewReportWidget;
typedef QList< QSharedPointer<PageItemDesignIntf> > ReportPages; typedef QList< QSharedPointer<PageItemDesignIntf> > ReportPages;
class LIMEREPORT_EXPORT ReportEngine : public QObject{ class LIMEREPORT_EXPORT ReportEngine : public QObject{
Q_OBJECT Q_OBJECT
friend class ReportDesignWidget;
friend class PreviewReportWidget;
public: public:
static void setSettings(QSettings *value){m_settings=value;} static void setSettings(QSettings *value){m_settings=value;}
public: public:
explicit ReportEngine(QObject *parent = 0); explicit ReportEngine(QObject *parent = 0);
~ReportEngine(); ~ReportEngine();
bool printReport(QPrinter *printer=0); bool printReport(QPrinter *printer=0);
bool printPages(ReportPages pages, QPrinter *printer, PrintRange printRange = PrintRange()); bool printPages(ReportPages pages, QPrinter *printer);
void printToFile(const QString& fileName); void printToFile(const QString& fileName);
PageDesignIntf *createPreviewScene(QObject *parent = 0); PageDesignIntf *createPreviewScene(QObject *parent = 0);
bool printToPDF(const QString& fileName); bool printToPDF(const QString& fileName);
@ -82,7 +87,7 @@ public:
void setShowProgressDialog(bool value); void setShowProgressDialog(bool value);
IDataSourceManager* dataManager(); IDataSourceManager* dataManager();
IScriptEngineManager* scriptManager(); IScriptEngineManager* scriptManager();
bool loadFromFile(const QString& fileName); bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange = false);
bool loadFromByteArray(QByteArray *data); bool loadFromByteArray(QByteArray *data);
bool loadFromString(const QString& data); bool loadFromString(const QString& data);
QString reportFileName(); QString reportFileName();
@ -98,6 +103,10 @@ public:
PreviewReportWidget *createPreviewWidget(QWidget *parent = 0); PreviewReportWidget *createPreviewWidget(QWidget *parent = 0);
void setPreviewWindowTitle(const QString& title); void setPreviewWindowTitle(const QString& title);
void setPreviewWindowIcon(const QIcon& icon); void setPreviewWindowIcon(const QIcon& icon);
void setResultEditable(bool value);
bool resultIsEditable();
bool isBusy();
void setPassPharse(QString& passPharse);
signals: signals:
void renderStarted(); void renderStarted();
void renderFinished(); void renderFinished();

View File

@ -30,15 +30,19 @@
#ifndef LRSCRIPTENGINEMANAGERINTF_H #ifndef LRSCRIPTENGINEMANAGERINTF_H
#define LRSCRIPTENGINEMANAGERINTF_H #define LRSCRIPTENGINEMANAGERINTF_H
#include <QtScript/QScriptEngine> //#include <QJSEngine>
#include "lrglobal.h"
namespace LimeReport{ namespace LimeReport{
class IScriptEngineManager{ class IScriptEngineManager{
public: public:
virtual QScriptEngine* scriptEngine() = 0; virtual ScriptEngineType* scriptEngine() = 0;
virtual bool addFunction(const QString& name, QScriptEngine::FunctionSignature function, #ifndef USE_QJSENGINE
virtual bool addFunction(const QString& name, ScriptEngineType::FunctionSignature function,
const QString& category="", const QString& description="") = 0; const QString& category="", const QString& description="") = 0;
#endif
virtual bool addFunction(const QString &name, const QString& script, virtual bool addFunction(const QString &name, const QString& script,
const QString &category="", const QString &description="") = 0; const QString &category="", const QString &description="") = 0;
virtual const QString& lastError() const = 0; virtual const QString& lastError() const = 0;
@ -46,4 +50,5 @@ public:
}; };
} //namespace LimeReport } //namespace LimeReport
#endif // LRSCRIPTENGINEMANAGERINTF_H #endif // LRSCRIPTENGINEMANAGERINTF_H

5
limereport.pri Normal file
View File

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

View File

@ -1,9 +1,15 @@
TEMPLATE = subdirs TEMPLATE = subdirs
!contains(CONFIG, no_zint){
CONFIG += zint
}
include(common.pri) include(common.pri)
contains(CONFIG, zint){ contains(CONFIG, zint){
SUBDIRS += 3rdparty SUBDIRS += 3rdparty
} }
export($$CONFIG)
SUBDIRS += \ SUBDIRS += \
limereport limereport

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

@ -79,6 +79,23 @@ bool DataBand::isUnique() const
return false; return false;
} }
void DataBand::preparePopUpMenu(QMenu &menu)
{
DataBandDesignIntf::preparePopUpMenu(menu);
QAction* autoSplittableAction = menu.addAction(tr("useAlternateBackgroundColor"));
autoSplittableAction->setCheckable(true);
autoSplittableAction->setChecked(useAlternateBackgroundColor());
}
void DataBand::processPopUpAction(QAction *action)
{
DataBandDesignIntf::processPopUpAction(action);
if (action->text().compare(tr("useAlternateBackgroundColor")) == 0){
setProperty("useAlternateBackgroundColor",action->isChecked());
}
}
QColor DataBand::bandColor() const QColor DataBand::bandColor() const
{ {
return QColor(Qt::darkGreen); return QColor(Qt::darkGreen);

View File

@ -48,10 +48,13 @@ class DataBand : public DataBandDesignIntf
Q_PROPERTY(bool startNewPage READ startNewPage WRITE setStartNewPage) Q_PROPERTY(bool startNewPage READ startNewPage WRITE setStartNewPage)
Q_PROPERTY(bool startFromNewPage READ startFromNewPage WRITE setStartFromNewPage) Q_PROPERTY(bool startFromNewPage READ startFromNewPage WRITE setStartFromNewPage)
Q_PROPERTY(QColor alternateBackgroundColor READ alternateBackgroundColor WRITE setAlternateBackgroundColor) Q_PROPERTY(QColor alternateBackgroundColor READ alternateBackgroundColor WRITE setAlternateBackgroundColor)
Q_PROPERTY(bool useAlternateBackgroundColor READ useAlternateBackgroundColor WRITE setUseAlternateBackgroundColor)
public: public:
DataBand(QObject* owner = 0, QGraphicsItem* parent=0); DataBand(QObject* owner = 0, QGraphicsItem* parent=0);
bool isUnique() const; bool isUnique() const;
bool isData() const {return true;} bool isData() const {return true;}
void preparePopUpMenu(QMenu &menu);
void processPopUpAction(QAction *action);
protected: protected:
QColor bandColor() const; QColor bandColor() const;
private: private:
@ -82,7 +85,7 @@ class DataFooterBand : public BandDesignIntf
Q_OBJECT Q_OBJECT
Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount) Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount)
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection) Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection)
Q_PROPERTY(bool printAlways READ printAlways() WRITE setPrintAlways()) Q_PROPERTY(bool printAlways READ printAlways WRITE setPrintAlways)
public: public:
DataFooterBand(QObject* owner=0, QGraphicsItem* parent=0); DataFooterBand(QObject* owner=0, QGraphicsItem* parent=0);
bool isUnique() const {return false;} bool isUnique() const {return false;}

View File

@ -31,7 +31,6 @@
#include "lrglobal.h" #include "lrglobal.h"
#include "lrdatasourcemanager.h" #include "lrdatasourcemanager.h"
const QString xmlTagHeader = QLatin1String("GroupHeader"); const QString xmlTagHeader = QLatin1String("GroupHeader");
const QString xmlTagFooter = QLatin1String("GroupFooter"); const QString xmlTagFooter = QLatin1String("GroupFooter");
@ -98,6 +97,8 @@ void GroupBandHeader::startGroup(DataSourceManager* dataManager)
if (ds && ds->columnIndexByName(m_groupFiledName)!=-1) if (ds && ds->columnIndexByName(m_groupFiledName)!=-1)
m_groupFieldValue=ds->data(m_groupFiledName); m_groupFieldValue=ds->data(m_groupFiledName);
} }
if (!m_condition.isEmpty()) m_conditionValue = calcCondition(dataManager);
} }
QColor GroupBandHeader::bandColor() const QColor GroupBandHeader::bandColor() const
@ -114,20 +115,48 @@ 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) bool GroupBandHeader::isNeedToClose(DataSourceManager* dataManager)
{ {
if (!m_groupStarted) return false; 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")); dataManager->putError(tr("Group field not found"));
return false;
}
if (!m_condition.isEmpty()){
return m_conditionValue != calcCondition(dataManager);
} else {
QString datasourceName = findDataSourceName(parentBand()); QString datasourceName = findDataSourceName(parentBand());
if (dataManager->containsDatasource(datasourceName)){ if (dataManager->containsDatasource(datasourceName)){
IDataSource* ds = dataManager->dataSource(datasourceName); IDataSource* ds = dataManager->dataSource(datasourceName);
if (ds){ if (ds){
if (ds->data(m_groupFiledName).isNull() && m_groupFieldValue.isNull()) return false; if (ds->data(m_groupFiledName).isNull() && m_groupFieldValue.isNull()) return false;
if (!ds->data(m_groupFiledName).isValid()) return false;
return ds->data(m_groupFiledName)!=m_groupFieldValue; return ds->data(m_groupFiledName)!=m_groupFieldValue;
} }
} else { } else {
dataManager->putError(tr("Datasource \"%1\" not found !!!").arg(datasourceName)); dataManager->putError(tr("Datasource \"%1\" not found!").arg(datasourceName));
}
} }
return false; return false;
@ -141,6 +170,7 @@ bool GroupBandHeader::isStarted()
void GroupBandHeader::closeGroup() void GroupBandHeader::closeGroup()
{ {
m_groupFieldValue=QVariant(); m_groupFieldValue=QVariant();
m_conditionValue="";
m_groupStarted=false; 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 startNewPage READ startNewPage WRITE setStartNewPage)
Q_PROPERTY(bool resetPageNumber READ resetPageNumber WRITE setResetPageNumber) Q_PROPERTY(bool resetPageNumber READ resetPageNumber WRITE setResetPageNumber)
Q_PROPERTY(bool reprintOnEachPage READ reprintOnEachPage WRITE setReprintOnEachPage) Q_PROPERTY(bool reprintOnEachPage READ reprintOnEachPage WRITE setReprintOnEachPage)
Q_PROPERTY(QString condition READ condition WRITE setCondition)
public: public:
GroupBandHeader(QObject* owner = 0, QGraphicsItem* parent=0); GroupBandHeader(QObject* owner = 0, QGraphicsItem* parent=0);
virtual bool isUnique() const; virtual bool isUnique() const;
@ -57,6 +58,8 @@ public:
void setResetPageNumber(bool resetPageNumber); void setResetPageNumber(bool resetPageNumber);
bool isHeader() const{return true;} bool isHeader() const{return true;}
bool isGroupHeader() const {return true;} bool isGroupHeader() const {return true;}
QString condition() const;
void setCondition(const QString &condition);
private: private:
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0); virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
void startGroup(DataSourceManager* dataManager); void startGroup(DataSourceManager* dataManager);
@ -65,12 +68,15 @@ private:
void closeGroup(); void closeGroup();
int index(); int index();
QString findDataSourceName(BandDesignIntf *parentBand); QString findDataSourceName(BandDesignIntf *parentBand);
QString calcCondition(DataSourceManager *dataManager);
private: private:
QVariant m_groupFieldValue; QVariant m_groupFieldValue;
QString m_groupFiledName; QString m_groupFiledName;
bool m_groupStarted; bool m_groupStarted;
//bool m_startNewPage; //bool m_startNewPage;
bool m_resetPageNumber; bool m_resetPageNumber;
QString m_condition;
QString m_conditionValue;
}; };
class GroupBandFooter : public BandDesignIntf{ class GroupBandFooter : public BandDesignIntf{

View File

@ -46,7 +46,7 @@ bool VARIABLE_IS_NOT_USED registred = LimeReport::DesignElementsFactory::instanc
namespace LimeReport { namespace LimeReport {
ReportHeader::ReportHeader(QObject *owner, QGraphicsItem *parent) ReportHeader::ReportHeader(QObject *owner, QGraphicsItem *parent)
: BandDesignIntf(LimeReport::BandDesignIntf::ReportHeader,xmlTag,owner,parent) { : BandDesignIntf(LimeReport::BandDesignIntf::ReportHeader,xmlTag,owner,parent), m_printBeforePageHeader(false) {
setBandTypeText(tr("Report Header")); setBandTypeText(tr("Report Header"));
setMarkerColor(bandColor()); setMarkerColor(bandColor());
} }
@ -60,5 +60,18 @@ QColor ReportHeader::bandColor() const
return QColor(152,69,167); return QColor(152,69,167);
} }
bool ReportHeader::printBeforePageHeader() const
{
return m_printBeforePageHeader;
}
void ReportHeader::setPrintBeforePageHeader(bool printBeforePageHeader)
{
if (m_printBeforePageHeader != printBeforePageHeader){
m_printBeforePageHeader = printBeforePageHeader;
notify("printBeforePageHeader",!m_printBeforePageHeader,m_printBeforePageHeader);
}
}
} }

View File

@ -39,11 +39,15 @@ class ReportHeader : public LimeReport::BandDesignIntf
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable ) Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable )
Q_PROPERTY(bool printBeforePageHeader READ printBeforePageHeader WRITE setPrintBeforePageHeader)
public: public:
ReportHeader(QObject* owner = 0, QGraphicsItem *parent=0); ReportHeader(QObject* owner = 0, QGraphicsItem *parent=0);
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0); virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
bool printBeforePageHeader() const;
void setPrintBeforePageHeader(bool printBeforePageHeader);
protected: protected:
QColor bandColor() const; QColor bandColor() const;
bool m_printBeforePageHeader;
}; };
} }
#endif // LRREPORTHEADER_H #endif // LRREPORTHEADER_H

View File

@ -43,9 +43,11 @@ class SubDetailBand : public DataBandDesignIntf
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection) Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection)
Q_PROPERTY(bool keepFooterTogether READ keepFooterTogether WRITE setKeepFooterTogether) Q_PROPERTY(bool keepFooterTogether READ keepFooterTogether WRITE setKeepFooterTogether)
Q_PROPERTY(QColor alternateBackgroundColor READ alternateBackgroundColor WRITE setAlternateBackgroundColor) Q_PROPERTY(QColor alternateBackgroundColor READ alternateBackgroundColor WRITE setAlternateBackgroundColor)
Q_PROPERTY(bool useAlternateBackgroundColor READ useAlternateBackgroundColor WRITE setUseAlternateBackgroundColor)
public: public:
SubDetailBand(QObject* owner = 0, QGraphicsItem* parent=0); SubDetailBand(QObject* owner = 0, QGraphicsItem* parent=0);
bool isUnique() const {return false;} bool isUnique() const {return false;}
int bandNestingLevel(){ return 1;}
bool isHasHeader() const; bool isHasHeader() const;
bool isHasFooter() const; bool isHasFooter() const;
private: private:
@ -63,6 +65,8 @@ class SubDetailHeaderBand : public BandDesignIntf
public: public:
SubDetailHeaderBand(QObject* owner = 0, QGraphicsItem* parent=0); SubDetailHeaderBand(QObject* owner = 0, QGraphicsItem* parent=0);
bool isUnique() const; bool isUnique() const;
bool isHeader() const {return true;}
int bandNestingLevel(){ return 1;}
protected: protected:
QColor bandColor() const; QColor bandColor() const;
private: private:
@ -79,6 +83,7 @@ public:
SubDetailFooterBand(QObject* owner = 0, QGraphicsItem* parent=0); SubDetailFooterBand(QObject* owner = 0, QGraphicsItem* parent=0);
virtual bool isUnique() const; virtual bool isUnique() const;
bool isFooter() const{return true;} bool isFooter() const{return true;}
int bandNestingLevel(){ return 1;}
protected: protected:
QColor bandColor() const; QColor bandColor() const;
private: private:

View File

@ -12,7 +12,7 @@ public:
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0); virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
protected: protected:
QColor bandColor() const; QColor bandColor() const;
bool isUnique(){ return true;} virtual bool isUnique() const {return true;}
}; };
} // namespace LimeReport } // namespace LimeReport

View File

@ -41,7 +41,7 @@ namespace LimeReport{
ConnectionDialog::ConnectionDialog(LimeReport::IConnectionController *conControl, LimeReport::ConnectionDesc* connectionDesc, QWidget *parent) : ConnectionDialog::ConnectionDialog(LimeReport::IConnectionController *conControl, LimeReport::ConnectionDesc* connectionDesc, QWidget *parent) :
QDialog(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); ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose,true); setAttribute(Qt::WA_DeleteOnClose,true);
@ -56,6 +56,7 @@ ConnectionDialog::~ConnectionDialog()
void ConnectionDialog::init() void ConnectionDialog::init()
{ {
ui->cbbDrivers->addItems(QSqlDatabase::drivers()); ui->cbbDrivers->addItems(QSqlDatabase::drivers());
ui->cbbUseDefaultConnection->setEnabled(!m_controller->containsDefaultConnection());
} }
void ConnectionDialog::showEvent(QShowEvent *) void ConnectionDialog::showEvent(QShowEvent *)
@ -94,40 +95,34 @@ void ConnectionDialog::checkFieldsFill()
{ {
if (ui->leConnectionName->text().isEmpty()){throw LimeReport::ReportError(tr("Connection Name is empty"));} if (ui->leConnectionName->text().isEmpty()){throw LimeReport::ReportError(tr("Connection Name is empty"));}
if (!m_changeMode&&QSqlDatabase::connectionNames().contains(ui->leConnectionName->text())) { if (!m_changeMode&&QSqlDatabase::connectionNames().contains(ui->leConnectionName->text())) {
throw LimeReport::ReportError(tr("Connection with name ")+ui->leConnectionName->text()+tr(" already exists ")); throw LimeReport::ReportError(tr("Connection with name ")+ui->leConnectionName->text()+tr(" already exists! "));
} }
} }
bool ConnectionDialog::checkConnection() bool ConnectionDialog::checkConnection()
{ {
QScopedPointer<LimeReport::ConnectionDesc> con(uiToConnection()); 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())){ if (!m_controller->checkConnectionDesc(con.data())){
throw LimeReport::ReportError(m_controller->lastError()); throw LimeReport::ReportError(m_controller->lastError());
} }
return true; return true;
} }
LimeReport::ConnectionDesc *ConnectionDialog::uiToConnection(LimeReport::ConnectionDesc* conDesc) ConnectionDesc *ConnectionDialog::uiToConnection(LimeReport::ConnectionDesc* conDesc)
{ {
LimeReport::ConnectionDesc* result; LimeReport::ConnectionDesc* result;
if (conDesc) if (conDesc)
result = conDesc; result = conDesc;
else else
result = new LimeReport::ConnectionDesc(); result = new LimeReport::ConnectionDesc();
result ->setName(ui->leConnectionName->text()); result ->setName(ConnectionDesc::connectionNameForReport(ui->leConnectionName->text()));
result ->setHost(ui->leServerName->text()); result ->setHost(ui->leServerName->text());
result ->setDriver(ui->cbbDrivers->currentText()); result ->setDriver(ui->cbbDrivers->currentText());
result ->setUserName(ui->leUserName->text()); result ->setUserName(ui->leUserName->text());
result ->setPassword(ui->lePassword->text()); result ->setPassword(ui->lePassword->text());
result ->setDatabaseName(ui->leDataBase->text()); result ->setDatabaseName(ui->leDataBase->text());
result ->setAutoconnect(ui->cbAutoConnect->isChecked()); result ->setAutoconnect(ui->cbAutoConnect->isChecked());
result->setKeepDBCredentials(!ui->cbbKeepCredentials->isChecked());
return result ; return result ;
} }
@ -135,19 +130,37 @@ void ConnectionDialog::connectionToUI()
{ {
init(); init();
if (!m_connection) return; 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->leDataBase->setText(m_connection->databaseName());
ui->leServerName->setText(m_connection->host()); ui->leServerName->setText(m_connection->host());
ui->leUserName->setText(m_connection->userName()); ui->leUserName->setText(m_connection->userName());
ui->lePassword->setText(m_connection->password()); ui->lePassword->setText(m_connection->password());
ui->cbbDrivers->setCurrentIndex(ui->cbbDrivers->findText(m_connection->driver())); ui->cbbDrivers->setCurrentIndex(ui->cbbDrivers->findText(m_connection->driver()));
ui->cbAutoConnect->setChecked(m_connection->autoconnect()); ui->cbAutoConnect->setChecked(m_connection->autoconnect());
ui->cbbKeepCredentials->setChecked(!m_connection->keepDBCredentials());
} }
void ConnectionDialog::on_toolButton_clicked() void ConnectionDialog::on_toolButton_clicked()
{ {
ui->leDataBase->setText(QFileDialog::getOpenFileName()); 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 } // namespace LimeReport

View File

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

View File

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

View File

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

View File

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

View File

@ -101,7 +101,7 @@ void SQLEditDialog::accept()
else result.resultMode=SQLEditResult::SubProxy; else result.resultMode=SQLEditResult::SubProxy;
} }
result.connectionName=ui->cbbConnection->currentText(); result.connectionName = ConnectionDesc::connectionNameForReport(ui->cbbConnection->currentText());
result.datasourceName=ui->leDatasourceName->text(); result.datasourceName=ui->leDatasourceName->text();
result.sql=ui->textEditSQL->toPlainText(); result.sql=ui->textEditSQL->toPlainText();
result.dialogMode=m_dialogMode; result.dialogMode=m_dialogMode;
@ -147,11 +147,11 @@ void SQLEditDialog::hideEvent(QHideEvent *)
void SQLEditDialog::check() void SQLEditDialog::check()
{ {
if (ui->leDatasourceName->text().isEmpty()) throw LimeReport::ReportError(tr("Datasource Name is empty !")); if (ui->leDatasourceName->text().isEmpty()) throw LimeReport::ReportError(tr("Datasource Name is empty!"));
if (ui->textEditSQL->toPlainText().isEmpty() && (!ui->rbProxy) ) throw LimeReport::ReportError(tr("SQL is empty !")); if (ui->textEditSQL->toPlainText().isEmpty() && (!ui->rbProxy) ) throw LimeReport::ReportError(tr("SQL is empty!"));
if (m_dialogMode==AddMode){ if (m_dialogMode==AddMode){
if (m_datasources->containsDatasource(ui->leDatasourceName->text())){ if (m_datasources->containsDatasource(ui->leDatasourceName->text())){
throw LimeReport::ReportError(QString(tr("Datasource with name: \"%1\" already exists !")).arg(ui->leDatasourceName->text())); throw LimeReport::ReportError(QString(tr("Datasource with name: \"%1\" already exists!")).arg(ui->leDatasourceName->text()));
} }
} }
} }
@ -159,15 +159,19 @@ void SQLEditDialog::check()
void SQLEditDialog::initConnections() void SQLEditDialog::initConnections()
{ {
foreach(QString connectionName, QSqlDatabase::connectionNames()){ 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()){ foreach(QString connectionName, m_datasources->connectionNames()){
connectionName = (connectionName.compare(QSqlDatabase::defaultConnection)==0) ?
tr("defaultConnection") : connectionName;
if (ui->cbbConnection->findText(connectionName,Qt::MatchExactly )==-1) 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)); ui->cbbConnection->setCurrentIndex(ui->cbbConnection->findText(m_defaultConnection));
if (!m_oldDatasourceName.isEmpty()){ 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) void SQLEditDialog::setDefaultConnection(QString defaultConnection)
{ {
m_defaultConnection=defaultConnection; m_defaultConnection = ConnectionDesc::connectionNameForUser(defaultConnection);
} }
void SQLEditDialog::slotDataSourceNameEditing() void SQLEditDialog::slotDataSourceNameEditing()
@ -298,7 +302,11 @@ void SQLEditDialog::slotPreviewData()
QMessageBox::critical(this,tr("Attention"),tr("Connection is not specified")); QMessageBox::critical(this,tr("Attention"),tr("Connection is not specified"));
return; 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){ if (m_previewModel){
ui->tvPreview->setModel(m_previewModel.data()); ui->tvPreview->setModel(m_previewModel.data());
ui->gbDataPreview->setVisible(true); ui->gbDataPreview->setVisible(true);

View File

@ -0,0 +1,109 @@
/****************************************************************************
**
** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the Qt Designer of the Qt Toolkit.
**
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License versions 2.0 or 3.0 as published by the Free
** Software Foundation and appearing in the file LICENSE.GPL included in
** the packaging of this file. Please review the following information
** to ensure GNU General Public Licensing requirements will be met:
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html. In addition, as a special
** exception, Nokia gives you certain additional rights. These rights
** are described in the Nokia Qt GPL Exception version 1.3, included in
** the file GPL_EXCEPTION.txt in this package.
**
** Qt for Windows(R) Licensees
** As a special exception, Nokia, as the sole copyright holder for Qt
** Designer, grants users of the Qt/Eclipse Integration plug-in the
** right for the Qt/Eclipse Integration to link to functionality
** provided by Qt Designer and its related libraries.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
****************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of Qt Designer. This header
// file may change from version to version without notice, or even be removed.
//
// We mean it.
//
#ifndef PLUGINMANAGER_H
#define PLUGINMANAGER_H
#include "shared_global_p.h"
#include <QtCore/QMap>
#include <QtCore/QStringList>
QT_BEGIN_NAMESPACE
class QDesignerFormEditorInterface;
class QDesignerCustomWidgetInterface;
class QDesignerPluginManagerPrivate;
class QDESIGNER_SHARED_EXPORT QDesignerPluginManager: public QObject
{
Q_OBJECT
public:
explicit QDesignerPluginManager(QDesignerFormEditorInterface *core);
virtual ~QDesignerPluginManager();
QDesignerFormEditorInterface *core() const;
QObject *instance(const QString &plugin) const;
QStringList registeredPlugins() const;
QStringList findPlugins(const QString &path);
QStringList pluginPaths() const;
void setPluginPaths(const QStringList &plugin_paths);
QStringList disabledPlugins() const;
void setDisabledPlugins(const QStringList &disabled_plugins);
QStringList failedPlugins() const;
QString failureReason(const QString &pluginName) const;
QList<QObject*> instances() const;
QList<QDesignerCustomWidgetInterface*> registeredCustomWidgets() const;
bool registerNewPlugins();
public slots:
bool syncSettings();
void ensureInitialized();
private:
void updateRegisteredPlugins();
void registerPath(const QString &path);
void registerPlugin(const QString &plugin);
private:
static QStringList defaultPluginPaths();
QDesignerPluginManagerPrivate *m_d;
};
QT_END_NAMESPACE
#endif // PLUGINMANAGER_H

View File

@ -0,0 +1,126 @@
/****************************************************************************
**
** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the Qt Designer of the Qt Toolkit.
**
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License versions 2.0 or 3.0 as published by the Free
** Software Foundation and appearing in the file LICENSE.GPL included in
** the packaging of this file. Please review the following information
** to ensure GNU General Public Licensing requirements will be met:
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html. In addition, as a special
** exception, Nokia gives you certain additional rights. These rights
** are described in the Nokia Qt GPL Exception version 1.3, included in
** the file GPL_EXCEPTION.txt in this package.
**
** Qt for Windows(R) Licensees
** As a special exception, Nokia, as the sole copyright holder for Qt
** Designer, grants users of the Qt/Eclipse Integration plug-in the
** right for the Qt/Eclipse Integration to link to functionality
** provided by Qt Designer and its related libraries.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
****************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of Qt Designer. This header
// file may change from version to version without notice, or even be removed.
//
// We mean it.
//
#ifndef QDESIGNER_INTEGRATION_H
#define QDESIGNER_INTEGRATION_H
#include "shared_global_p.h"
#include <QtDesigner/QDesignerIntegrationInterface>
#include <QtCore/QObject>
QT_BEGIN_NAMESPACE
class QDesignerFormEditorInterface;
class QDesignerFormWindowInterface;
class QDesignerResourceBrowserInterface;
class QVariant;
class QWidget;
namespace qdesigner_internal {
struct Selection;
class QDesignerIntegrationPrivate;
class QDESIGNER_SHARED_EXPORT QDesignerIntegration: public QDesignerIntegrationInterface
{
Q_OBJECT
public:
explicit QDesignerIntegration(QDesignerFormEditorInterface *core, QObject *parent = 0);
virtual ~QDesignerIntegration();
static void requestHelp(const QDesignerFormEditorInterface *core, const QString &manual, const QString &document);
virtual QWidget *containerWindow(QWidget *widget) const;
// Load plugins into widget database and factory.
static void initializePlugins(QDesignerFormEditorInterface *formEditor);
void emitObjectNameChanged(QDesignerFormWindowInterface *formWindow, QObject *object, const QString &newName, const QString &oldName);
// Create a resource browser specific to integration. Language integration takes precedence
virtual QDesignerResourceBrowserInterface *createResourceBrowser(QWidget *parent = 0);
signals:
void propertyChanged(QDesignerFormWindowInterface *formWindow, const QString &name, const QVariant &value);
void objectNameChanged(QDesignerFormWindowInterface *formWindow, QObject *object, const QString &newName, const QString &oldName);
void helpRequested(const QString &manual, const QString &document);
public slots:
virtual void updateProperty(const QString &name, const QVariant &value, bool enableSubPropertyHandling);
// Additional signals of designer property editor
// virtual void updatePropertyComment(const QString &name, const QString &value);
virtual void resetProperty(const QString &name);
virtual void addDynamicProperty(const QString &name, const QVariant &value);
virtual void removeDynamicProperty(const QString &name);
virtual void updateActiveFormWindow(QDesignerFormWindowInterface *formWindow);
virtual void setupFormWindow(QDesignerFormWindowInterface *formWindow);
virtual void updateSelection();
virtual void updateGeometry();
virtual void activateWidget(QWidget *widget);
void updateCustomWidgetPlugins();
private slots:
void updatePropertyPrivate(const QString &name, const QVariant &value);
private:
void initialize();
void getSelection(Selection &s);
QObject *propertyEditorObject();
QDesignerIntegrationPrivate *m_d;
};
} // namespace qdesigner_internal
QT_END_NAMESPACE
#endif // QDESIGNER_INTEGRATION_H

View File

@ -0,0 +1,72 @@
/****************************************************************************
**
** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the Qt Designer of the Qt Toolkit.
**
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License versions 2.0 or 3.0 as published by the Free
** Software Foundation and appearing in the file LICENSE.GPL included in
** the packaging of this file. Please review the following information
** to ensure GNU General Public Licensing requirements will be met:
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html. In addition, as a special
** exception, Nokia gives you certain additional rights. These rights
** are described in the Nokia Qt GPL Exception version 1.3, included in
** the file GPL_EXCEPTION.txt in this package.
**
** Qt for Windows(R) Licensees
** As a special exception, Nokia, as the sole copyright holder for Qt
** Designer, grants users of the Qt/Eclipse Integration plug-in the
** right for the Qt/Eclipse Integration to link to functionality
** provided by Qt Designer and its related libraries.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
****************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of Qt Designer. This header
// file may change from version to version without notice, or even be removed.
//
// We mean it.
//
#ifndef SHARED_GLOBAL_H
#define SHARED_GLOBAL_H
#include <QtCore/qglobal.h>
#ifdef QT_DESIGNER_STATIC
#define QDESIGNER_SHARED_EXTERN
#define QDESIGNER_SHARED_IMPORT
#else
#define QDESIGNER_SHARED_EXTERN Q_DECL_EXPORT
#define QDESIGNER_SHARED_IMPORT Q_DECL_IMPORT
#endif
#ifndef QT_NO_SHARED_EXPORT
# ifdef QDESIGNER_SHARED_LIBRARY
# define QDESIGNER_SHARED_EXPORT QDESIGNER_SHARED_EXTERN
# else
# define QDESIGNER_SHARED_EXPORT QDESIGNER_SHARED_IMPORT
# endif
#else
# define QDESIGNER_SHARED_EXPORT
#endif
#endif // SHARED_GLOBAL_H

View File

@ -0,0 +1,10 @@
This is a new Designer integration, started on 28.02.2008.
The reason for it is the introduction of layout caching
in Qt 4.4, which unearthed a lot of mainwindow-size related
bugs in Designer and all integrations.
The goal of it is to have a closed layout chain from
integration top level to form window.
Friedemann

View File

@ -0,0 +1,11 @@
INCLUDEPATH *= $$PWD $$PWD/..
SOURCES += $$PWD/widgethost.cpp \
$$PWD/sizehandlerect.cpp \
$$PWD/formresizer.cpp
HEADERS += $$PWD/widgethost.h \
$$PWD/sizehandlerect.h \
$$PWD/formresizer.h \
$$PWD/widgethostconstants.h \
$$PWD/../namespace_global.h

View File

@ -0,0 +1,198 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#include "formresizer.h"
#include "sizehandlerect.h"
#include "widgethostconstants.h"
#include <QDebug>
#include <QDesignerFormWindowInterface>
#include <QResizeEvent>
#include <QPalette>
#include <QLayout>
#include <QFrame>
#include <QResizeEvent>
enum { debugFormResizer = 0 };
using namespace SharedTools::Internal;
FormResizer::FormResizer(QWidget *parent) :
QWidget(parent),
m_frame(new QFrame),
m_formWindow(0)
{
// Make the resize grip of a mainwindow form find us as resizable window.
setWindowFlags(windowFlags() | Qt::SubWindow);
setBackgroundRole(QPalette::Base);
QVBoxLayout *handleLayout = new QVBoxLayout(this);
handleLayout->setMargin(SELECTION_MARGIN);
handleLayout->addWidget(m_frame);
m_frame->setFrameStyle(QFrame::Panel | QFrame::Raised);
QVBoxLayout *layout = new QVBoxLayout(m_frame);
layout->setMargin(0);
// handles
m_handles.reserve(SizeHandleRect::Left);
for (int i = SizeHandleRect::LeftTop; i <= SizeHandleRect::Left; ++i) {
SizeHandleRect *shr = new SizeHandleRect(this, static_cast<SizeHandleRect::Direction>(i), this);
connect(shr, SIGNAL(mouseButtonReleased(QRect,QRect)), this, SIGNAL(formWindowSizeChanged(QRect,QRect)));
m_handles.push_back(shr);
}
setState(SelectionHandleActive);
updateGeometry();
}
void FormResizer::updateGeometry()
{
const QRect &geom = m_frame->geometry();
if (debugFormResizer)
qDebug() << "FormResizer::updateGeometry() " << size() << " frame " << geom;
const int w = SELECTION_HANDLE_SIZE;
const int h = SELECTION_HANDLE_SIZE;
const Handles::iterator hend = m_handles.end();
for (Handles::iterator it = m_handles.begin(); it != hend; ++it) {
SizeHandleRect *hndl = *it;;
switch (hndl->dir()) {
case SizeHandleRect::LeftTop:
hndl->move(geom.x() - w / 2, geom.y() - h / 2);
break;
case SizeHandleRect::Top:
hndl->move(geom.x() + geom.width() / 2 - w / 2, geom.y() - h / 2);
break;
case SizeHandleRect::RightTop:
hndl->move(geom.x() + geom.width() - w / 2, geom.y() - h / 2);
break;
case SizeHandleRect::Right:
hndl->move(geom.x() + geom.width() - w / 2, geom.y() + geom.height() / 2 - h / 2);
break;
case SizeHandleRect::RightBottom:
hndl->move(geom.x() + geom.width() - w / 2, geom.y() + geom.height() - h / 2);
break;
case SizeHandleRect::Bottom:
hndl->move(geom.x() + geom.width() / 2 - w / 2, geom.y() + geom.height() - h / 2);
break;
case SizeHandleRect::LeftBottom:
hndl->move(geom.x() - w / 2, geom.y() + geom.height() - h / 2);
break;
case SizeHandleRect::Left:
hndl->move(geom.x() - w / 2, geom.y() + geom.height() / 2 - h / 2);
break;
default:
break;
}
}
}
void FormResizer::update()
{
const Handles::iterator hend = m_handles.end();
for (Handles::iterator it = m_handles.begin(); it != hend; ++it) {
(*it)->update();
}
}
void FormResizer::setState(SelectionHandleState st)
{
if (debugFormResizer)
qDebug() << "FormResizer::setState " << st;
const Handles::iterator hend = m_handles.end();
for (Handles::iterator it = m_handles.begin(); it != hend; ++it)
(*it)->setState(st);
}
void FormResizer::setFormWindow(QDesignerFormWindowInterface *fw)
{
if (debugFormResizer)
qDebug() << "FormResizer::setFormWindow " << fw;
QVBoxLayout *layout = qobject_cast<QVBoxLayout *>(m_frame->layout());
Q_ASSERT(layout);
if (layout->count())
delete layout->takeAt(0);
m_formWindow = fw;
if (m_formWindow)
layout->addWidget(m_formWindow);
mainContainerChanged();
connect(fw, SIGNAL(mainContainerChanged(QWidget*)), this, SLOT(mainContainerChanged()));
}
void FormResizer::resizeEvent(QResizeEvent *event)
{
if (debugFormResizer)
qDebug() << ">FormResizer::resizeEvent" << event->size();
updateGeometry();
QWidget::resizeEvent(event);
if (debugFormResizer)
qDebug() << "<FormResizer::resizeEvent";
}
QSize FormResizer::decorationSize() const
{
const int lineWidth = m_frame->lineWidth();
const QMargins frameMargins = m_frame->contentsMargins();
const int margin = 2* SELECTION_MARGIN;
QSize size = QSize( margin, margin );
size += QSize( qMax( frameMargins.left(), lineWidth ), qMax( frameMargins.top(), lineWidth ) );
size += QSize( qMax( frameMargins.right(), lineWidth ), qMax( frameMargins.bottom(), lineWidth ) );
return size;
}
QWidget *FormResizer::mainContainer()
{
if (m_formWindow)
return m_formWindow->mainContainer();
return 0;
}
void FormResizer::mainContainerChanged()
{
const QSize maxWidgetSize = QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
if (const QWidget *mc = mainContainer()) {
// Set Maximum size which is not handled via a hint (as opposed to minimum size)
const QSize maxWidgetSize = QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
const QSize formMaxSize = mc->maximumSize();
QSize newMaxSize = maxWidgetSize;
if (formMaxSize != maxWidgetSize)
newMaxSize = formMaxSize + decorationSize();
if (debugFormResizer)
qDebug() << "FormResizer::mainContainerChanged" << mc << " Size " << mc->size()<< newMaxSize;
setMaximumSize(newMaxSize);
resize(decorationSize() + mc->size());
} else {
setMaximumSize(maxWidgetSize);
}
}

View File

@ -0,0 +1,99 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#ifndef FORMRESIZER_H
#define FORMRESIZER_H
#include "namespace_global.h"
#include "widgethostconstants.h"
#include <QWidget>
#include <QVector>
QT_FORWARD_DECLARE_CLASS(QDesignerFormWindowInterface)
QT_FORWARD_DECLARE_CLASS(QFrame)
namespace SharedTools {
namespace Internal {
class SizeHandleRect;
/* A window to embed a form window interface as follows:
*
* Widget
* |
* +---+----+
* | |
* | |
* Handles QVBoxLayout [margin: SELECTION_MARGIN]
* |
* Frame [margin: lineWidth]
* |
* QVBoxLayout
* |
* QDesignerFormWindowInterface
*
* Can be embedded into a QScrollArea. */
class FormResizer : public QWidget
{
Q_OBJECT
public:
FormResizer(QWidget *parent = 0);
void updateGeometry();
void setState(SelectionHandleState st);
void update();
void setFormWindow(QDesignerFormWindowInterface *fw);
signals:
void formWindowSizeChanged(const QRect &oldGeo, const QRect &newGeo);
protected:
virtual void resizeEvent(QResizeEvent *event);
private slots:
void mainContainerChanged();
private:
QSize decorationSize() const;
QWidget *mainContainer();
QFrame *m_frame;
typedef QVector<SizeHandleRect*> Handles;
Handles m_handles;
QDesignerFormWindowInterface * m_formWindow;
};
}
} // namespace SharedTools
#endif // FORMRESIZER_H

View File

@ -0,0 +1,188 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#include "sizehandlerect.h"
#include "widgethostconstants.h"
#include <QDesignerFormWindowInterface>
#include <QMouseEvent>
#include <QPainter>
#include <QFrame>
#include <QDebug>
enum { debugSizeHandle = 0 };
using namespace SharedTools::Internal;
SizeHandleRect::SizeHandleRect(QWidget *parent, Direction d, QWidget *resizable) :
QWidget(parent),
m_dir(d),
m_resizable(resizable),
m_state(SelectionHandleOff)
{
setBackgroundRole(QPalette::Text);
setAutoFillBackground(true);
setFixedSize(SELECTION_HANDLE_SIZE, SELECTION_HANDLE_SIZE);
setMouseTracking(false);
updateCursor();
}
void SizeHandleRect::updateCursor()
{
switch (m_dir) {
case Right:
case RightTop:
setCursor(Qt::SizeHorCursor);
return;
case RightBottom:
setCursor(Qt::SizeFDiagCursor);
return;
case LeftBottom:
case Bottom:
setCursor(Qt::SizeVerCursor);
return;
default:
break;
}
setCursor(Qt::ArrowCursor);
}
void SizeHandleRect::paintEvent(QPaintEvent *)
{
switch (m_state) {
case SelectionHandleOff:
break;
case SelectionHandleInactive: {
QPainter p(this);
p.setPen(Qt::red);
p.drawRect(0, 0, width() - 1, height() - 1);
}
break;
case SelectionHandleActive: {
QPainter p(this);
p.setPen(Qt::blue);
p.drawRect(0, 0, width() - 1, height() - 1);
}
break;
}
}
void SizeHandleRect::mousePressEvent(QMouseEvent *e)
{
e->accept();
if (e->button() != Qt::LeftButton)
return;
m_startSize = m_curSize = m_resizable->size();
m_startPos = m_curPos = m_resizable->mapFromGlobal(e->globalPos());
if (debugSizeHandle)
qDebug() << "SizeHandleRect::mousePressEvent" << m_startSize << m_startPos << m_curPos;
}
void SizeHandleRect::mouseMoveEvent(QMouseEvent *e)
{
if (!(e->buttons() & Qt::LeftButton))
return;
// Try resize with delta against start position.
// We don't take little deltas in consecutive move events as this
// causes the handle and the mouse cursor to become out of sync
// once a min/maxSize limit is hit. When the cursor reenters the valid
// areas, it will now snap to it.
m_curPos = m_resizable->mapFromGlobal(e->globalPos());
QSize delta = QSize(m_curPos.x() - m_startPos.x(), m_curPos.y() - m_startPos.y());
switch (m_dir) {
case Right:
case RightTop: // Only width
delta.setHeight(0);
break;
case RightBottom: // All dimensions
break;
case LeftBottom:
case Bottom: // Only height
delta.setWidth(0);
break;
default:
delta = QSize(0, 0);
break;
}
if (delta != QSize(0, 0))
tryResize(delta);
}
void SizeHandleRect::mouseReleaseEvent(QMouseEvent *e)
{
if (e->button() != Qt::LeftButton)
return;
e->accept();
if (m_startSize != m_curSize) {
const QRect startRect = QRect(0, 0, m_startPos.x(), m_startPos.y());
const QRect newRect = QRect(0, 0, m_curPos.x(), m_curPos.y());
if (debugSizeHandle)
qDebug() << "SizeHandleRect::mouseReleaseEvent" << startRect << newRect;
emit mouseButtonReleased(startRect, newRect);
}
}
void SizeHandleRect::tryResize(const QSize &delta)
{
// Try resize with delta against start position
QSize newSize = m_startSize + delta;
newSize = newSize.expandedTo(m_resizable->minimumSizeHint());
newSize = newSize.expandedTo(m_resizable->minimumSize());
newSize = newSize.boundedTo(m_resizable->maximumSize());
if (newSize == m_resizable->size())
return;
if (debugSizeHandle)
qDebug() << "SizeHandleRect::tryResize by (" << m_startSize << '+' << delta << ')' << newSize;
m_resizable->resize(newSize);
m_curSize = m_resizable->size();
}
void SizeHandleRect::setState(SelectionHandleState st)
{
if (st == m_state)
return;
switch (st) {
case SelectionHandleOff:
hide();
break;
case SelectionHandleInactive:
case SelectionHandleActive:
show();
raise();
break;
}
m_state = st;
}

View File

@ -0,0 +1,82 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#ifndef SIZEHANDLERECT_H
#define SIZEHANDLERECT_H
#include "namespace_global.h"
#include "widgethostconstants.h"
#include <QWidget>
#include <QPoint>
namespace SharedTools {
namespace Internal {
class SizeHandleRect : public QWidget
{
Q_OBJECT
public:
enum Direction { LeftTop, Top, RightTop, Right, RightBottom, Bottom, LeftBottom, Left };
SizeHandleRect(QWidget *parent, Direction d, QWidget *resizable);
Direction dir() const { return m_dir; }
void updateCursor();
void setState(SelectionHandleState st);
signals:
void mouseButtonReleased(const QRect &, const QRect &);
protected:
void paintEvent(QPaintEvent *e);
void mousePressEvent(QMouseEvent *e);
void mouseMoveEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
private:
void tryResize(const QSize &delta);
private:
const Direction m_dir;
QPoint m_startPos;
QPoint m_curPos;
QSize m_startSize;
QSize m_curSize;
QWidget *m_resizable;
SelectionHandleState m_state;
};
}
} // namespace SharedTools
#endif // SIZEHANDLERECT_H

View File

@ -0,0 +1,111 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#include "widgethost.h"
#include "formresizer.h"
#include "widgethostconstants.h"
#include <QDesignerFormWindowInterface>
#include <QDesignerFormWindowCursorInterface>
#include <QPalette>
#include <QLayout>
#include <QFrame>
#include <QResizeEvent>
#include <QDebug>
using namespace SharedTools;
// ---------- WidgetHost
WidgetHost::WidgetHost(QWidget *parent, QDesignerFormWindowInterface *formWindow) :
QScrollArea(parent),
m_formWindow(0),
m_formResizer(new Internal::FormResizer)
{
setWidget(m_formResizer);
// Re-set flag (gets cleared by QScrollArea): Make the resize grip of a mainwindow form find the resizer as resizable window.
m_formResizer->setWindowFlags(m_formResizer->windowFlags() | Qt::SubWindow);
setFormWindow(formWindow);
}
WidgetHost::~WidgetHost()
{
if (m_formWindow)
delete m_formWindow;
}
void WidgetHost::setFormWindow(QDesignerFormWindowInterface *fw)
{
m_formWindow = fw;
if (!fw)
return;
m_formResizer->setFormWindow(fw);
setBackgroundRole(QPalette::Base);
m_formWindow->setAutoFillBackground(true);
m_formWindow->setBackgroundRole(QPalette::Background);
connect(m_formResizer, SIGNAL(formWindowSizeChanged(QRect, QRect)),
this, SLOT(fwSizeWasChanged(QRect, QRect)));
connect(m_formWindow, SIGNAL(destroyed(QObject*)), this, SLOT(formWindowDeleted(QObject*)));
}
QSize WidgetHost::formWindowSize() const
{
if (!m_formWindow || !m_formWindow->mainContainer())
return QSize();
return m_formWindow->mainContainer()->size();
}
void WidgetHost::fwSizeWasChanged(const QRect &, const QRect &)
{
// newGeo is the mouse coordinates, thus moving the Right will actually emit wrong height
emit formWindowSizeChanged(formWindowSize().width(), formWindowSize().height());
}
void WidgetHost::formWindowDeleted(QObject *object)
{
if (object == m_formWindow) m_formWindow = 0;
}
void WidgetHost::updateFormWindowSelectionHandles(bool active)
{
Internal::SelectionHandleState state = Internal::SelectionHandleOff;
const QDesignerFormWindowCursorInterface *cursor = m_formWindow->cursor();
if (cursor->isWidgetSelected(m_formWindow->mainContainer()))
state = active ? Internal::SelectionHandleActive : Internal::SelectionHandleInactive;
m_formResizer->setState(state);
}
QWidget *WidgetHost::integrationContainer() const
{
return m_formResizer;
}

View File

@ -0,0 +1,80 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#ifndef WIDGETHOST_H
#define WIDGETHOST_H
#include "namespace_global.h"
#include <QScrollArea>
QT_FORWARD_DECLARE_CLASS(QDesignerFormWindowInterface)
namespace SharedTools {
namespace Internal {
class FormResizer;
}
/* A scroll area that embeds a Designer form window */
class WidgetHost : public QScrollArea
{
Q_OBJECT
public:
WidgetHost(QWidget *parent = 0, QDesignerFormWindowInterface *formWindow = 0);
virtual ~WidgetHost();
// Show handles if active and main container is selected.
void updateFormWindowSelectionHandles(bool active);
inline QDesignerFormWindowInterface *formWindow() const { return m_formWindow; }
QWidget *integrationContainer() const;
protected:
void setFormWindow(QDesignerFormWindowInterface *fw);
signals:
void formWindowSizeChanged(int, int);
private slots:
void fwSizeWasChanged(const QRect &, const QRect &);
void formWindowDeleted(QObject* object);
private:
QSize formWindowSize() const;
QDesignerFormWindowInterface *m_formWindow;
Internal::FormResizer *m_formResizer;
QSize m_oldFakeWidgetSize;
};
} // namespace SharedTools
#endif // WIDGETHOST_H

View File

@ -0,0 +1,41 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#ifndef WIDGETHOST_CONSTANTS_H
#define WIDGETHOST_CONSTANTS_H
namespace SharedTools {
namespace Internal {
enum { SELECTION_HANDLE_SIZE = 6, SELECTION_MARGIN = 10 };
enum SelectionHandleState { SelectionHandleOff, SelectionHandleInactive, SelectionHandleActive };
}
}
#endif // WIDGETHOST_CONSTANTS_H

View File

@ -0,0 +1,48 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#ifndef NAMESPACE_GLOBAL_H
#define NAMESPACE_GLOBAL_H
#include <QtCore/qglobal.h>
#if QT_VERSION < 0x040400
# define QT_ADD_NAMESPACE(name) ::name
# define QT_USE_NAMESPACE
# define QT_BEGIN_NAMESPACE
# define QT_END_NAMESPACE
# define QT_BEGIN_INCLUDE_NAMESPACE
# define QT_END_INCLUDE_NAMESPACE
# define QT_BEGIN_MOC_NAMESPACE
# define QT_END_MOC_NAMESPACE
# define QT_FORWARD_DECLARE_CLASS(name) class name;
# define QT_MANGLE_NAMESPACE(name) name
#endif
#endif // NAMESPACE_GLOBAL_H

View File

@ -0,0 +1,27 @@
include(../../common.pri)
include($$PWD/3rdparty/qtcreator/designerintegrationv2/designerintegration.pri)
INCLUDEPATH *= $$PWD/3rdparty/designer
greaterThan(QT_MAJOR_VERSION, 4) {
contains(QT,uitools){
DEFINES += HAVE_QTDESIGNER_INTEGRATION
}
}
lessThan(QT_MAJOR_VERSION, 5){
contains(CONFIG,uitools){
DEFINES += HAVE_QTDESIGNER_INTEGRATION
}
}
greaterThan(QT_MAJOR_VERSION, 4) {
QT *= designer designercomponents-private
} else {
CONFIG *= designer
qtAddLibrary( QtDesignerComponents )
}
SOURCES += $$PWD/lrdialogdesigner.cpp
HEADERS += $$PWD/lrdialogdesigner.h
RESOURCES += \
$$PWD/dialogdesigner.qrc

View File

@ -0,0 +1,12 @@
<RCC>
<qresource prefix="/images">
<file>images/buddytool.png</file>
<file>images/editform.png</file>
<file>images/signalslottool.png</file>
<file>images/tabordertool.png</file>
<file>images/widgettool.png</file>
</qresource>
<qresource prefix="/templates">
<file>templates/Dialog.ui</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 997 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,358 @@
#include "lrdialogdesigner.h"
#include <QPluginLoader>
#include <QDesignerComponents>
#include <QDesignerFormEditorInterface>
#include <QDesignerFormWindowInterface>
#include <QDesignerFormWindowManagerInterface>
#include <QDesignerFormEditorPluginInterface>
#include <QDesignerWidgetBoxInterface>
#include <QDesignerActionEditorInterface>
#include <QDesignerPropertyEditorInterface>
#include <QDesignerObjectInspectorInterface>
#include <QDesignerFormEditorInterface>
#include <QAction>
#include <QDebug>
#include <QVBoxLayout>
#if HAVE_QT5
#include <QDesignerIntegration>
#endif
#if HAVE_QT4
#include "qdesigner_integration_p.h"
#include <QtDesigner/QDesignerIntegrationInterface>
#endif
#include "pluginmanager_p.h"
#include "widgethost.h"
#include <abstractobjectinspector.h>
namespace LimeReport{
DialogDesignerManager::DialogDesignerManager(QObject *parent) : QObject(parent)
{
QDesignerComponents::initializeResources();
m_formEditor = QDesignerComponents::createFormEditor(this);
QDesignerComponents::initializePlugins(m_formEditor);
QDesignerComponents::createTaskMenu(m_formEditor, this);
m_editWidgetsAction = new QAction(tr("Edit Widgets"), this);
m_editWidgetsAction->setIcon(QIcon(":/images/images/widgettool.png"));
m_editWidgetsAction->setEnabled(false);
connect(m_editWidgetsAction, SIGNAL(triggered()), this, SLOT(slotEditWidgets()));
connect(m_formEditor->formWindowManager(), SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)),
this, SLOT(slotActiveFormWindowChanged(QDesignerFormWindowInterface*)) );
m_modes = new QActionGroup(this);
m_modes->setExclusive(true);
m_modes->addAction(m_editWidgetsAction);
foreach ( QObject* o, QPluginLoader::staticInstances() << m_formEditor->pluginManager()->instances() )
{
if ( QDesignerFormEditorPluginInterface* fep = qobject_cast<QDesignerFormEditorPluginInterface*>( o ) )
{
if ( !fep->isInitialized() )
fep->initialize( m_formEditor );
fep->action()->setCheckable( true );
fep->action()->setIcon(QIcon(iconPathByName(fep->action()->objectName())));
m_modes->addAction(fep->action());
}
}
m_widgetBox = QDesignerComponents::createWidgetBox(m_formEditor, 0);
m_widgetBox->setWindowTitle(tr("Widget Box"));
m_widgetBox->setObjectName(QLatin1String("WidgetBox"));
m_formEditor->setWidgetBox(m_widgetBox);
m_formEditor->setTopLevel(m_widgetBox);
m_designerToolWindows.append(m_widgetBox);
connect(m_widgetBox, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) );
m_objectInspector = QDesignerComponents::createObjectInspector(m_formEditor, 0);
m_objectInspector->setWindowTitle(tr("Object Inspector"));
m_objectInspector->setObjectName(QLatin1String("ObjectInspector"));
m_formEditor->setObjectInspector(m_objectInspector);
m_designerToolWindows.append(m_objectInspector);
connect(m_objectInspector, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) );
m_propertyEditor = QDesignerComponents::createPropertyEditor(m_formEditor, 0);
m_propertyEditor->setWindowTitle(tr("Property Editor"));
m_propertyEditor->setObjectName(QLatin1String("PropertyEditor"));
m_formEditor->setPropertyEditor(m_propertyEditor);
m_designerToolWindows.append(m_propertyEditor);
connect(m_propertyEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) );
m_signalSlotEditor = QDesignerComponents::createSignalSlotEditor(m_formEditor, 0);
m_signalSlotEditor->setWindowTitle(tr("Signals && Slots Editor"));
m_signalSlotEditor->setObjectName(QLatin1String("SignalsAndSlotsEditor"));
m_designerToolWindows.append(m_signalSlotEditor);
connect(m_signalSlotEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) );
m_resourcesEditor = QDesignerComponents::createResourceEditor(m_formEditor, 0);
m_resourcesEditor->setWindowTitle(tr("Resource Editor"));
m_resourcesEditor->setObjectName(QLatin1String("ResourceEditor"));
m_designerToolWindows.append(m_resourcesEditor);
connect(m_resourcesEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) );
m_actionEditor = QDesignerComponents::createActionEditor(m_formEditor, 0);
m_actionEditor->setWindowTitle(tr("Action Editor"));
m_actionEditor->setObjectName("ActionEditor");
m_formEditor->setActionEditor(m_actionEditor);
m_designerToolWindows.append(m_actionEditor);
connect(m_actionEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) );
#ifdef HAVE_QT4
m_designerIntegration = new qdesigner_internal::QDesignerIntegration(m_formEditor,this);
#endif
#ifdef HAVE_QT5
m_designerIntegration = new QDesignerIntegration(m_formEditor,this);
#endif
m_formEditor->setIntegration(m_designerIntegration);
}
DialogDesignerManager::~DialogDesignerManager()
{
for (int i = 0; i<m_designerToolWindows.size();++i){
if (m_designerToolWindows[i])
delete m_designerToolWindows[i];
}
delete m_designerIntegration;
delete m_formEditor;
}
void DialogDesignerManager::initToolBar(QToolBar *tb)
{
tb->setIconSize(QSize(16,16));
m_formEditor->formWindowManager()->actionCopy()->setIcon(QIcon(":/report/images/copy"));
tb->addAction(m_formEditor->formWindowManager()->actionCopy());
m_formEditor->formWindowManager()->actionPaste()->setIcon(QIcon(":/report/images/paste"));
tb->addAction(m_formEditor->formWindowManager()->actionPaste());
m_formEditor->formWindowManager()->actionCut()->setIcon(QIcon(":/report/images/cut"));
tb->addAction(m_formEditor->formWindowManager()->actionCut());
m_formEditor->formWindowManager()->actionUndo()->setIcon(QIcon(":/report/images/undo"));
tb->addAction(m_formEditor->formWindowManager()->actionUndo());
m_formEditor->formWindowManager()->actionRedo()->setIcon(QIcon(":/report/images/redo"));
tb->addAction(m_formEditor->formWindowManager()->actionRedo());
tb->addActions(m_modes->actions());
tb->addAction(m_formEditor->formWindowManager()->actionHorizontalLayout());
tb->addAction(m_formEditor->formWindowManager()->actionVerticalLayout());
tb->addAction(m_formEditor->formWindowManager()->actionSplitHorizontal());
tb->addAction(m_formEditor->formWindowManager()->actionSplitVertical());
tb->addAction(m_formEditor->formWindowManager()->actionGridLayout());
m_formEditor->formWindowManager()->actionFormLayout()->setIcon(QIcon(":/images/images/editform.png"));
tb->addAction(m_formEditor->formWindowManager()->actionFormLayout());
tb->addAction(m_formEditor->formWindowManager()->actionBreakLayout());
tb->addAction(m_formEditor->formWindowManager()->actionAdjustSize());
}
QWidget *DialogDesignerManager::createFormEditor(const QString &content)
{
QDesignerFormWindowInterface* wnd = m_formEditor->formWindowManager()->createFormWindow(0, Qt::Window);
wnd->setContents(content);
m_formEditor->formWindowManager()->setActiveFormWindow(wnd);
m_formEditor->objectInspector()->setFormWindow(wnd);
wnd->editWidgets();
DialogDesigner* dialogDesigner = new DialogDesigner(wnd, m_formEditor);
connect(dialogDesigner, SIGNAL(dialogChanged(QString)), this, SIGNAL(dialogChanged(QString)));
connect(dialogDesigner, SIGNAL(dialogNameChanged(QString,QString)), this, SIGNAL(dialogNameChanged(QString,QString)));
connect(dialogDesigner, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)));
m_dialogDesigners.append(dialogDesigner);
return dialogDesigner;
}
QByteArray DialogDesignerManager::getDialogDescription(QWidget *form)
{
QByteArray result;
DialogDesigner* dialogDesigner = dynamic_cast<DialogDesigner*>(form);
Q_ASSERT(dialogDesigner != NULL);
//SharedTools::WidgetHost* wh = dynamic_cast<SharedTools::WidgetHost*>(form);
if (dialogDesigner){
result = dialogDesigner->dialogContent();
//wh->formWindow()->setDirty(false);
}
return result;
}
void DialogDesignerManager::setActiveEditor(QWidget *widget)
{
SharedTools::WidgetHost* wh = dynamic_cast<SharedTools::WidgetHost*>(widget);
if (wh){
m_formEditor->formWindowManager()->setActiveFormWindow(wh->formWindow());
}
}
void DialogDesignerManager::setDirty(bool value)
{
foreach(DialogDesigner* dialogDesigner, m_dialogDesigners){
dialogDesigner->setChanged(value);
}
}
QWidget* DialogDesignerManager::widgetBox() const
{
return m_widgetBox;
}
QWidget* DialogDesignerManager::actionEditor() const
{
return m_actionEditor;
}
QWidget* DialogDesignerManager::propertyEditor() const
{
return m_propertyEditor;
}
QWidget* DialogDesignerManager::objectInspector() const
{
return m_objectInspector;
}
QWidget *DialogDesignerManager::signalSlotEditor() const
{
return m_signalSlotEditor;
}
QWidget *DialogDesignerManager::resourcesEditor() const
{
return m_resourcesEditor;
}
void DialogDesignerManager::slotObjectDestroyed(QObject* object)
{
QList<DialogDesigner*>::Iterator it = m_dialogDesigners.begin();
while(it!=m_dialogDesigners.end()){
if (*it == object){
it = m_dialogDesigners.erase(it);
return;
} else {
++it;
}
}
for ( int i = 0; i<m_designerToolWindows.size();++i){
m_designerToolWindows[i] = m_designerToolWindows[i] == object ? 0 : m_designerToolWindows[i];
}
}
void DialogDesignerManager::slotEditWidgets()
{
for (int i = 0; i<m_formEditor->formWindowManager()->formWindowCount(); ++i){
m_formEditor->formWindowManager()->formWindow(i)->editWidgets();
}
}
void DialogDesignerManager::slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow)
{
if (formWindow){
m_editWidgetsAction->setEnabled(true);
m_activeWindowName = formWindow->objectName();
}
}
QString DialogDesignerManager::iconPathByName(const QString &name)
{
if (name.compare("__qt_edit_signals_slots_action") == 0)
return ":/images/images/signalslottool.png";
if (name.compare("__qt_edit_buddies_action") == 0)
return ":/images/images/buddytool.png";
if (name.compare("_qt_edit_tab_order_action") == 0)
return ":/images/images/tabordertool.png";
return "";
}
DialogDesigner::DialogDesigner(QDesignerFormWindowInterface* wnd, QDesignerFormEditorInterface* formEditor, QWidget *parent, Qt::WindowFlags flags)
:QWidget(parent, flags), m_formEditor(formEditor)
{
m_dialogName = wnd->mainContainer()->objectName();
connect(wnd, SIGNAL(changed()), this, SLOT(slotDialogChanged()));
m_designerHolder = new SharedTools::WidgetHost(this,wnd);
m_designerHolder->setFrameStyle( QFrame::NoFrame | QFrame::Plain );
m_designerHolder->setFocusProxy( wnd );
QVBoxLayout* l = new QVBoxLayout(this);
l->addWidget(m_designerHolder);
setLayout(l);
}
DialogDesigner::~DialogDesigner(){}
QString DialogDesigner::dialogName() const
{
return m_dialogName;
}
void DialogDesigner::setDialogName(const QString &dialogName)
{
m_dialogName = dialogName;
}
bool DialogDesigner::isChanged()
{
return m_designerHolder->formWindow()->isDirty();
}
void DialogDesigner::setChanged(bool value)
{
m_designerHolder->formWindow()->setDirty(value);
}
QByteArray DialogDesigner::dialogContent()
{
if (m_designerHolder && m_designerHolder->formWindow())
return m_designerHolder->formWindow()->contents().toUtf8();
return QByteArray();
}
void DialogDesigner::undo()
{
Q_ASSERT(m_formEditor != NULL);
if (m_formEditor){
m_formEditor->formWindowManager()->actionUndo()->trigger();
}
}
void DialogDesigner::redo()
{
Q_ASSERT(m_formEditor != NULL);
if (m_formEditor){
m_formEditor->formWindowManager()->actionRedo()->trigger();
}
}
void DialogDesigner::slotMainContainerNameChanged(QString newName)
{
if (m_dialogName.compare(newName) != 0){
emit dialogNameChanged(m_dialogName, newName);
m_dialogName = newName;
}
}
void DialogDesigner::slotDialogChanged()
{
Q_ASSERT(m_designerHolder != NULL);
if (m_designerHolder && m_designerHolder->formWindow()){
if ( m_designerHolder->formWindow()->mainContainer()->objectName().compare(m_dialogName) !=0 ){
emit dialogNameChanged(m_dialogName, m_designerHolder->formWindow()->mainContainer()->objectName());
m_dialogName = m_designerHolder->formWindow()->mainContainer()->objectName();
}
emit dialogChanged(m_dialogName);
m_designerHolder->formWindow()->setDirty(false);
}
}
}

View File

@ -0,0 +1,93 @@
#ifndef DIALOGDESIGNER_H
#define DIALOGDESIGNER_H
#include <QObject>
#include <QVector>
#include <QToolBar>
#include <QActionGroup>
class QDesignerFormEditorInterface;
class QDesignerFormWindowInterface;
class QDesignerIntegrationInterface;
class QDesignerWidgetBoxInterface;
class QDesignerActionEditorInterface;
class QDesignerPropertyEditorInterface;
class QDesignerObjectInspectorInterface;
class QDesignerFormWindowManagerInterface;
namespace SharedTools{
class WidgetHost;
}
namespace LimeReport{
class DialogDesigner : public QWidget{
Q_OBJECT
public:
DialogDesigner(QDesignerFormWindowInterface *wnd, QDesignerFormEditorInterface* formEditor, QWidget *parent = NULL, Qt::WindowFlags flags = Qt::WindowFlags());
~DialogDesigner();
QString dialogName() const;
void setDialogName(const QString &dialogName);
bool isChanged();
void setChanged(bool value);
QByteArray dialogContent();
public slots:
void undo();
void redo();
signals:
void dialogChanged(QString dialogName);
void dialogNameChanged(QString oldName, QString newName);
private slots:
void slotMainContainerNameChanged(QString newName);
void slotDialogChanged();
private:
QString m_dialogName;
SharedTools::WidgetHost* m_designerHolder;
QDesignerFormEditorInterface* m_formEditor;
};
class DialogDesignerManager : public QObject
{
Q_OBJECT
public:
explicit DialogDesignerManager(QObject *parent = 0);
~DialogDesignerManager();
void initToolBar(QToolBar* tb);
QWidget* createFormEditor(const QString& content);
QByteArray getDialogDescription(QWidget* form);
void setActiveEditor(QWidget* widget);
void setDirty(bool value);
QWidget* widgetBox() const;
QWidget* actionEditor() const;
QWidget* propertyEditor() const;
QWidget* objectInspector() const;
QWidget* signalSlotEditor() const;
QWidget* resourcesEditor() const;
signals:
void dialogChanged(QString dialogName);
void dialogNameChanged(QString oldName, QString newName);
private slots:
void slotObjectDestroyed(QObject* object);
void slotEditWidgets();
void slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow);
private:
QString iconPathByName(const QString& name);
private:
QDesignerFormEditorInterface* m_formEditor;
QDesignerIntegrationInterface* m_designerIntegration;
QDesignerWidgetBoxInterface* m_widgetBox;
QDesignerActionEditorInterface* m_actionEditor;
QDesignerPropertyEditorInterface* m_propertyEditor;
QDesignerObjectInspectorInterface* m_objectInspector;
QWidget* m_signalSlotEditor;
QWidget* m_resourcesEditor;
QVector<QWidget*> m_designerToolWindows;
QAction* m_editWidgetsAction;
QActionGroup* m_modes;
QString m_activeWindowName;
QList<DialogDesigner*> m_dialogDesigners;
};
} // namespace LimeReport
#endif // DIALOGDESIGNER_H

View File

@ -0,0 +1,18 @@
<ui version="4.0" >
<class>$ClassName$</class>
<widget class="QDialog" name="$ClassName$" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle" >
<string>$ClassName$</string>
</property>
</widget>
<resources/>
<connections/>
</ui>

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: 332 B

BIN
limereport/images/copy3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 749 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 868 B

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 591 B

After

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 518 B

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 505 B

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 634 B

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 B

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 459 B

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 453 B

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 516 B

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 518 B

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 845 B

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 849 B

After

Width:  |  Height:  |  Size: 484 B

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

@ -11,10 +11,10 @@
<file>images/insert-text_5.png</file> <file>images/insert-text_5.png</file>
<file>images/shape5.png</file> <file>images/shape5.png</file>
<file>images/imageItem1.png</file> <file>images/imageItem1.png</file>
<file alias="ImageItem">images/imageItem2.png</file> <file>images/imageItem2.png</file>
<file>images/settings.png</file> <file>images/settings.png</file>
<file>images/settings2.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 alias="Band">images/addBand1.png</file>
<file>images/DataBand.png</file> <file>images/DataBand.png</file>
<file>images/PageHeader.png</file> <file>images/PageHeader.png</file>
@ -34,9 +34,13 @@
<file alias="GroupBandHeader">images/GroupHeader16.png</file> <file alias="GroupBandHeader">images/GroupHeader16.png</file>
<file alias="PageItemDesignIntf">images/ReportPage16.png</file> <file alias="PageItemDesignIntf">images/ReportPage16.png</file>
<file alias="TextItem">images/insert-text_6.png</file> <file alias="TextItem">images/insert-text_6.png</file>
<file alias="BarcodeItem">images/barcode3.png</file> <file>images/barcode3.png</file>
<file alias="ShapeItem">images/shape6.png</file> <file>images/shape6.png</file>
<file alias="ImageItem">images/imageItem3.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>
<file alias="ChartItem">images/pie_chart2.png</file> <file alias="ChartItem">images/pie_chart2.png</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -43,7 +43,7 @@ class AlignmentPropItem : public ObjectPropItem
{ {
Q_OBJECT Q_OBJECT
public: public:
AlignmentPropItem():ObjectPropItem(){} AlignmentPropItem():ObjectPropItem(),m_horizEditor(NULL),m_vertEditor(NULL){}
AlignmentPropItem(QObject *object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value, ObjectPropItem* parent, bool readonly=true); AlignmentPropItem(QObject *object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value, ObjectPropItem* parent, bool readonly=true);
QString displayValue() const; QString displayValue() const;
void setPropertyValue(QVariant value); void setPropertyValue(QVariant value);

View File

@ -390,8 +390,8 @@ void HorizontalLayout::slotOnChildDestroy(QObject* child)
BaseDesignIntf* HorizontalLayout::findNext(BaseDesignIntf* item){ BaseDesignIntf* HorizontalLayout::findNext(BaseDesignIntf* item){
if (m_children.count()<childItems().size()-1){ if (m_children.count()<childItems().size()-1){
m_children.clear(); m_children.clear();
foreach (BaseDesignIntf* item, childBaseItems()) { foreach (BaseDesignIntf* childItem, childBaseItems()) {
m_children.append(item); m_children.append(childItem);
} }
} }
qSort(m_children.begin(),m_children.end(),lessThen); qSort(m_children.begin(),m_children.end(),lessThen);
@ -404,8 +404,8 @@ BaseDesignIntf* HorizontalLayout::findNext(BaseDesignIntf* item){
BaseDesignIntf* HorizontalLayout::findPrior(BaseDesignIntf* item){ BaseDesignIntf* HorizontalLayout::findPrior(BaseDesignIntf* item){
if (m_children.count()<childItems().size()-1){ if (m_children.count()<childItems().size()-1){
m_children.clear(); m_children.clear();
foreach (BaseDesignIntf* item, childBaseItems()) { foreach (BaseDesignIntf* childItem, childBaseItems()) {
m_children.append(item); m_children.append(childItem);
} }
} }
qSort(m_children.begin(),m_children.end(),lessThen); qSort(m_children.begin(),m_children.end(),lessThen);

View File

@ -56,7 +56,9 @@ BaseDesignIntf *ImageItem::createSameTypeItem(QObject *owner, QGraphicsItem *par
void ImageItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight) void ImageItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight)
{ {
if (!m_datasource.isEmpty() && !m_field.isEmpty() && m_picture.isNull()){
if (m_picture.isNull()){
if (!m_datasource.isEmpty() && !m_field.isEmpty()){
IDataSource* ds = dataManager->dataSource(m_datasource); IDataSource* ds = dataManager->dataSource(m_datasource);
if (ds) { if (ds) {
QVariant data = ds->data(m_field); QVariant data = ds->data(m_field);
@ -67,6 +69,9 @@ void ImageItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass,
m_picture.loadFromData(data.toByteArray()); m_picture.loadFromData(data.toByteArray());
} }
} }
} else if (!m_resourcePath.isEmpty()){
m_picture = QImage(m_resourcePath);
}
} }
if (m_autoSize){ if (m_autoSize){
setWidth(m_picture.width()); setWidth(m_picture.width());
@ -80,6 +85,11 @@ bool ImageItem::isNeedUpdateSize(RenderPass) const
return m_picture.isNull() || m_autoSize; return m_picture.isNull() || m_autoSize;
} }
QString ImageItem::resourcePath() const
{
return m_resourcePath;
}
qreal ImageItem::minHeight() const{ qreal ImageItem::minHeight() const{
if (!m_picture.isNull() && autoSize()) if (!m_picture.isNull() && autoSize())
{ {
@ -231,6 +241,7 @@ void ImageItem::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option
if (img.isNull() && itemMode()==DesignMode){ if (img.isNull() && itemMode()==DesignMode){
QString text; QString text;
ppainter->setFont(transformToSceneFont(QFont("Arial",10))); ppainter->setFont(transformToSceneFont(QFont("Arial",10)));
ppainter->setPen(Qt::black);
if (!datasource().isEmpty() && !field().isEmpty()) if (!datasource().isEmpty() && !field().isEmpty())
text = datasource()+"."+field(); text = datasource()+"."+field();
else text = tr("Image"); 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 scale READ scale WRITE setScale)
Q_PROPERTY(bool keepAspectRatio READ keepAspectRatio WRITE setKeepAspectRatio) Q_PROPERTY(bool keepAspectRatio READ keepAspectRatio WRITE setKeepAspectRatio)
Q_PROPERTY(bool center READ center WRITE setCenter) Q_PROPERTY(bool center READ center WRITE setCenter)
Q_PROPERTY(QString resourcePath READ resourcePath WRITE setResourcePath)
public: public:
ImageItem(QObject *owner, QGraphicsItem *parent); ImageItem(QObject *owner, QGraphicsItem *parent);
virtual void paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget); virtual void paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void setImage(QImage value); void setImage(QImage value);
QImage image(){return m_picture;} 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; QString datasource() const;
void setDatasource(const QString &datasource); void setDatasource(const QString &datasource);
QString field() const; QString field() const;
@ -73,7 +75,7 @@ protected:
bool drawDesignBorders() const {return m_picture.isNull();} bool drawDesignBorders() const {return m_picture.isNull();}
private: private:
QImage m_picture; QImage m_picture;
QString m_content; QString m_resourcePath;
QString m_datasource; QString m_datasource;
QString m_field; QString m_field;
bool m_autoSize; bool m_autoSize;

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