mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 08:21:07 +02:00
CComponentsForm: fix position of replaced item
If cc-item is bound on a parent form, it's not enough
to replace the item object only, also properties like
parent and index must be moved to new item to ensure that positions are calculated correctly.
But it's matter for unbound cc-items.
Origin commit data
------------------
Branch: ni/coolstream
Commit: c66c778326
Author: Thilo Graf <dbt@novatux.de>
Date: 2013-06-23 (Sun, 23 Jun 2013)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -188,9 +188,14 @@ CComponentsItem* CComponentsForm::getCCItem(const uint& cc_item_id)
|
||||
void CComponentsForm::replaceCCItem(const uint& cc_item_id, CComponentsItem* new_cc_Item)
|
||||
{
|
||||
if (!v_cc_items.empty()){
|
||||
if (v_cc_items[cc_item_id]){
|
||||
delete v_cc_items[cc_item_id];
|
||||
v_cc_items[cc_item_id] = NULL;
|
||||
CComponentsItem* old_Item = v_cc_items[cc_item_id];
|
||||
if (old_Item){
|
||||
if (old_Item->getParent()){
|
||||
new_cc_Item->setParent(old_Item);
|
||||
new_cc_Item->setIndex(old_Item->getIndex());
|
||||
}
|
||||
delete old_Item;
|
||||
old_Item = NULL;
|
||||
v_cc_items[cc_item_id] = new_cc_Item;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user