0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-23 16:22:58 +03:00

#284 Issue has been fixed. The objects will get new names in paste process

This commit is contained in:
Arin Alexandex 2020-08-11 20:37:21 +03:00
parent 0693ba10ec
commit 5b127ce99c
6 changed files with 29 additions and 33 deletions

View File

@ -133,7 +133,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
LIMEREPORT_VERSION_MAJOR = 1
LIMEREPORT_VERSION_MINOR = 5
LIMEREPORT_VERSION_RELEASE = 63
LIMEREPORT_VERSION_RELEASE = 64
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"

View File

@ -253,6 +253,7 @@ public:
bool startFromNewPage() const;
void setStartFromNewPage(bool startFromNewPage);
bool canContainChildren() const{ return true;}
bool canAcceptPaste() const{ return true;}
bool printAlways() const;
void setPrintAlways(bool printAlways);
bool repeatOnEachRow() const;

View File

@ -297,6 +297,7 @@ public:
void setBorderColor(const QColor &borderColor);
void setItemVisible(const bool& value);
virtual bool canContainChildren() const { return false;}
virtual bool canAcceptPaste() const{ return false;}
ReportSettings* reportSettings() const;
void setReportSettings(ReportSettings *reportSettings);
void setZValueProperty(qreal value);
@ -311,6 +312,15 @@ public:
virtual void setWatermark(bool watermark);
void updateSelectionMarker();
void turnOnSelectionMarker(bool value);
bool fillTransparentInDesignMode() const;
void setFillTransparentInDesignMode(bool fillTransparentInDesignMode);
void emitPosChanged(QPointF oldPos, QPointF newPos);
void emitObjectNamePropertyChanged(const QString& oldName, const QString& newName);
bool isGeometryLocked() const;
void setGeometryLocked(bool itemLocked);
bool isChangingPos() const;
void setIsChangingPos(bool isChangingPos);
Q_INVOKABLE QString setItemWidth(qreal width);
Q_INVOKABLE QString setItemHeight(qreal height);
Q_INVOKABLE qreal getItemWidth();
@ -322,18 +332,6 @@ public:
Q_INVOKABLE QString setItemPosX(qreal xValue);
Q_INVOKABLE QString setItemPosY(qreal yValue);
bool fillTransparentInDesignMode() const;
void setFillTransparentInDesignMode(bool fillTransparentInDesignMode);
void emitPosChanged(QPointF oldPos, QPointF newPos);
void emitObjectNamePropertyChanged(const QString& oldName, const QString& newName);
bool isGeometryLocked() const;
void setGeometryLocked(bool itemLocked);
bool isChangingPos() const;
void setIsChangingPos(bool isChangingPos);
protected:
//ICollectionContainer
@ -404,6 +402,7 @@ private:
void moveSelectedItems(QPointF delta);
Qt::CursorShape getPossibleCursor(int cursorFlags);
void updatePossibleDirectionFlags();
private:
QPointF m_startPos;
int m_resizeHandleSize;

View File

@ -132,23 +132,6 @@ void PageDesignIntf::updatePageRect()
emit sceneRectChanged(sceneRect());
}
//PageDesignIntf::Orientation PageDesignIntf::getOrientation()
//{
// return m_orientation;
//}
//void PageDesignIntf::setPageSize(PageDesignIntf::PageSize sizeType, QSizeF sizeValue)
//{
// m_pageSize = sizeType;
// m_pageSizeValue = sizeValue;
// updatePageRect();
//}
//PageDesignIntf::PageSize PageDesignIntf::pageSize() const
//{
// return m_pageSize;
//}
void PageDesignIntf::keyPressEvent(QKeyEvent *event)
{
if (event->modifiers() == Qt::NoModifier ||
@ -1342,9 +1325,9 @@ void PageDesignIntf::copy()
}
BaseDesignIntf* PageDesignIntf::findDestObject(BaseDesignIntf* item){
if (item && item->canContainChildren()) return item;
if (item && item->canAcceptPaste()) return item;
BaseDesignIntf * curItem = item;
while (curItem && !curItem->canContainChildren()){
while (curItem && !curItem->canAcceptPaste()){
curItem = dynamic_cast<BaseDesignIntf*>(curItem->parentItem());
}
return curItem;
@ -2110,6 +2093,9 @@ bool PasteCommand::insertItem(ItemsReaderIntf::Ptr reader)
if (page()->reportItemsByName(item->objectName()).size()>1){
item->setObjectName(objectName);
}
foreach(QObject* child, item->children()){
changeName(page(), child);
};
m_itemNames.push_back(item->objectName());
}
return true;
@ -2117,6 +2103,14 @@ bool PasteCommand::insertItem(ItemsReaderIntf::Ptr reader)
return false;
}
void PasteCommand::changeName(PageDesignIntf *page, QObject* item)
{
item->setObjectName(page->genObjectName(*item));
foreach(QObject* child, item->children()){
changeName(page, child);
};
}
CommandIf::Ptr CutCommand::create(PageDesignIntf *page)
{
CutCommand *command = new CutCommand();

View File

@ -266,7 +266,7 @@ namespace LimeReport {
void bandDeleted(QObject* band);
void slotPageItemLoaded(QObject *);
void slotSelectionChanged();
void slotAnimationStoped(QObject *animation);
void slotAnimationStoped(QObject *animation);
private:
template <typename T>
BaseDesignIntf* internalAddBand(T bandType);
@ -430,6 +430,7 @@ namespace LimeReport {
void setItemsXML(const QString& itemsXML);
void setParent(BaseDesignIntf* parent){m_parentItemName = parent->objectName();}
bool insertItem(ItemsReaderIntf::Ptr reader);
void changeName(PageDesignIntf* page, QObject *item);
private:
QString m_itemsXML;
QString m_parentItemName;

View File

@ -144,6 +144,7 @@ public:
bool oldPrintMode() const;
void setOldPrintMode(bool oldPrintMode);
bool canContainChildren() const{ return true;}
bool canAcceptPaste() const{ return true;}
bool resetPageNumber() const;
void setResetPageNumber(bool resetPageNumber);
void updateSubItemsSize(RenderPass pass, DataSourceManager *dataManager);