0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 00:33:02 +03:00

Changing the location of the report item has been fixed

This commit is contained in:
Arin Alexander 2017-10-12 22:00:28 +03:00
commit 887bbff5ac
4 changed files with 25 additions and 2 deletions

View File

@ -59,6 +59,7 @@ void ItemDesignIntf::setItemLocation(LocationType location)
setParentItem(parentBand);
setParent(dynamic_cast<BandDesignIntf*>(parentBand));
setPos(parentPos);
emit itemLocationChanged(this, dynamic_cast<BandDesignIntf*>(parentBand));
} else {
m_itemLocation=Page;
}
@ -69,6 +70,7 @@ void ItemDesignIntf::setItemLocation(LocationType location)
setParentItem(page);
setParent(page);
setPos(parentPos);
emit itemLocationChanged(this, page);
}
}
notify("locationType",oldValue,location);
@ -95,8 +97,8 @@ BaseDesignIntf *ItemDesignIntf::cloneEmpty(int height, QObject *owner, QGraphics
QGraphicsItem * ItemDesignIntf::bandByPos()
{
foreach(QGraphicsItem *item,collidingItems()){
if (dynamic_cast<BandDesignIntf*>(item)){
foreach(QGraphicsItem *item, scene()->items()){
if (dynamic_cast<BandDesignIntf*>(item) && item->collidesWithItem(this)){
return item;
}
}

View File

@ -50,6 +50,8 @@ public:
void setStretchToMaxHeight(bool value);
bool stretchToMaxHeight(){return m_stretchToMaxHeight;}
BaseDesignIntf* cloneEmpty(int height, QObject *owner, QGraphicsItem *parent);
signals:
void itemLocationChanged(BaseDesignIntf* item, BaseDesignIntf* parent);
protected:
QGraphicsItem* bandByPos();
virtual void initFlags();

View File

@ -94,6 +94,11 @@ void ObjectBrowser::fillNode(QTreeWidgetItem* parentNode, BaseDesignIntf* report
treeItem->setIcon(0,QIcon(":/items/"+extractClassName(item->metaObject()->className())));
connect(item, SIGNAL(propertyObjectNameChanged(QString,QString)),
this, SLOT(slotPropertyObjectNameChanged(QString,QString)));
ItemDesignIntf* i = dynamic_cast<ItemDesignIntf*>(item);
if (i){
connect(i, SIGNAL(itemLocationChanged(BaseDesignIntf*,BaseDesignIntf*)),
this, SLOT(slotItemParentChanged(BaseDesignIntf*,BaseDesignIntf*)));
}
m_itemsMap.insert(item,treeItem);
parentNode->addChild(treeItem);
if (!item->childBaseItems().isEmpty())
@ -278,6 +283,19 @@ void ObjectBrowser::slotActivePageUpdated(LimeReport::PageDesignIntf *)
buildTree();
}
void ObjectBrowser::slotItemParentChanged(BaseDesignIntf* item, BaseDesignIntf* parent)
{
if (m_itemsMap.contains(item) && m_itemsMap.contains(parent)){
m_itemsMap.value(item)->parent()->removeChild(m_itemsMap.value(item));
m_itemsMap.value(parent)->addChild(m_itemsMap.value(item));
m_changingItemSelection = true;
m_itemsMap.value(item)->setSelected(true);
item->setSelected(true);
m_changingItemSelection = false;
}
}
void ObjectBrowserNode::setObject(QObject *value)
{
m_object = value;

View File

@ -75,6 +75,7 @@ private slots:
void slotMultiItemSelected();
void slotItemDoubleClicked(QTreeWidgetItem* item,int);
void slotActivePageUpdated(LimeReport::PageDesignIntf*);
void slotItemParentChanged(BaseDesignIntf* item, BaseDesignIntf* parent);
private:
ReportDesignWidget* m_report;
QMainWindow* m_mainWindow;