mirror of
https://github.com/fralx/LimeReport.git
synced 2025-10-30 21:07:12 +03:00
Qt6 support added
This commit is contained in:
@@ -1,12 +1,7 @@
|
||||
include(../common.pri)
|
||||
QT += core gui
|
||||
|
||||
CONFIG(release, debug|release) {
|
||||
TARGET = LRDemo_r1
|
||||
} else {
|
||||
TARGET = LRDemo_r1d
|
||||
}
|
||||
|
||||
TARGET = LRDemo_r1
|
||||
TEMPLATE = app
|
||||
|
||||
SOURCES += main.cpp\
|
||||
@@ -31,9 +26,27 @@ macx{
|
||||
}
|
||||
|
||||
unix:{
|
||||
LIBS += -L$${DEST_LIBS}
|
||||
CONFIG(debug, debug|release) {
|
||||
LIBS += -llimereportd
|
||||
} else {
|
||||
LIBS += -llimereport
|
||||
}
|
||||
|
||||
!contains(CONFIG, static_build){
|
||||
contains(CONFIG,zint){
|
||||
LIBS += -L$${DEST_LIBS}
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
LIBS += -lQtZintd
|
||||
} else {
|
||||
LIBS += -lQtZint
|
||||
}
|
||||
}
|
||||
}
|
||||
DESTDIR = $$DEST_DIR
|
||||
# QMAKE_POST_LINK += mkdir -p $$quote($$REPORTS_DIR) |
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$$EXTRA_DIR\" \"$$REPORTS_DIR\" $$escape_expand(\n\t)
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR) $$quote($$REPORTS_DIR) $$escape_expand(\n\t)
|
||||
|
||||
linux{
|
||||
#Link share lib to ../lib rpath
|
||||
@@ -47,33 +60,33 @@ unix:{
|
||||
}
|
||||
|
||||
win32 {
|
||||
EXTRA_DIR ~= s,/,\\,g
|
||||
DEST_DIR ~= s,/,\\,g
|
||||
REPORTS_DIR ~= s,/,\\,g
|
||||
|
||||
DESTDIR = $$DEST_DIR
|
||||
contains(QMAKE_HOST.os, Linux){
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$$EXTRA_DIR\" \"$$REPORTS_DIR\" $$escape_expand(\n\t)
|
||||
} else {
|
||||
EXTRA_DIR ~= s,/,\\,g
|
||||
DEST_DIR ~= s,/,\\,g
|
||||
REPORTS_DIR ~= s,/,\\,g
|
||||
RC_FILE += mainicon.rc
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$$EXTRA_DIR\" \"$$REPORTS_DIR\\demo_reports\" $$escape_expand(\\n\\t)
|
||||
}
|
||||
}
|
||||
RC_FILE += mainicon.rc
|
||||
|
||||
LIBS += -L$${DEST_LIBS}
|
||||
CONFIG(debug, debug|release) {
|
||||
LIBS += -llimereportd
|
||||
} else {
|
||||
LIBS += -llimereport
|
||||
}
|
||||
message($$LIBS)
|
||||
|
||||
!contains(CONFIG, static_build){
|
||||
contains(CONFIG,zint){
|
||||
LIBS += -L$${DEST_LIBS}
|
||||
CONFIG(debug, debug|release) {
|
||||
LIBS += -lQtZintd
|
||||
} else {
|
||||
LIBS += -lQtZint
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$$EXTRA_DIR\" \"$$REPORTS_DIR\\demo_reports\" $$escape_expand(\\n\\t)
|
||||
#QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR\\*) $$quote($$REPORTS_DIR\\demo_reports) $$escape_expand(\\n\\t)
|
||||
!contains(CONFIG, static_build){
|
||||
|
||||
contains(CONFIG,zint){
|
||||
LIBS += -L$${DEST_LIBS}
|
||||
CONFIG(debug, debug|release) {
|
||||
LIBS += -lQtZintd
|
||||
} else {
|
||||
LIBS += -lQtZint
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LIBS += -L$${DEST_LIBS}
|
||||
CONFIG(debug, debug|release) {
|
||||
LIBS += -llimereportd
|
||||
} else {
|
||||
LIBS += -llimereport
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF8"?>
|
||||
<Report>
|
||||
<object Type="Object" ClassName="LimeReport::ReportEnginePrivate">
|
||||
<object ClassName="LimeReport::ReportEnginePrivate" Type="Object">
|
||||
<objectName Type="QString"></objectName>
|
||||
<pages Type="Collection">
|
||||
<item Type="Object" ClassName="LimeReport::PageDesignIntf">
|
||||
<item ClassName="LimeReport::PageDesignIntf" Type="Object">
|
||||
<objectName Type="QString">page1</objectName>
|
||||
<sceneRect Type="QRect" x="-50" y="-50" width="2200" height="3070"/>
|
||||
<sceneRect Type="QRect" width="2200" x="-50" y="-50" height="3070"/>
|
||||
<bspTreeDepth Value="5" Type="int"/>
|
||||
<font underline="0" Type="QFont" italic="0" family="MS Shell Dlg 2" weight="50" pointSize="8" stylename=""/>
|
||||
<font stylename="" Type="QFont" pointSize="8" underline="0" family="MS Shell Dlg 2" weight="50" italic="0"/>
|
||||
<sortCacheEnabled Value="0" Type="bool"/>
|
||||
<stickyFocus Value="0" Type="bool"/>
|
||||
<minimumRenderSize Value="0" Type="qreal"/>
|
||||
<pageItem Type="Object" ClassName="PageItem">
|
||||
<pageItem ClassName="PageItem" Type="Object">
|
||||
<objectName Type="QString">ReportPage1</objectName>
|
||||
<geometry Type="QRect" x="0" y="0" width="2100" height="2970"/>
|
||||
<geometry Type="QRect" width="2100" x="0" y="0" height="2970"/>
|
||||
<children Type="Collection">
|
||||
<item Type="Object" ClassName="Data">
|
||||
<item ClassName="Data" Type="Object">
|
||||
<objectName Type="QString">DataBand1</objectName>
|
||||
<geometry Type="QRect" x="50" y="306" width="2000" height="110"/>
|
||||
<geometry Type="QRect" width="2000" x="50" y="306" height="110"/>
|
||||
<children Type="Collection">
|
||||
<item Type="Object" ClassName="TextItem">
|
||||
<item ClassName="TextItem" Type="Object">
|
||||
<objectName Type="QString">TextItem2</objectName>
|
||||
<geometry Type="QRect" x="38" y="32" width="814" height="50"/>
|
||||
<geometry Type="QRect" width="814" x="38" y="32" height="50"/>
|
||||
<children Type="Collection"/>
|
||||
<zOrder Value="0" Type="qreal"/>
|
||||
<borders Value="0" Type="enumAndFlags"/>
|
||||
@@ -51,7 +51,7 @@ if ($D{customers.CustomerID}=="ANTON"){
|
||||
<alignment Value="33" Type="enumAndFlags"/>
|
||||
<autoWidth Value="0" Type="enumAndFlags"/>
|
||||
<autoHeight Value="0" Type="bool"/>
|
||||
<font underline="0" Type="QFont" italic="0" family="Arial" weight="50" pointSize="10" stylename=""/>
|
||||
<font stylename="" Type="QFont" pointSize="10" underline="0" family="Arial" weight="50" italic="0"/>
|
||||
<backgroundOpacity Value="100" Type="int"/>
|
||||
<backgroundMode Value="1" Type="enumAndFlags"/>
|
||||
<backgroundColor Value="#ffffff" Type="QColor"/>
|
||||
@@ -65,13 +65,6 @@ if ($D{customers.CustomerID}=="ANTON"){
|
||||
<underlineLineSize Value="1" Type="int"/>
|
||||
<allowHTML Value="1" Type="bool"/>
|
||||
<allowHTMLInFields Value="0" Type="bool"/>
|
||||
<format Type="QString"></format>
|
||||
<valueType Value="0" Type="enumAndFlags"/>
|
||||
<followTo Type="QString"></followTo>
|
||||
<backgroundBrushStyle Value="1" Type="enumAndFlags"/>
|
||||
<textIndent Value="0" Type="qreal"/>
|
||||
<textLayoutDirection Value="2" Type="enumAndFlags"/>
|
||||
<fillInSecondPass Value="0" Type="bool"/>
|
||||
</item>
|
||||
</children>
|
||||
<zOrder Value="0" Type="qreal"/>
|
||||
@@ -85,7 +78,6 @@ if ($D{customers.CustomerID}=="ANTON"){
|
||||
<keepBottomSpace Value="0" Type="bool"/>
|
||||
<parentBand Type="QString"></parentBand>
|
||||
<backgroundColor Value="#ffffff" Type="QColor"/>
|
||||
<backgroundBrushStyle Value="1" Type="enumAndFlags"/>
|
||||
<printIfEmpty Value="0" Type="bool"/>
|
||||
<datasource Type="QString">customers</datasource>
|
||||
<keepSubdetailTogether Value="0" Type="bool"/>
|
||||
@@ -96,16 +88,14 @@ if ($D{customers.CustomerID}=="ANTON"){
|
||||
<columnsFillDirection Value="0" Type="enumAndFlags"/>
|
||||
<startNewPage Value="0" Type="bool"/>
|
||||
<startFromNewPage Value="0" Type="bool"/>
|
||||
<alternateBackgroundColor Value="#ffffff" Type="QColor"/>
|
||||
<useAlternateBackgroundColor Value="0" Type="bool"/>
|
||||
</item>
|
||||
<item Type="Object" ClassName="ReportHeader">
|
||||
<item ClassName="ReportHeader" Type="Object">
|
||||
<objectName Type="QString">ReportHeader1</objectName>
|
||||
<geometry Type="QRect" x="50" y="50" width="2000" height="252"/>
|
||||
<geometry Type="QRect" width="2000" x="50" y="50" height="252"/>
|
||||
<children Type="Collection">
|
||||
<item Type="Object" ClassName="TextItem">
|
||||
<item ClassName="TextItem" Type="Object">
|
||||
<objectName Type="QString">TextItem1</objectName>
|
||||
<geometry Type="QRect" x="6" y="12" width="816" height="222"/>
|
||||
<geometry Type="QRect" width="816" x="6" y="12" height="222"/>
|
||||
<children Type="Collection"/>
|
||||
<zOrder Value="0" Type="qreal"/>
|
||||
<borders Value="0" Type="enumAndFlags"/>
|
||||
@@ -117,10 +107,10 @@ if ($D{customers.CustomerID}=="ANTON"){
|
||||
<stretchToMaxHeight Value="0" Type="bool"/>
|
||||
<itemAlign Value="4" Type="enumAndFlags"/>
|
||||
<content Type="QString">$S{
|
||||
var color = LimeReport.color('#DEB887');
|
||||
var font = LimeReport.font('Times New Roman',26,false,true);
|
||||
var color = new QColor('#DEB887');
|
||||
var font = new QFont('Times New Roman',26,false,true);
|
||||
THIS.backgroundColor = color;
|
||||
THIS.fontColor = LimeReport.color('red');
|
||||
THIS.fontColor = QColor('red');
|
||||
THIS.font = font;
|
||||
|
||||
'Test'}</content>
|
||||
@@ -128,7 +118,7 @@ THIS.font = font;
|
||||
<alignment Value="33" Type="enumAndFlags"/>
|
||||
<autoWidth Value="0" Type="enumAndFlags"/>
|
||||
<autoHeight Value="0" Type="bool"/>
|
||||
<font underline="0" Type="QFont" italic="0" family="Times New Roman" weight="50" pointSize="10" stylename=""/>
|
||||
<font stylename="" Type="QFont" pointSize="10" underline="0" family="Times New Roman" weight="50" italic="0"/>
|
||||
<backgroundOpacity Value="100" Type="int"/>
|
||||
<backgroundMode Value="1" Type="enumAndFlags"/>
|
||||
<backgroundColor Value="#ffffff" Type="QColor"/>
|
||||
@@ -142,17 +132,10 @@ THIS.font = font;
|
||||
<underlineLineSize Value="1" Type="int"/>
|
||||
<allowHTML Value="0" Type="bool"/>
|
||||
<allowHTMLInFields Value="0" Type="bool"/>
|
||||
<format Type="QString"></format>
|
||||
<valueType Value="0" Type="enumAndFlags"/>
|
||||
<followTo Type="QString"></followTo>
|
||||
<backgroundBrushStyle Value="1" Type="enumAndFlags"/>
|
||||
<textIndent Value="0" Type="qreal"/>
|
||||
<textLayoutDirection Value="2" Type="enumAndFlags"/>
|
||||
<fillInSecondPass Value="0" Type="bool"/>
|
||||
</item>
|
||||
<item Type="Object" ClassName="TextItem">
|
||||
<item ClassName="TextItem" Type="Object">
|
||||
<objectName Type="QString">TextItem3</objectName>
|
||||
<geometry Type="QRect" x="878" y="44" width="408" height="86"/>
|
||||
<geometry Type="QRect" width="408" x="878" y="44" height="86"/>
|
||||
<children Type="Collection"/>
|
||||
<zOrder Value="0" Type="qreal"/>
|
||||
<borders Value="0" Type="enumAndFlags"/>
|
||||
@@ -168,7 +151,7 @@ THIS.font = font;
|
||||
<alignment Value="33" Type="enumAndFlags"/>
|
||||
<autoWidth Value="0" Type="enumAndFlags"/>
|
||||
<autoHeight Value="0" Type="bool"/>
|
||||
<font underline="0" Type="QFont" italic="0" family="Arial" weight="50" pointSize="10" stylename=""/>
|
||||
<font stylename="" Type="QFont" pointSize="10" underline="0" family="Arial" weight="50" italic="0"/>
|
||||
<backgroundOpacity Value="100" Type="int"/>
|
||||
<backgroundMode Value="1" Type="enumAndFlags"/>
|
||||
<backgroundColor Value="#ffffff" Type="QColor"/>
|
||||
@@ -182,13 +165,6 @@ THIS.font = font;
|
||||
<underlineLineSize Value="1" Type="int"/>
|
||||
<allowHTML Value="1" Type="bool"/>
|
||||
<allowHTMLInFields Value="0" Type="bool"/>
|
||||
<format Type="QString"></format>
|
||||
<valueType Value="0" Type="enumAndFlags"/>
|
||||
<followTo Type="QString"></followTo>
|
||||
<backgroundBrushStyle Value="1" Type="enumAndFlags"/>
|
||||
<textIndent Value="0" Type="qreal"/>
|
||||
<textLayoutDirection Value="2" Type="enumAndFlags"/>
|
||||
<fillInSecondPass Value="0" Type="bool"/>
|
||||
</item>
|
||||
</children>
|
||||
<zOrder Value="0" Type="qreal"/>
|
||||
@@ -202,10 +178,8 @@ THIS.font = font;
|
||||
<keepBottomSpace Value="0" Type="bool"/>
|
||||
<parentBand Type="QString"></parentBand>
|
||||
<backgroundColor Value="#ffffff" Type="QColor"/>
|
||||
<backgroundBrushStyle Value="1" Type="enumAndFlags"/>
|
||||
<printIfEmpty Value="0" Type="bool"/>
|
||||
<splittable Value="0" Type="bool"/>
|
||||
<printBeforePageHeader Value="0" Type="bool"/>
|
||||
</item>
|
||||
</children>
|
||||
<zOrder Value="0" Type="qreal"/>
|
||||
@@ -223,19 +197,13 @@ THIS.font = font;
|
||||
<gridStep Value="2" Type="int"/>
|
||||
<fullPage Value="0" Type="bool"/>
|
||||
<oldPrintMode Value="0" Type="bool"/>
|
||||
<resetPageNumber Value="0" Type="bool"/>
|
||||
<isExtendedInDesignMode Value="0" Type="bool"/>
|
||||
<extendedHeight Value="1000" Type="int"/>
|
||||
<pageIsTOC Value="0" Type="bool"/>
|
||||
<setPageSizeToPrinter Value="0" Type="bool"/>
|
||||
<endlessHeight Value="0" Type="bool"/>
|
||||
</pageItem>
|
||||
</item>
|
||||
</pages>
|
||||
<datasourcesManager Type="Object" ClassName="LimeReport::DataSourceManager">
|
||||
<datasourcesManager ClassName="LimeReport::DataSourceManager" Type="Object">
|
||||
<objectName Type="QString">datasources</objectName>
|
||||
<connections Type="Collection">
|
||||
<item Type="Object" ClassName="LimeReport::ConnectionDesc">
|
||||
<item ClassName="LimeReport::ConnectionDesc" Type="Object">
|
||||
<objectName Type="QString"></objectName>
|
||||
<name Type="QString">test</name>
|
||||
<driver Type="QString">QSQLITE</driver>
|
||||
@@ -244,11 +212,10 @@ THIS.font = font;
|
||||
<password Value="" Type="QString"/>
|
||||
<host Type="QString"></host>
|
||||
<autoconnect Value="0" Type="bool"/>
|
||||
<keepDBCredentials Value="1" Type="bool"/>
|
||||
</item>
|
||||
</connections>
|
||||
<queries Type="Collection">
|
||||
<item Type="Object" ClassName="LimeReport::QueryDesc">
|
||||
<item ClassName="LimeReport::QueryDesc" Type="Object">
|
||||
<objectName Type="QString"></objectName>
|
||||
<queryName Type="QString">customers</queryName>
|
||||
<queryText Type="QString">Select * from customers limit 5</queryText>
|
||||
@@ -258,21 +225,18 @@ THIS.font = font;
|
||||
<subqueries Type="Collection"/>
|
||||
<subproxies Type="Collection"/>
|
||||
<variables Type="Collection">
|
||||
<item Type="Object" ClassName="LimeReport::VarDesc">
|
||||
<item ClassName="LimeReport::VarDesc" Type="Object">
|
||||
<objectName Type="QString"></objectName>
|
||||
<name Type="QString">TestName</name>
|
||||
<value Type="QString">TestValue</value>
|
||||
<isMandatory Value="0" Type="bool"/>
|
||||
<dataType Value="0" Type="int"/>
|
||||
</item>
|
||||
</variables>
|
||||
</datasourcesManager>
|
||||
<scriptContext Type="Object" ClassName="LimeReport::ScriptEngineContext">
|
||||
<scriptContext ClassName="LimeReport::ScriptEngineContext" Type="Object">
|
||||
<objectName Type="QString"></objectName>
|
||||
<dialogs Type="Collection"/>
|
||||
<initScript Type="QString"></initScript>
|
||||
</scriptContext>
|
||||
<suppressFieldAndVarError Value="0" Type="bool"/>
|
||||
<translation Type="Translation"/>
|
||||
</object>
|
||||
</Report>
|
||||
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
IDI_ICON1 ICON "main.ico"
|
||||
DI_ICON1 ICON "main.ico"
|
||||
|
||||
@@ -37,15 +37,8 @@
|
||||
#include <LRCallbackDS>
|
||||
#include <QDebug>
|
||||
#include <QStringListModel>
|
||||
#include <QPrinter>
|
||||
|
||||
#ifdef BUILD_WITH_EASY_PROFILER
|
||||
#include "easy/profiler.h"
|
||||
#else
|
||||
# define EASY_BLOCK(...)
|
||||
# define EASY_END_BLOCK
|
||||
# define EASY_PROFILER_ENABLE
|
||||
#endif
|
||||
#include <QSqlError>
|
||||
#include <QSqlDriver>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
@@ -77,7 +70,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
int index = m_customers->record().indexOf("CustomerID");
|
||||
m_orders->bindValue(":id",m_customers->value(index));
|
||||
m_orders->exec();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
LimeReport::ICallbackDatasource * callbackDatasource = report->dataManager()->createCallbackDatasource("master");
|
||||
@@ -104,8 +97,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
report->dataManager()->addModel("string_list",stringListModel,true);
|
||||
QStringList strList;
|
||||
strList<<"value1"<<"value2";
|
||||
//QScriptValue value = qScriptValueFromSequence(report->scriptManager()->scriptEngine(),strList);
|
||||
//report->scriptManager()->scriptEngine()->globalObject().setProperty("test_list",value);
|
||||
// QScriptValue value = qScriptValueFromSequence(report->scriptManager()->scriptEngine(),strList);
|
||||
// report->scriptManager()->scriptEngine()->globalObject().setProperty("test_list",value);
|
||||
|
||||
|
||||
}
|
||||
@@ -119,58 +112,35 @@ MainWindow::~MainWindow()
|
||||
|
||||
void MainWindow::on_pushButton_clicked()
|
||||
{
|
||||
EASY_PROFILER_ENABLE;
|
||||
EASY_BLOCK("design report");
|
||||
report->dataManager()->clearUserVariables();
|
||||
if (!ui->leVariableName->text().isEmpty() && !ui->leVariableValue->text().isEmpty()){
|
||||
report->dataManager()->setReportVariable(ui->leVariableName->text(), ui->leVariableValue->text());
|
||||
report->dataManager()->setReportVariable("SecondPage", false);
|
||||
}
|
||||
report->setShowProgressDialog(false);
|
||||
report->designReport();
|
||||
EASY_END_BLOCK;
|
||||
#ifdef BUILD_WITH_EASY_PROFILER
|
||||
profiler::dumpBlocksToFile("test.prof");
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_2_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this,"Select report file",QApplication::applicationDirPath()+"/demo_reports/","*.lrxml");
|
||||
if (!fileName.isEmpty()) {
|
||||
EASY_PROFILER_ENABLE;
|
||||
EASY_BLOCK("Load file");
|
||||
report->loadFromFile(fileName);
|
||||
EASY_END_BLOCK;
|
||||
EASY_BLOCK("Set report variable");
|
||||
if (!ui->leVariableName->text().isEmpty() && !ui->leVariableValue->text().isEmpty()){
|
||||
report->dataManager()->setReportVariable(ui->leVariableName->text(), ui->leVariableValue->text());
|
||||
}
|
||||
EASY_END_BLOCK;
|
||||
#ifdef BUILD_WITH_EASY_PROFILER
|
||||
profiler::dumpBlocksToFile("test.prof");
|
||||
#endif
|
||||
// QPrinter* printer = new QPrinter;
|
||||
// QPrintDialog dialog(printer);
|
||||
// if (dialog.exec()){
|
||||
// QMap<QString, QPrinter*> printers;
|
||||
// printers.insert("default",printer);
|
||||
// report->printReport(printers);
|
||||
// }
|
||||
report->setShowProgressDialog(true);
|
||||
report->previewReport();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::renderStarted()
|
||||
{
|
||||
if (report->isShowProgressDialog()){
|
||||
m_currentPage = 0;
|
||||
m_progressDialog = new QProgressDialog(tr("Start render"),tr("Cancel"),0,0,this);
|
||||
//m_progressDialog->setWindowModality(Qt::WindowModal);
|
||||
connect(m_progressDialog, SIGNAL(canceled()), report, SLOT(cancelRender()));
|
||||
QApplication::processEvents();
|
||||
m_progressDialog->show();
|
||||
}
|
||||
m_currentPage = 0;
|
||||
m_progressDialog = new QProgressDialog(tr("Start render"),tr("Cancel"),0,0,this);
|
||||
m_progressDialog->setWindowModality(Qt::WindowModal);
|
||||
connect(m_progressDialog, SIGNAL(canceled()), report, SLOT(cancelRender()));
|
||||
m_progressDialog->show();
|
||||
QApplication::processEvents();
|
||||
}
|
||||
|
||||
void MainWindow::renderPageFinished(int renderedPageCount)
|
||||
@@ -272,5 +242,28 @@ void MainWindow::slotOneSlotDS(LimeReport::CallbackInfo info, QVariant &data)
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::slotOnSave(bool& saved)
|
||||
{
|
||||
QSqlQuery reports;
|
||||
reports.prepare("Update reports set Content = ? where ReportName = ?");
|
||||
reports.bindValue(0, report->saveToByteArray());
|
||||
reports.bindValue(1,report->reportName());
|
||||
if (!reports.exec()) qDebug() << reports.lastError();
|
||||
saved = true;
|
||||
m_db.commit();
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_3_clicked()
|
||||
{
|
||||
QSqlQuery reports("Select ReportName, Content from reports limit 1",m_db);
|
||||
reports.first();
|
||||
QByteArray source = reports.value(1).toByteArray();
|
||||
report->loadFromByteArray(&source);
|
||||
report->setReportName(reports.value(0).toString());
|
||||
connect(report, SIGNAL(onSave(bool&)), this, SLOT(slotOnSave(bool&)));
|
||||
report->designReport();
|
||||
disconnect(report,SIGNAL(onSave(bool&)), this, SLOT(slotOnSave(bool&)));
|
||||
}
|
||||
|
||||
@@ -58,6 +58,9 @@ private slots:
|
||||
void slotGetCallbackChildData(LimeReport::CallbackInfo info, QVariant& data);
|
||||
void slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosType& type, bool& result);
|
||||
void slotOneSlotDS(LimeReport::CallbackInfo info, QVariant& data);
|
||||
void slotOnSave(bool &saved);
|
||||
void on_pushButton_3_clicked();
|
||||
|
||||
private:
|
||||
void prepareData(QSqlQuery* ds, LimeReport::CallbackInfo info, QVariant &data);
|
||||
private:
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>369</width>
|
||||
<height>192</height>
|
||||
<width>426</width>
|
||||
<height>214</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
@@ -185,6 +185,43 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<property name="text">
|
||||
<string>Load from Database</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
||||
Reference in New Issue
Block a user