mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-24 16:44:39 +03:00
Merge branch 'develop' into feature/Interface_lang
This commit is contained in:
commit
a67231c538
@ -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
|
||||
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}\\\"
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include <QDebug>
|
||||
#include <QStringListModel>
|
||||
|
||||
#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();
|
||||
|
@ -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<ComboBoxEditor*>(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<ComboBoxEditor*>(sender())->setTextValue(locationToString(object()->property(propertyName().toLatin1()).toInt()));
|
||||
}
|
||||
}
|
||||
|
@ -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<Qt::BrushStyle>(backgroundBrushStyle()));
|
||||
brush.setTransform(painter->worldTransform().inverted());
|
||||
painter->fillRect(rect(), brush);
|
||||
}
|
||||
prepareRect(painter, option, widget);
|
||||
|
||||
if (itemMode() & DesignMode){
|
||||
painter->save();
|
||||
|
@ -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<QString> bookmarks(){ return m_bookmarks.keys();}
|
||||
|
@ -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<Qt::BrushStyle>(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();
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include <QFileInfo>
|
||||
#include <stdexcept>
|
||||
|
||||
#ifndef HAVE_QT4
|
||||
#ifdef BUILD_WITH_EASY_PROFILER
|
||||
#include "easy/profiler.h"
|
||||
#else
|
||||
# define EASY_BLOCK(...)
|
||||
|
@ -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(...)
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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<ItemDesignIntf*>(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<BaseDesignIntf*>(di);
|
||||
if (b)
|
||||
moveItemNode(b, parent);
|
||||
}
|
||||
m_defferedItems.clear();
|
||||
} else {
|
||||
if (!m_defferedItems.contains(item))
|
||||
m_defferedItems.append(item);
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectBrowserNode::setObject(QObject *value)
|
||||
|
@ -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<QObject*, ObjectBrowserNode*> m_itemsMap;
|
||||
bool m_changingItemSelection;
|
||||
bool m_movingItem;
|
||||
QList<QObject*> m_defferedItems;
|
||||
};
|
||||
|
||||
} //namespace LimeReport
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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<QString, QStringList> m_properties;
|
||||
QMap<QString, QStringList> m_signals;
|
||||
};
|
||||
|
||||
class ScriptEditor : public QWidget
|
||||
|
@ -36,7 +36,8 @@
|
||||
#include "lrreporttranslation.h"
|
||||
|
||||
#include <QDebug>
|
||||
#ifndef HAVE_QT4
|
||||
|
||||
#ifdef BUILD_WITH_EASY_PROFILER
|
||||
#include "easy/profiler.h"
|
||||
#else
|
||||
# define EASY_BLOCK(...)
|
||||
|
Loading…
Reference in New Issue
Block a user