mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-23 20:22:58 +03:00
Changing the location of the report item has been fixed
This commit is contained in:
parent
0de9c0dde3
commit
d51579e1fc
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user