diff --git a/common.pri b/common.pri index 8c0a66c..b4a4dce 100644 --- a/common.pri +++ b/common.pri @@ -11,13 +11,20 @@ DEPENDPATH += $$PWD/3rdparty/easyprofiler/easy_profiler_core/include contains(CONFIG, easy_profiler){ message(EasyProfiler) unix|win32: LIBS += -L$$PWD/3rdparty/easyprofiler/build/bin/ -leasy_profiler - DEFINES += BUILD_WITH_EASY_PROFILER + greaterThan(QT_MAJOR_VERSION, 4){ + DEFINES += BUILD_WITH_EASY_PROFILER + } } !contains(CONFIG, qtscriptengine){ greaterThan(QT_MAJOR_VERSION, 4){ +greaterThan(QT_MINOR_VERSION, 5){ CONFIG *= qjsengine } +lessThan(QT_MINOR_VERSION, 6){ + CONFIG *= qtscriptengine +} +} lessThan(QT_MAJOR_VERSION, 5){ CONFIG *= qtscriptengine } @@ -97,7 +104,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 76 +LIMEREPORT_VERSION_RELEASE = 78 LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}' DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\" diff --git a/demo_r1/mainwindow.cpp b/demo_r1/mainwindow.cpp index 48da52f..7f35de3 100644 --- a/demo_r1/mainwindow.cpp +++ b/demo_r1/mainwindow.cpp @@ -38,7 +38,7 @@ #include #include -#ifndef HAVE_QT4 +#ifdef BUILD_WITH_EASY_PROFILER #include "easy/profiler.h" #else # define EASY_BLOCK(...) @@ -127,7 +127,7 @@ void MainWindow::on_pushButton_clicked() report->setShowProgressDialog(false); report->designReport(); EASY_END_BLOCK; -#ifndef HAVE_QT4 +#ifdef BUILD_WITH_EASY_PROFILER profiler::dumpBlocksToFile("test.prof"); #endif } @@ -145,7 +145,7 @@ void MainWindow::on_pushButton_2_clicked() report->dataManager()->setReportVariable(ui->leVariableName->text(), ui->leVariableValue->text()); } EASY_END_BLOCK; -#ifndef HAVE_QT4 +#ifdef BUILD_WITH_EASY_PROFILER profiler::dumpBlocksToFile("test.prof"); #endif report->previewReport(); diff --git a/limereport/items/lrsubitemparentpropitem.cpp b/limereport/items/lrsubitemparentpropitem.cpp index 1587bc9..b02cfa7 100644 --- a/limereport/items/lrsubitemparentpropitem.cpp +++ b/limereport/items/lrsubitemparentpropitem.cpp @@ -77,8 +77,8 @@ void LimeReport::ItemLocationPropItem::setPropertyEditorData(QWidget *propertyEd } void LimeReport::ItemLocationPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index){ - object()->setProperty(propertyName().toLatin1(),stringToLocation(qobject_cast(propertyEditor)->text())); model->setData(index,object()->property(propertyName().toLatin1())); + setValueToObject(propertyName(), propertyValue()); } QString LimeReport::ItemLocationPropItem::locationToString(LimeReport::ItemDesignIntf::LocationType location) const{ @@ -92,6 +92,5 @@ LimeReport::ItemDesignIntf::LocationType LimeReport::ItemLocationPropItem::strin void LimeReport::ItemLocationPropItem::slotLocationChanged(const QString &text){ if ( locationToString(object()->property(propertyName().toLatin1()).toInt())!=text){ object()->setProperty(propertyName().toLatin1(),stringToLocation(text)); - dynamic_cast(sender())->setTextValue(locationToString(object()->property(propertyName().toLatin1()).toInt())); } } diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index c843fac..af9e324 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -191,14 +191,27 @@ void BandDesignIntf::copyBookmarks(BandDesignIntf* sourceBand) } } +void BandDesignIntf::setBackgroundModeProperty(BaseDesignIntf::BGMode value) +{ + if (value!=backgroundMode()){ + BaseDesignIntf::BGMode oldValue = backgroundMode(); + setBackgroundMode(value); + notify("backgroundMode",oldValue,value); + } +} + +void BandDesignIntf::setBackgroundOpacity(int value) +{ + if (opacity()!=value){ + int oldValue = opacity(); + setOpacity(value); + notify("backgroundOpacity",oldValue,value); + } +} + void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { - - if ( !(backgroundColor() == Qt::white && backgroundBrushStyle() == SolidPattern) ) { - QBrush brush(backgroundColor(), static_cast(backgroundBrushStyle())); - brush.setTransform(painter->worldTransform().inverted()); - painter->fillRect(rect(), brush); - } + prepareRect(painter, option, widget); if (itemMode() & DesignMode){ painter->save(); diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index 44def94..f3750b0 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -106,6 +106,8 @@ class BandDesignIntf : public ItemsContainerDesignInft Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor) Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle) Q_PROPERTY(bool printIfEmpty READ printIfEmpty WRITE setPrintIfEmpty) + Q_PROPERTY(BGMode backgroundMode READ backgroundMode WRITE setBackgroundModeProperty) + Q_PROPERTY(int backgroundOpacity READ opacity WRITE setBackgroundOpacity) Q_ENUMS(BandColumnsLayoutType) friend class BandMarker; friend class BandNameLabel; @@ -243,6 +245,8 @@ public: void setUseAlternateBackgroundColor(bool useAlternateBackgroundColor); void replaceGroupsFunction(BandDesignIntf *band); qreal bottomSpace() const; + void setBackgroundModeProperty(BGMode value); + void setBackgroundOpacity(int value); void addBookmark(const QString& key, const QVariant& value){ m_bookmarks.insert(key, value);} QList bookmarks(){ return m_bookmarks.keys();} diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 27ae5f3..520b893 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -400,19 +400,21 @@ void BaseDesignIntf::prepareRect(QPainter *painter, const QStyleOptionGraphicsIt { painter->save(); + QRectF r = rect().adjusted(0, 0, borderLineSize(), borderLineSize()); QBrush brush(m_backgroundColor,static_cast(m_backgroundBrushStyle)); brush.setTransform(painter->worldTransform().inverted()); if (isSelected() && (opacity() == 100) && (m_BGMode!=TransparentMode)) { - painter->fillRect(rect(), brush); + painter->fillRect(r, brush); } else { if (m_BGMode == OpaqueMode) { - painter->setOpacity(qreal(m_opacity) / 100); - painter->fillRect(rect(), brush); + qreal o = (itemMode() & DesignMode) ? 0.5 : qreal(m_opacity) / 100; + painter->setOpacity(o); + painter->fillRect(r, brush); } else if (itemMode() & DesignMode){ painter->setOpacity(0.1); - painter->fillRect(rect(), QBrush(QPixmap(":/report/images/empty"))); + painter->fillRect(r, QBrush(QPixmap(":/report/images/empty"))); } } painter->restore(); diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index 60a61fe..ad1cd58 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -37,7 +37,7 @@ #include #include -#ifndef HAVE_QT4 +#ifdef BUILD_WITH_EASY_PROFILER #include "easy/profiler.h" #else # define EASY_BLOCK(...) diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 0c8d92f..c9ae526 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -56,7 +56,7 @@ #include "lrpreviewreportwidget.h" #include "lrpreviewreportwidget_p.h" -#ifndef HAVE_QT4 +#ifdef BUILD_WITH_EASY_PROFILER #include "easy/profiler.h" #else # define EASY_BLOCK(...) diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index d50de7e..3b2385e 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -346,8 +346,8 @@ void ScriptEngineManager::setDataManager(DataSourceManager *dataManager){ LimeReport::Const::FUNCTION_MANAGER_NAME, m_functionManager, QString("function %1(fieldName, bandName, pageitem){\ - pageitem = typeof pageitem !== 'undefined' ? pageitem : 0; \ - return %2.calcGroupFunction(\"%1\",fieldName, bandName, pageitem);}" + if (typeof pageitem == 'undefined') return %2.calcGroupFunction(\"%1\", fieldName, bandName); \ + else return %2.calcGroupFunction(\"%1\", fieldName, bandName, pageitem);}" ).arg(func) .arg(LimeReport::Const::FUNCTION_MANAGER_NAME) ); @@ -1471,6 +1471,11 @@ QVariant ScriptFunctionsManager::calcGroupFunction(const QString &name, const QS } } +QVariant ScriptFunctionsManager::calcGroupFunction(const QString& name, const QString& expressionID, const QString& bandName) +{ + return calcGroupFunction(name, expressionID, bandName, 0); +} + QVariant ScriptFunctionsManager::line(const QString &bandName) { QString varName = QLatin1String("line_")+bandName.toLower(); diff --git a/limereport/lrscriptenginemanager.h b/limereport/lrscriptenginemanager.h index 41d9b96..a15f524 100644 --- a/limereport/lrscriptenginemanager.h +++ b/limereport/lrscriptenginemanager.h @@ -307,6 +307,7 @@ public: foreach(IWrapperCreator* wrapper, m_wrappersFactory.values()){ delete wrapper;} m_wrappersFactory.clear(); } Q_INVOKABLE QVariant calcGroupFunction(const QString& name, const QString& expressionID, const QString& bandName, QObject* currentPage); + Q_INVOKABLE QVariant calcGroupFunction(const QString& name, const QString& expressionID, const QString& bandName); Q_INVOKABLE QVariant line(const QString& bandName); Q_INVOKABLE QVariant numberFormat(QVariant value, const char &format, int precision, const QString &locale); Q_INVOKABLE QVariant dateFormat(QVariant value, const QString& format); diff --git a/limereport/objectsbrowser/lrobjectbrowser.cpp b/limereport/objectsbrowser/lrobjectbrowser.cpp index e657a81..a5ee464 100644 --- a/limereport/objectsbrowser/lrobjectbrowser.cpp +++ b/limereport/objectsbrowser/lrobjectbrowser.cpp @@ -35,7 +35,8 @@ namespace LimeReport{ ObjectBrowser::ObjectBrowser(QWidget *parent) - :QWidget(parent), m_report(NULL), m_mainWindow(NULL), m_changingItemSelection(false) + :QWidget(parent), m_report(NULL), m_mainWindow(NULL), + m_changingItemSelection(false), m_movingItem(false) { QVBoxLayout *layout = new QVBoxLayout(this); setLayout(layout); @@ -86,6 +87,7 @@ void ObjectBrowser::slotClear() } void ObjectBrowser::fillNode(QTreeWidgetItem* parentNode, BaseDesignIntf* reportItem, BaseDesignIntf *ignoredItem){ + foreach (BaseDesignIntf* item, reportItem->childBaseItems()) { if (item != ignoredItem){ ObjectBrowserNode* treeItem = new ObjectBrowserNode(parentNode); @@ -93,11 +95,11 @@ void ObjectBrowser::fillNode(QTreeWidgetItem* parentNode, BaseDesignIntf* report treeItem->setObject(item); treeItem->setIcon(0,QIcon(":/items/"+extractClassName(item->metaObject()->className()))); connect(item, SIGNAL(propertyObjectNameChanged(QString,QString)), - this, SLOT(slotPropertyObjectNameChanged(QString,QString))); + this, SLOT(slotPropertyObjectNameChanged(QString,QString)), Qt::UniqueConnection); ItemDesignIntf* i = dynamic_cast(item); if (i){ connect(i, SIGNAL(itemLocationChanged(BaseDesignIntf*,BaseDesignIntf*)), - this, SLOT(slotItemParentChanged(BaseDesignIntf*,BaseDesignIntf*))); + this, SLOT(slotItemParentChanged(BaseDesignIntf*,BaseDesignIntf*)), Qt::UniqueConnection); } m_itemsMap.insert(item,treeItem); parentNode->addChild(treeItem); @@ -283,7 +285,9 @@ void ObjectBrowser::slotActivePageUpdated(LimeReport::PageDesignIntf *) buildTree(); } -void ObjectBrowser::slotItemParentChanged(BaseDesignIntf* item, BaseDesignIntf* parent) + + +void ObjectBrowser::moveItemNode(BaseDesignIntf* item, BaseDesignIntf* parent) { if (m_itemsMap.contains(item) && m_itemsMap.contains(parent)){ m_itemsMap.value(item)->parent()->removeChild(m_itemsMap.value(item)); @@ -293,7 +297,24 @@ void ObjectBrowser::slotItemParentChanged(BaseDesignIntf* item, BaseDesignIntf* item->setSelected(true); m_changingItemSelection = false; } +} +void ObjectBrowser::slotItemParentChanged(BaseDesignIntf* item, BaseDesignIntf* parent) +{ + if (!m_movingItem){ + m_movingItem = true; + moveItemNode(item, parent); + m_movingItem = false; + foreach(QObject* di, m_defferedItems){ + BaseDesignIntf* b = dynamic_cast(di); + if (b) + moveItemNode(b, parent); + } + m_defferedItems.clear(); + } else { + if (!m_defferedItems.contains(item)) + m_defferedItems.append(item); + } } void ObjectBrowserNode::setObject(QObject *value) diff --git a/limereport/objectsbrowser/lrobjectbrowser.h b/limereport/objectsbrowser/lrobjectbrowser.h index 4bdcb52..9d9482b 100644 --- a/limereport/objectsbrowser/lrobjectbrowser.h +++ b/limereport/objectsbrowser/lrobjectbrowser.h @@ -60,6 +60,7 @@ protected: void buildTree(BaseDesignIntf *ignoredItem = 0); void removeItem(BaseDesignIntf* item); void findAndRemove(QTreeWidgetItem *node, BaseDesignIntf *item); + void moveItemNode(BaseDesignIntf* item, BaseDesignIntf* parent); private slots: // void slotObjectNameChanged(const QString& objectName); void slotPropertyObjectNameChanged(const QString& oldName, const QString& newName); @@ -82,6 +83,8 @@ private: QTreeWidget* m_treeView; QMap m_itemsMap; bool m_changingItemSelection; + bool m_movingItem; + QList m_defferedItems; }; } //namespace LimeReport diff --git a/limereport/scripteditor/lrscripteditor.cpp b/limereport/scripteditor/lrscripteditor.cpp index d78a361..f40068a 100644 --- a/limereport/scripteditor/lrscripteditor.cpp +++ b/limereport/scripteditor/lrscripteditor.cpp @@ -272,7 +272,8 @@ void ReportStructureCompleater::updateCompleaterModel(ReportEnginePrivateInterfa { if (report){ m_model.clear(); - + QIcon signalIcon(":/report/images/signal"); + QIcon propertyIcon(":/report/images/property"); addAdditionalDatawords(report->dataManager()); for ( int i = 0; i < report->pageCount(); ++i){ @@ -283,18 +284,18 @@ void ReportStructureCompleater::updateCompleaterModel(ReportEnginePrivateInterfa itemNode->setIcon(QIcon(":/report/images/object")); m_model.invisibleRootItem()->appendRow(itemNode); - QStringList items = extractSlotNames(page->pageItem()); + QStringList items = extractSignalNames(page->pageItem()); foreach(QString slotName, items){ QStandardItem* slotItem = new QStandardItem; slotItem->setText(slotName); - slotItem->setIcon(QIcon(":/report/images/signal")); + slotItem->setIcon(signalIcon); itemNode->appendRow(slotItem); } - items = extractPropertyes(page->pageItem()); + items = extractProperties(page->pageItem()); foreach(QString propertyName, items){ QStandardItem* properyItem = new QStandardItem; properyItem->setText(propertyName); - properyItem->setIcon(QIcon(":/report/images/property")); + properyItem->setIcon(propertyIcon); itemNode->appendRow(properyItem); } foreach (BaseDesignIntf* item, page->pageItem()->childBaseItems()){ @@ -311,7 +312,7 @@ void ReportStructureCompleater::updateCompleaterModel(DataSourceManager *dataMan addAdditionalDatawords(dataManager); } -QStringList ReportStructureCompleater::extractSlotNames(BaseDesignIntf *item) +QStringList ReportStructureCompleater::extractSignalNames(BaseDesignIntf *item) { QStringList result; if (!item) return result; @@ -333,7 +334,7 @@ QStringList ReportStructureCompleater::extractSlotNames(BaseDesignIntf *item) return result; } -QStringList ReportStructureCompleater::extractPropertyes(BaseDesignIntf *item) +QStringList ReportStructureCompleater::extractProperties(BaseDesignIntf *item) { QStringList result; if (!item) return result; @@ -353,24 +354,43 @@ void ReportStructureCompleater::addChildItem(BaseDesignIntf *item, const QString { if (!item) return; + QIcon signalIcon(":/report/images/signal"); + QIcon propertyIcon(":/report/images/property"); + QStandardItem* itemNode = new QStandardItem; itemNode->setText(pageName+"_"+item->objectName()); itemNode->setIcon(QIcon(":/report/images/object")); parent->appendRow(itemNode); - QStringList items = extractSlotNames(item); + QStringList items; + + if (!m_signals.contains(item->metaObject()->className())){ + items = extractSignalNames(item); + m_signals.insert(item->metaObject()->className(),items); + } else { + items = m_signals.value(item->metaObject()->className()); + } + foreach(QString slotName, items){ QStandardItem* slotItem = new QStandardItem; slotItem->setText(slotName); - slotItem->setIcon(QIcon(":/report/images/signal")); + slotItem->setIcon(signalIcon); itemNode->appendRow(slotItem); } - items = extractPropertyes(item); + + if (!m_properties.contains(item->metaObject()->className())){ + items = extractProperties(item); + m_properties.insert(item->metaObject()->className(),items); + } else { + items = m_properties.value(item->metaObject()->className()); + } + foreach(QString propertyName, items){ QStandardItem* properyItem = new QStandardItem; properyItem->setText(propertyName); - properyItem->setIcon(QIcon(":/report/images/property")); + properyItem->setIcon(propertyIcon); itemNode->appendRow(properyItem); } + foreach (BaseDesignIntf* child, item->childBaseItems()){ addChildItem(child, pageName, parent); } diff --git a/limereport/scripteditor/lrscripteditor.h b/limereport/scripteditor/lrscripteditor.h index 31d16fd..e9e0aa6 100644 --- a/limereport/scripteditor/lrscripteditor.h +++ b/limereport/scripteditor/lrscripteditor.h @@ -33,12 +33,14 @@ public: void updateCompleaterModel(ReportEnginePrivateInterface* report); void updateCompleaterModel(DataSourceManager* dataManager); protected: - QStringList extractSlotNames(BaseDesignIntf* item); - QStringList extractPropertyes(BaseDesignIntf* item); + QStringList extractSignalNames(BaseDesignIntf* item); + QStringList extractProperties(BaseDesignIntf* item); void addChildItem(BaseDesignIntf *item, const QString &pageName, QStandardItem *parent); void addAdditionalDatawords(DataSourceManager *dataManager); private: QStandardItemModel m_model; + QMap m_properties; + QMap m_signals; }; class ScriptEditor : public QWidget diff --git a/limereport/serializators/lrxmlreader.cpp b/limereport/serializators/lrxmlreader.cpp index 8748ae5..7439fc4 100644 --- a/limereport/serializators/lrxmlreader.cpp +++ b/limereport/serializators/lrxmlreader.cpp @@ -36,7 +36,8 @@ #include "lrreporttranslation.h" #include -#ifndef HAVE_QT4 + +#ifdef BUILD_WITH_EASY_PROFILER #include "easy/profiler.h" #else # define EASY_BLOCK(...)