mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2025-03-15 06:46:23 +03:00
Fix #36 Copy/Paste from within a band
This commit is contained in:
parent
17ca1d142f
commit
b5a6baa78c
@ -208,7 +208,7 @@ public:
|
|||||||
|
|
||||||
bool startFromNewPage() const;
|
bool startFromNewPage() const;
|
||||||
void setStartFromNewPage(bool startFromNewPage);
|
void setStartFromNewPage(bool startFromNewPage);
|
||||||
|
bool canContainChildren(){ return true;}
|
||||||
signals:
|
signals:
|
||||||
void bandRendered(BandDesignIntf* band);
|
void bandRendered(BandDesignIntf* band);
|
||||||
protected:
|
protected:
|
||||||
|
@ -245,6 +245,7 @@ public:
|
|||||||
QColor borderColor() const;
|
QColor borderColor() const;
|
||||||
void setBorderColor(const QColor &borderColor);
|
void setBorderColor(const QColor &borderColor);
|
||||||
void setItemVisible(const bool& value);
|
void setItemVisible(const bool& value);
|
||||||
|
virtual bool canContainChildren(){ return false;}
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//ICollectionContainer
|
//ICollectionContainer
|
||||||
|
@ -1202,22 +1202,36 @@ void PageDesignIntf::copy()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BaseDesignIntf* PageDesignIntf::findDestObject(BaseDesignIntf* item){
|
||||||
|
if (item && item->canContainChildren()) return item;
|
||||||
|
BaseDesignIntf * curItem = item;
|
||||||
|
while (curItem && !curItem->canContainChildren()){
|
||||||
|
curItem = dynamic_cast<BaseDesignIntf*>(curItem->parentItem());
|
||||||
|
}
|
||||||
|
return curItem;
|
||||||
|
}
|
||||||
|
|
||||||
void PageDesignIntf::paste()
|
void PageDesignIntf::paste()
|
||||||
{
|
{
|
||||||
QClipboard *clipboard = QApplication::clipboard();
|
QClipboard *clipboard = QApplication::clipboard();
|
||||||
|
|
||||||
if (selectedItems().count() == 1) {
|
if (!selectedItems().isEmpty()) {
|
||||||
BandDesignIntf *band = dynamic_cast<BandDesignIntf *>(selectedItems().at(0));
|
BaseDesignIntf* destItem = findDestObject(dynamic_cast<BaseDesignIntf*>(selectedItems().at(0)));
|
||||||
if (band) {
|
if (destItem){
|
||||||
CommandIf::Ptr command = PasteCommand::create(this, clipboard->text(), band);
|
CommandIf::Ptr command = PasteCommand::create(this, clipboard->text(), destItem);
|
||||||
saveCommand(command);
|
saveCommand(command);
|
||||||
} else {
|
|
||||||
PageItemDesignIntf* page = dynamic_cast<PageItemDesignIntf*>(selectedItems().at(0));
|
|
||||||
if (page){
|
|
||||||
CommandIf::Ptr command = PasteCommand::create(this, clipboard->text(), page);
|
|
||||||
saveCommand(command);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// BandDesignIntf *band = dynamic_cast<BandDesignIntf *>(selectedItems().at(0));
|
||||||
|
// if (band) {
|
||||||
|
// CommandIf::Ptr command = PasteCommand::create(this, clipboard->text(), band);
|
||||||
|
// saveCommand(command);
|
||||||
|
// } else {
|
||||||
|
// PageItemDesignIntf* page = dynamic_cast<PageItemDesignIntf*>(selectedItems().at(0));
|
||||||
|
// if (page){
|
||||||
|
// CommandIf::Ptr command = PasteCommand::create(this, clipboard->text(), page);
|
||||||
|
// saveCommand(command);
|
||||||
|
// } else {}
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ namespace LimeReport {
|
|||||||
virtual void dropEvent(QGraphicsSceneDragDropEvent *event);
|
virtual void dropEvent(QGraphicsSceneDragDropEvent *event);
|
||||||
|
|
||||||
LimeReport::BandDesignIntf::BandsType findPriorType(LimeReport::BandDesignIntf::BandsType bandType);
|
LimeReport::BandDesignIntf::BandsType findPriorType(LimeReport::BandDesignIntf::BandsType bandType);
|
||||||
|
BaseDesignIntf *findDestObject(BaseDesignIntf *item);
|
||||||
|
|
||||||
bool isExistsObjectName (const QString& objectName, QList<QGraphicsItem *> &itemsList) const;
|
bool isExistsObjectName (const QString& objectName, QList<QGraphicsItem *> &itemsList) const;
|
||||||
QRectF getRectByPageSize(PageSize pageSize);
|
QRectF getRectByPageSize(PageSize pageSize);
|
||||||
|
@ -111,7 +111,7 @@ public:
|
|||||||
|
|
||||||
bool oldPrintMode() const;
|
bool oldPrintMode() const;
|
||||||
void setOldPrintMode(bool oldPrintMode);
|
void setOldPrintMode(bool oldPrintMode);
|
||||||
|
bool canContainChildren(){ return true;}
|
||||||
protected slots:
|
protected slots:
|
||||||
void bandDeleted(QObject* band);
|
void bandDeleted(QObject* band);
|
||||||
void bandGeometryChanged(QObject* /*object*/, QRectF newGeometry, QRectF oldGeometry);
|
void bandGeometryChanged(QObject* /*object*/, QRectF newGeometry, QRectF oldGeometry);
|
||||||
|
Loading…
Reference in New Issue
Block a user