- if (tabIdParent[i] != -1) {
- if (tabIdParent[i] >= nbCategories) return false;
- tabCategories[i]->setParent(tabCategories[tabIdParent[i]]);
- tabCategories[tabIdParent[i]]->addChild(tabCategories[i]);
+ if (tabIdParent[i] >= 0) {
+ ok = false;
+ foreach (BlockCategory* cat, tabCategories) {
+ if (cat->getId() == tabIdParent[i]) {
+ tabCategories[i]->setParent(cat);
+ cat->addChild(tabCategories[i]);
+ ok = true;
+ break;
+ }
+ }
+ if (!ok) return false;