0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-23 16:22:58 +03:00
This commit is contained in:
Arin Alexander 2017-04-20 21:10:31 +03:00
commit cbf205b728
29 changed files with 152 additions and 89 deletions

View File

@ -71,19 +71,19 @@ 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&)),
this, SLOT(slotGetCallbackData(LimeReport::CallbackInfo,QVariant&)));
connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)),
this, SLOT(slotChangePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)));
callbackDatasource = report->dataManager()->createCallbackDatasouce("detail");
callbackDatasource = report->dataManager()->createCallbackDatasource("detail");
connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
this, SLOT(slotGetCallbackChildData(LimeReport::CallbackInfo,QVariant&)));
connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)),
this, SLOT(slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosType&,bool&)));
callbackDatasource = report->dataManager()->createCallbackDatasouce("oneSlotDS");
callbackDatasource = report->dataManager()->createCallbackDatasource("oneSlotDS");
connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
this, SLOT(slotOneSlotDS(LimeReport::CallbackInfo,QVariant&)));

View File

@ -54,7 +54,7 @@ public:
virtual void removeModel(const QString& name) = 0;
virtual bool containsDatasource(const QString& dataSourceName) = 0;
virtual void clearUserVariables()=0;
virtual ICallbackDatasource* createCallbackDatasouce(const QString& name) = 0;
virtual ICallbackDatasource* createCallbackDatasource(const QString& name) = 0;
virtual void registerDbCredentialsProvider(IDbCredentialsProvider* provider) = 0;
//virtual void addCallbackDatasource(ICallbackDatasource* datasource, const QString& name) = 0;
};

View File

@ -87,7 +87,7 @@ public:
void setShowProgressDialog(bool value);
IDataSourceManager* dataManager();
IScriptEngineManager* scriptManager();
bool loadFromFile(const QString& fileName);
bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange = false);
bool loadFromByteArray(QByteArray *data);
bool loadFromString(const QString& data);
QString reportFileName();

View File

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

View File

@ -43,7 +43,7 @@ class AlignmentPropItem : public ObjectPropItem
{
Q_OBJECT
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);
QString displayValue() const;
void setPropertyValue(QVariant value);

View File

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

View File

@ -63,7 +63,7 @@ QString HtmlContext::parseTag(QVector<Tag *> &storage, QString text, int &curPos
tagName.remove('>');
while (buff.contains(rx)){
int pos=rx.indexIn(buff);
pos=rx.indexIn(buff);
buff=buff.right(buff.length()-pos);
curPos+=pos;
if (extractWord(rx.cap(0),1).compare(extractWord(tagName,1),Qt::CaseInsensitive)==0){

View File

@ -502,18 +502,20 @@ TextItem::TextPtr TextItem::textDocument() const
setTextFont(text,_font);
}
text->documentLayout();
//text->documentLayout();
if (m_lineSpacing != 1 || m_textIndent !=0 ){
for ( QTextBlock block = text->begin(); block.isValid(); block = block.next())
{
QTextCursor tc = QTextCursor(block);
QTextBlockFormat fmt = block.blockFormat();
fmt.setTextIndent(m_textIndent);
if(fmt.lineHeight() != m_lineSpacing) {
fmt.setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight);
for ( QTextBlock block = text->begin(); block.isValid(); block = block.next())
{
QTextCursor tc = QTextCursor(block);
QTextBlockFormat fmt = block.blockFormat();
fmt.setTextIndent(m_textIndent);
if (fmt.lineHeight() != m_lineSpacing) {
fmt.setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight);
}
tc.setBlockFormat( fmt );
}
}
return text;

View File

@ -124,8 +124,8 @@ void TextItemEditor::initUI()
ui->twData->setModel(dm->datasourcesModel());
ui->twScriptEngine->setModel(se.model());
foreach(QString dsName,dm->dataSourceNames()){
foreach(QString field, dm->fieldNames(dsName)){
foreach(const QString &dsName,dm->dataSourceNames()){
foreach(const QString &field, dm->fieldNames(dsName)){
dataWords<<dsName+"."+field;
}
}

View File

@ -1191,7 +1191,10 @@ void BaseDesignIntf::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
QAction* a = menu.exec(event->screenPos());
if (a){
if (a == cutAction)
{
page->cut();
return;
}
if (a == copyAction)
page->copy();
if (a == pasteAction)

View File

@ -51,7 +51,7 @@ class BaseDesignIntf;
class Marker : public QGraphicsItem{
public:
Marker(QGraphicsItem* parent=0):QGraphicsItem(parent){}
Marker(QGraphicsItem* parent=0):QGraphicsItem(parent),m_object(NULL){}
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *);
void setRect(QRectF rect){prepareGeometryChange();m_rect=rect;}
@ -266,7 +266,7 @@ public:
QColor borderColor() const;
void setBorderColor(const QColor &borderColor);
void setItemVisible(const bool& value);
virtual bool canContainChildren(){ return false;}
virtual bool canContainChildren(){ return false;}
ReportSettings* reportSettings() const;
void setReportSettings(ReportSettings *reportSettings);
void setZValueProperty(qreal value);

View File

@ -299,7 +299,7 @@ int ModelToDataSource::columnCount()
QString ModelToDataSource::columnNameByIndex(int columnIndex)
{
if (isInvalid()) return "";
if (isInvalid()) return "";
QString result = m_model->headerData(columnIndex,Qt::Horizontal, Qt::UserRole).isValid()?
m_model->headerData(columnIndex,Qt::Horizontal, Qt::UserRole).toString():
m_model->headerData(columnIndex,Qt::Horizontal).toString();
@ -704,7 +704,6 @@ int CallbackDatasource::columnCount(){
int currIndex = 0;
do {
QVariant columnName;
CallbackInfo info;
info.dataType = CallbackInfo::ColumnHeaderData;
info.index = currIndex;
emit getCallbackData(info,columnName);

View File

@ -318,7 +318,7 @@ void DataSourceManager::removeModel(const QString &name)
removeDatasource(name.toLower());
}
ICallbackDatasource *DataSourceManager::createCallbackDatasouce(const QString& name)
ICallbackDatasource *DataSourceManager::createCallbackDatasource(const QString& name)
{
ICallbackDatasource* ds = new CallbackDatasource();
IDataSourceHolder* holder = new CallbackDatasourceHolder(dynamic_cast<IDataSource*>(ds),true);

View File

@ -71,7 +71,7 @@ class DataSourceModel : public QAbstractItemModel{
Q_OBJECT
friend class DataSourceManager;
public:
DataSourceModel():m_rootNode(new DataNode()){}
DataSourceModel():m_dataManager(NULL),m_rootNode(new DataNode()){}
DataSourceModel(DataSourceManager* dataManager);
~DataSourceModel();
QModelIndex index(int row, int column, const QModelIndex &parent) const;
@ -114,7 +114,7 @@ public:
void addProxy(const QString& name, QString master, QString detail, QList<FieldsCorrelation> fields);
bool addModel(const QString& name, QAbstractItemModel *model, bool owned);
void removeModel(const QString& name);
ICallbackDatasource* createCallbackDatasouce(const QString &name);
ICallbackDatasource* createCallbackDatasource(const QString &name);
void registerDbCredentialsProvider(IDbCredentialsProvider *provider);
void addCallbackDatasource(ICallbackDatasource *datasource, const QString &name);
void setReportVariable(const QString& name, const QVariant& value);

View File

@ -54,7 +54,7 @@ public:
virtual void removeModel(const QString& name) = 0;
virtual bool containsDatasource(const QString& dataSourceName) = 0;
virtual void clearUserVariables()=0;
virtual ICallbackDatasource* createCallbackDatasouce(const QString& name) = 0;
virtual ICallbackDatasource* createCallbackDatasource(const QString& name) = 0;
virtual void registerDbCredentialsProvider(IDbCredentialsProvider* provider) = 0;
//virtual void addCallbackDatasource(ICallbackDatasource* datasource, const QString& name) = 0;
};

View File

@ -1226,6 +1226,8 @@ void PageDesignIntf::copy()
if (shouldWrite) {
clipboard->setText(writer->saveToString());
}
delete writer;
}
}
@ -1304,7 +1306,7 @@ void PageDesignIntf::deleteSelected()
}
void PageDesignIntf::cut()
{
{
CommandIf::Ptr command = CutCommand::create(this);
saveCommand(command);
}
@ -1727,8 +1729,8 @@ CommandIf::Ptr DeleteLayoutCommand::create(PageDesignIntf *page, LayoutDesignInt
DeleteLayoutCommand* command = new DeleteLayoutCommand();
command->setPage(page);
command->setItem(item);
foreach (BaseDesignIntf* item, item->childBaseItems()){
command->m_childItems.append(item->objectName());
foreach (BaseDesignIntf* childItem, item->childBaseItems()){
command->m_childItems.append(childItem->objectName());
}
return CommandIf::Ptr(command);
}
@ -1845,7 +1847,7 @@ CommandIf::Ptr CutCommand::create(PageDesignIntf *page)
foreach(QGraphicsItem * item, page->selectedItems()) {
if (!dynamic_cast<PageItemDesignIntf*>(item)){
BaseDesignIntf *reportItem = dynamic_cast<BaseDesignIntf *>(item);
if (reportItem) {
command->m_itemNames.push_back(reportItem->objectName());
writer->putItem(reportItem);
@ -2169,7 +2171,7 @@ void PropertyItemAlignChangedCommand::undoIt()
if (reportItem && (reportItem->property(m_propertyName.toLatin1()) != m_oldValue)) {
reportItem->setProperty(m_propertyName.toLatin1(), m_oldValue);
}
if (m_oldValue == BaseDesignIntf::DesignedItemAlign){
if (reportItem && (m_oldValue == BaseDesignIntf::DesignedItemAlign)){
reportItem->setPos(m_savedPos);
}
}

View File

@ -13,6 +13,7 @@ class PreviewReportWidgetPrivate
{
public:
PreviewReportWidgetPrivate(PreviewReportWidget* previewReportWidget):
m_previewPage(NULL), m_report(NULL), m_zoomer(NULL),
m_currentPage(1), m_changingPage(false), m_priorScrolValue(0), m_scalePercent(50),
q_ptr(previewReportWidget) {}
bool pageIsVisible();

View File

@ -138,6 +138,11 @@ void PreviewReportWindow::initPreview(int pagesCount)
m_pagesNavigator->setValue(1);
}
void PreviewReportWindow::reloadPreview()
{
m_previewReportWidget->refreshPages();
}
void PreviewReportWindow::setSettings(QSettings* value)
{
if (m_ownedSettings)

View File

@ -63,6 +63,7 @@ public:
void setPages(ReportPages pages);
void exec();
void initPreview(int pagesCount);
void reloadPreview();
void setSettings(QSettings* value);
void setErrorMessages(const QStringList& value);
void setToolBarVisible(bool value);

View File

@ -422,7 +422,7 @@ bool ReportDesignWidget::save()
bool ReportDesignWidget::loadFromFile(const QString &fileName)
{
if (m_report->loadFromFile(fileName)){
if (m_report->loadFromFile(fileName,false)){
createTabs();
//connectPage(m_report->pageAt(0));
m_scriptEditor->setPlainText(m_report->scriptContext()->initScript());

View File

@ -33,6 +33,7 @@
#include <QMessageBox>
#include <QApplication>
#include <QDesktopWidget>
#include <QFileSystemWatcher>
#include "time.h"
@ -60,13 +61,15 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) :
m_printer(new QPrinter(QPrinter::HighResolution)), m_printerSelected(false),
m_showProgressDialog(true), m_reportName(""), m_activePreview(0),
m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")),
m_reportRendering(false), m_resultIsEditable(true), m_passPhrase("HjccbzHjlbyfCkjy")
m_reportRendering(false), m_resultIsEditable(true), m_passPhrase("HjccbzHjlbyfCkjy"),
m_fileWatcher( new QFileSystemWatcher( this ) )
{
m_datasources = new DataSourceManager(this);
m_datasources->setReportSettings(&m_reportSettings);
m_scriptEngineContext = new ScriptEngineContext(this);
m_datasources->setObjectName("datasources");
connect(m_datasources,SIGNAL(loadCollectionFinished(QString)),this,SLOT(slotDataSourceCollectionLoaded(QString)));
connect(m_fileWatcher,SIGNAL(fileChanged(const QString &)),this,SLOT(slotLoadFromFile(const QString &)));
}
ReportEnginePrivate::~ReportEnginePrivate()
@ -156,7 +159,7 @@ void ReportEnginePrivate::slotDataSourceCollectionLoaded(const QString &collecti
emit datasourceCollectionLoadFinished(collectionName);
}
void ReportEnginePrivate::slotPreviewWindowDestroed(QObject* window)
void ReportEnginePrivate::slotPreviewWindowDestroyed(QObject* window)
{
if (m_activePreview == window){
m_activePreview = 0;
@ -404,7 +407,7 @@ void ReportEnginePrivate::previewReport(PreviewHints hints)
w->setHideResultEditButton(resultIsEditable());
m_activePreview = w;
connect(w,SIGNAL(destroyed(QObject*)), this, SLOT(slotPreviewWindowDestroed(QObject*)));
connect(w,SIGNAL(destroyed(QObject*)), this, SLOT(slotPreviewWindowDestroyed(QObject*)));
qDebug()<<"render time ="<<start.msecsTo(QTime::currentTime());
w->exec();
}
@ -475,6 +478,63 @@ void ReportEnginePrivate::setCurrentReportsDir(const QString &dirName)
m_reportsDir = dirName;
}
bool ReportEnginePrivate::slotLoadFromFile(const QString &fileName)
{
PreviewReportWindow *currentPreview = qobject_cast<PreviewReportWindow *>(m_activePreview);
if (!QFile::exists(fileName))
{
if ( hasActivePreview() )
{
QMessageBox::information( NULL,
tr( "Report File Change" ),
tr( "The report file \"%1\" has changed names or been deleted.\n\nThis preview is no longer valid." ).arg( fileName )
);
clearReport();
currentPreview->close();
}
return false;
}
clearReport();
ItemsReaderIntf::Ptr reader = FileXMLReader::create(fileName);
reader->setPassPhrase(m_passPhrase);
if (reader->first()){
if (reader->readItem(this)){
m_fileName=fileName;
QFileInfo fi(fileName);
m_reportName = fi.fileName();
QString dbSettingFileName = fi.absolutePath()+"/"+fi.baseName()+".db";
if (QFile::exists(dbSettingFileName)){
QSettings dbcredentals(dbSettingFileName, QSettings::IniFormat);
foreach (ConnectionDesc* connection, dataManager()->conections()) {
if (!connection->keepDBCredentials()){
dbcredentals.beginGroup(connection->name());
connection->setUserName(dbcredentals.value("user").toString());
connection->setPassword(dbcredentals.value("password").toString());
dbcredentals.endGroup();
}
}
}
dataManager()->connectAutoConnections();
if ( hasActivePreview() )
{
currentPreview->reloadPreview();
}
return true;
};
}
m_lastError = reader->lastError();
return false;
}
void ReportEnginePrivate::cancelRender()
{
if (m_reportRender)
@ -528,39 +588,20 @@ QSettings*ReportEnginePrivate::settings()
}
}
bool ReportEnginePrivate::loadFromFile(const QString &fileName)
bool ReportEnginePrivate::loadFromFile(const QString &fileName, bool autoLoadPreviewOnChange)
{
if (!QFile::exists(fileName)) return false;
// only watch one file at a time
if ( !m_fileWatcher->files().isEmpty() )
{
m_fileWatcher->removePaths( m_fileWatcher->files() );
}
clearReport();
if ( autoLoadPreviewOnChange )
{
m_fileWatcher->addPath( fileName );
}
ItemsReaderIntf::Ptr reader = FileXMLReader::create(fileName);
reader->setPassPhrase(m_passPhrase);
if (reader->first()){
if (reader->readItem(this)){
m_fileName=fileName;
QFileInfo fi(fileName);
m_reportName = fi.fileName();
QString dbSettingFileName = fi.absolutePath()+"/"+fi.baseName()+".db";
if (QFile::exists(dbSettingFileName)){
QSettings dbcredentals(dbSettingFileName, QSettings::IniFormat);
foreach (ConnectionDesc* connection, dataManager()->conections()) {
if (!connection->keepDBCredentials()){
dbcredentals.beginGroup(connection->name());
connection->setUserName(dbcredentals.value("user").toString());
connection->setPassword(dbcredentals.value("password").toString());
dbcredentals.endGroup();
}
}
}
dataManager()->connectAutoConnections();
return true;
};
}
m_lastError = reader->lastError();
return false;
return slotLoadFromFile( fileName );
}
bool ReportEnginePrivate::loadFromByteArray(QByteArray* data, const QString &name){
@ -899,10 +940,10 @@ IScriptEngineManager *ReportEngine::scriptManager()
return d->scriptManagerIntf();
}
bool ReportEngine::loadFromFile(const QString &fileName)
bool ReportEngine::loadFromFile(const QString &fileName, bool autoLoadPreviewOnChange)
{
Q_D(ReportEngine);
return d->loadFromFile(fileName);
return d->loadFromFile(fileName, autoLoadPreviewOnChange);
}
bool ReportEngine::loadFromByteArray(QByteArray* data){

View File

@ -87,7 +87,7 @@ public:
void setShowProgressDialog(bool value);
IDataSourceManager* dataManager();
IScriptEngineManager* scriptManager();
bool loadFromFile(const QString& fileName);
bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange = false);
bool loadFromByteArray(QByteArray *data);
bool loadFromString(const QString& data);
QString reportFileName();

View File

@ -42,6 +42,8 @@
#include "serializators/lrstorageintf.h"
#include "lrscriptenginemanager.h"
class QFileSystemWatcher;
namespace LimeReport{
class PageDesignIntf;
@ -91,7 +93,7 @@ public:
void setSettings(QSettings* value);
void setShowProgressDialog(bool value){m_showProgressDialog = value;}
QSettings* settings();
bool loadFromFile(const QString& fileName);
bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange);
bool loadFromByteArray(QByteArray *data, const QString& name = "");
bool loadFromString(const QString& report, const QString& name = "");
QString reportFileName(){return m_fileName;}
@ -138,13 +140,14 @@ signals:
void onSave();
void saveFinished();
public slots:
bool slotLoadFromFile(const QString& fileName);
void cancelRender();
protected:
PageDesignIntf* createPage(const QString& pageName="");
protected slots:
void slotDataSourceCollectionLoaded(const QString& collectionName);
private slots:
void slotPreviewWindowDestroed(QObject *window);
void slotPreviewWindowDestroyed(QObject *window);
private:
//ICollectionContainer
virtual QObject* createElement(const QString&,const QString&);
@ -178,6 +181,8 @@ private:
bool m_reportRendering;
bool m_resultIsEditable;
QString m_passPhrase;
QFileSystemWatcher *m_fileWatcher;
};
}

View File

@ -264,7 +264,7 @@ void ReportRender::renderPage(PageDesignIntf* patternPage)
BandDesignIntf* lastRenderedBand = 0;
for (int i=0;i<m_patternPageItem->dataBandCount() && !m_renderCanceled;i++){
lastRenderedBand = m_patternPageItem->dataBandAt(i);
initDatasource(lastRenderedBand->datasourceName());
initDatasource(lastRenderedBand->datasourceName());
renderDataBand(lastRenderedBand);
if (i<m_patternPageItem->dataBandCount()-1) closeFooterGroup(lastRenderedBand);
}
@ -273,7 +273,7 @@ void ReportRender::renderPage(PageDesignIntf* patternPage)
renderBand(reportFooter, 0, StartNewPageAsNeeded);
if (lastRenderedBand && lastRenderedBand->keepFooterTogether())
closeFooterGroup(lastRenderedBand);
BandDesignIntf* tearOffBand = m_patternPageItem->bandByType(BandDesignIntf::TearOffBand);
if (tearOffBand)
renderBand(tearOffBand, 0, StartNewPageAsNeeded);
@ -360,7 +360,7 @@ void ReportRender::extractGroupsFunction(BandDesignIntf *band)
foreach(BaseDesignIntf* item,band->childBaseItems()){
ContentItemDesignIntf* contentItem = dynamic_cast<ContentItemDesignIntf*>(item);
if (contentItem&&(contentItem->content().contains(QRegExp("\\$S\\s*\\{.*\\}")))){
foreach(QString functionName, m_datasources->groupFunctionNames()){
foreach(const QString &functionName, m_datasources->groupFunctionNames()){
QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName));
QRegExp rxName(QString(Const::GROUP_FUNCTION_NAME_RX).arg(functionName));
if (rx.indexIn(contentItem->content())>=0){
@ -413,7 +413,7 @@ void ReportRender::replaceGroupsFunction(BandDesignIntf *band)
ContentItemDesignIntf* contentItem = dynamic_cast<ContentItemDesignIntf*>(item);
if (contentItem){
QString content = contentItem->content();
foreach(QString functionName, m_datasources->groupFunctionNames()){
foreach(const QString &functionName, m_datasources->groupFunctionNames()){
QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName));
if (rx.indexIn(content)>=0){
int pos = 0;
@ -483,6 +483,7 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign
BandDesignIntf* upperPart = dynamic_cast<BandDesignIntf*>(bandClone->cloneUpperPart(m_maxHeightByColumn[m_currentColumn]));
registerBand(upperPart);
delete bandClone;
bandClone = NULL;
}
} else {
@ -500,6 +501,7 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign
BandDesignIntf* upperPart = dynamic_cast<BandDesignIntf*>(bandClone->cloneUpperPart(m_maxHeightByColumn[m_currentColumn]));
registerBand(upperPart);
delete bandClone;
bandClone = NULL;
};
} else {
bandClone->setHeight(m_maxHeightByColumn[m_currentColumn]);
@ -522,9 +524,12 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign
void ReportRender::renderDataBand(BandDesignIntf *dataBand)
{
if (dataBand == NULL )
return;
IDataSource* bandDatasource = 0;
m_lastRenderedFooter = 0;
if (dataBand && !dataBand->datasourceName().isEmpty())
if (!dataBand->datasourceName().isEmpty())
bandDatasource = datasources()->dataSource(dataBand->datasourceName());
BandDesignIntf* header = dataBand->bandHeader();
@ -775,7 +780,7 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da
closeDataGroup(band);
}
if (!gb->isStarted()){
if (gb && !gb->isStarted()){
if (band->reprintOnEachPage())
m_reprintableBands.append(band);
gb->startGroup(m_datasources);
@ -1325,7 +1330,7 @@ void ReportRender::savePage(bool isLast)
m_renderedPages.append(PageItemDesignIntf::Ptr(m_renderPageItem));
m_pageCount++;
emit pageRendered(m_pageCount);
if (isLast){
BandDesignIntf* ph = m_renderPageItem->bandByType(BandDesignIntf::PageHeader);
if (ph && !ph->property("printOnLastPage").toBool()){

View File

@ -36,7 +36,7 @@
#include "lrglobal.h"
LimeReport::PropertyDelegate::PropertyDelegate(QObject *parent)
:QItemDelegate(parent), m_editingItem(0), m_isEditing(false)
:QItemDelegate(parent), m_objectInspector(NULL), m_editingItem(0), m_isEditing(false)
{}
void LimeReport::PropertyDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const

View File

@ -37,7 +37,7 @@ class EnumPropItem : public ObjectPropItem
{
Q_OBJECT
public:
EnumPropItem():ObjectPropItem(){}
EnumPropItem():ObjectPropItem(), m_settingValue(false){}
EnumPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly)
:ObjectPropItem(object, objects, name, displayName, value, parent, readonly),m_settingValue(false){}
EnumPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly, QVector<int> acceptableValues)

View File

@ -87,7 +87,7 @@ class FontPropItem : public ObjectPropItem
{
Q_OBJECT
public:
FontPropItem():ObjectPropItem(){}
FontPropItem():ObjectPropItem(), m_pointSize(NULL), m_bold(NULL), m_italic(NULL), m_underline(NULL), m_family(NULL) {}
FontPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value,ObjectPropItem* parent, bool readonly);
QWidget* createProperyEditor(QWidget *parent) const;
QString displayValue() const;

View File

@ -35,7 +35,7 @@
namespace LimeReport{
ObjectBrowser::ObjectBrowser(QWidget *parent)
:QWidget(parent), m_changingItemSelection(false)
:QWidget(parent), m_report(NULL), m_mainWindow(NULL), m_changingItemSelection(false)
{
QVBoxLayout *layout = new QVBoxLayout(this);
setLayout(layout);

View File

@ -106,7 +106,6 @@ bool XMLReader::readItem(QObject *item)
void XMLReader::readItemFromNode(QObject* item,QDomElement *node)
{
ObjectLoadingStateIntf* lf = dynamic_cast<ObjectLoadingStateIntf*>(item);
if(lf) lf->objectLoadStarted();
for (int i=0;i<node->childNodes().count();i++){
@ -123,8 +122,8 @@ void XMLReader::readItemFromNode(QObject* item,QDomElement *node)
BaseDesignIntf* baseObj = dynamic_cast<BaseDesignIntf*>(item);
if(baseObj) {
foreach(QGraphicsItem* item,baseObj->childItems()){
BaseDesignIntf* baseItem = dynamic_cast<BaseDesignIntf*>(item);
foreach(QGraphicsItem* childItem,baseObj->childItems()){
BaseDesignIntf* baseItem = dynamic_cast<BaseDesignIntf*>(childItem);
if (baseItem) baseItem->parentObjectLoadFinished();
}
}