mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-25 00:54:39 +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);
|
setParentItem(parentBand);
|
||||||
setParent(dynamic_cast<BandDesignIntf*>(parentBand));
|
setParent(dynamic_cast<BandDesignIntf*>(parentBand));
|
||||||
setPos(parentPos);
|
setPos(parentPos);
|
||||||
|
emit itemLocationChanged(this, dynamic_cast<BandDesignIntf*>(parentBand));
|
||||||
} else {
|
} else {
|
||||||
m_itemLocation=Page;
|
m_itemLocation=Page;
|
||||||
}
|
}
|
||||||
@ -69,6 +70,7 @@ void ItemDesignIntf::setItemLocation(LocationType location)
|
|||||||
setParentItem(page);
|
setParentItem(page);
|
||||||
setParent(page);
|
setParent(page);
|
||||||
setPos(parentPos);
|
setPos(parentPos);
|
||||||
|
emit itemLocationChanged(this, page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
notify("locationType",oldValue,location);
|
notify("locationType",oldValue,location);
|
||||||
@ -95,8 +97,8 @@ BaseDesignIntf *ItemDesignIntf::cloneEmpty(int height, QObject *owner, QGraphics
|
|||||||
|
|
||||||
QGraphicsItem * ItemDesignIntf::bandByPos()
|
QGraphicsItem * ItemDesignIntf::bandByPos()
|
||||||
{
|
{
|
||||||
foreach(QGraphicsItem *item,collidingItems()){
|
foreach(QGraphicsItem *item, scene()->items()){
|
||||||
if (dynamic_cast<BandDesignIntf*>(item)){
|
if (dynamic_cast<BandDesignIntf*>(item) && item->collidesWithItem(this)){
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,8 @@ public:
|
|||||||
void setStretchToMaxHeight(bool value);
|
void setStretchToMaxHeight(bool value);
|
||||||
bool stretchToMaxHeight(){return m_stretchToMaxHeight;}
|
bool stretchToMaxHeight(){return m_stretchToMaxHeight;}
|
||||||
BaseDesignIntf* cloneEmpty(int height, QObject *owner, QGraphicsItem *parent);
|
BaseDesignIntf* cloneEmpty(int height, QObject *owner, QGraphicsItem *parent);
|
||||||
|
signals:
|
||||||
|
void itemLocationChanged(BaseDesignIntf* item, BaseDesignIntf* parent);
|
||||||
protected:
|
protected:
|
||||||
QGraphicsItem* bandByPos();
|
QGraphicsItem* bandByPos();
|
||||||
virtual void initFlags();
|
virtual void initFlags();
|
||||||
|
@ -94,6 +94,11 @@ void ObjectBrowser::fillNode(QTreeWidgetItem* parentNode, BaseDesignIntf* report
|
|||||||
treeItem->setIcon(0,QIcon(":/items/"+extractClassName(item->metaObject()->className())));
|
treeItem->setIcon(0,QIcon(":/items/"+extractClassName(item->metaObject()->className())));
|
||||||
connect(item, SIGNAL(propertyObjectNameChanged(QString,QString)),
|
connect(item, SIGNAL(propertyObjectNameChanged(QString,QString)),
|
||||||
this, SLOT(slotPropertyObjectNameChanged(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);
|
m_itemsMap.insert(item,treeItem);
|
||||||
parentNode->addChild(treeItem);
|
parentNode->addChild(treeItem);
|
||||||
if (!item->childBaseItems().isEmpty())
|
if (!item->childBaseItems().isEmpty())
|
||||||
@ -278,6 +283,19 @@ void ObjectBrowser::slotActivePageUpdated(LimeReport::PageDesignIntf *)
|
|||||||
buildTree();
|
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)
|
void ObjectBrowserNode::setObject(QObject *value)
|
||||||
{
|
{
|
||||||
m_object = value;
|
m_object = value;
|
||||||
|
@ -75,6 +75,7 @@ private slots:
|
|||||||
void slotMultiItemSelected();
|
void slotMultiItemSelected();
|
||||||
void slotItemDoubleClicked(QTreeWidgetItem* item,int);
|
void slotItemDoubleClicked(QTreeWidgetItem* item,int);
|
||||||
void slotActivePageUpdated(LimeReport::PageDesignIntf*);
|
void slotActivePageUpdated(LimeReport::PageDesignIntf*);
|
||||||
|
void slotItemParentChanged(BaseDesignIntf* item, BaseDesignIntf* parent);
|
||||||
private:
|
private:
|
||||||
ReportDesignWidget* m_report;
|
ReportDesignWidget* m_report;
|
||||||
QMainWindow* m_mainWindow;
|
QMainWindow* m_mainWindow;
|
||||||
|
Loading…
Reference in New Issue
Block a user