bool Config_WidgetAPI::toChildWidget()
{
if (myCurrentNode && hasChild(myCurrentNode)) {
- myCurrentNode = myCurrentNode->children;
- while (myCurrentNode && !isElementNode(myCurrentNode)) {
- myCurrentNode = myCurrentNode->next;
+ xmlNodePtr aChildNode = myCurrentNode->children;
+ // it is possible that among child nodes, there is no an element node, so
+ // we should not change the current node until not-zero node is found
+ // otherwise, it may happens that the current node is null and the node tree information
+ // is lost
+ while (aChildNode && !isElementNode(aChildNode)) {
+ aChildNode = aChildNode->next;
+ }
+ if (aChildNode != NULL) {
+ myCurrentNode = aChildNode;
+ return true;
}
- return myCurrentNode != NULL;
}
return false;
}
if (myWidgetApi->isPagedWidget()) {
//If current widget is toolbox or switch-casebox then fetch all
//it's pages recursively and setup into the widget.
- myWidgetApi->toChildWidget();
- do {
- QString aPageName = qs(myWidgetApi->getProperty(CONTAINER_PAGE_NAME));
- QString aCaseId = qs(myWidgetApi->getProperty(_ID));
- ModuleBase_PageBase* aPage = new ModuleBase_PageWidget(aWidget);
- createWidget(aPage);
- if (aWdgType == WDG_SWITCH || aWdgType == WDG_TOOLBOX) {
- ModuleBase_PagedContainer* aContainer = qobject_cast<ModuleBase_PagedContainer*>(aWidget);
-
- QString anIconPath = qs( myWidgetApi->getProperty( CONTAINER_PAGE_ICON ) );
- QPixmap anIcon( anIconPath );
- aContainer->addPage( aPage, aPageName, aCaseId, anIcon );
- }
- } while (myWidgetApi->toNextWidget());
+ if (myWidgetApi->toChildWidget()) {
+ do {
+ QString aPageName = qs(myWidgetApi->getProperty(CONTAINER_PAGE_NAME));
+ QString aCaseId = qs(myWidgetApi->getProperty(_ID));
+ ModuleBase_PageBase* aPage = new ModuleBase_PageWidget(aWidget);
+ createWidget(aPage);
+ if (aWdgType == WDG_SWITCH || aWdgType == WDG_TOOLBOX) {
+ ModuleBase_PagedContainer* aContainer = qobject_cast<ModuleBase_PagedContainer*>(aWidget);
+
+ QString anIconPath = qs( myWidgetApi->getProperty( CONTAINER_PAGE_ICON ) );
+ QPixmap anIcon( anIconPath );
+ aContainer->addPage( aPage, aPageName, aCaseId, anIcon );
+ }
+ } while (myWidgetApi->toNextWidget());
+ }
}
}
} while (myWidgetApi->toNextWidget());
if (theAttributeId.empty() && myWidgetApi->isPagedWidget()) {
//If current widget is toolbox or switch-casebox then fetch all
//it's pages recursively and setup into the widget.
- myWidgetApi->toChildWidget();
- do {
- getGreedAttribute(theAttributeId);
- } while (theAttributeId.empty() && myWidgetApi->toNextWidget());
+ if (myWidgetApi->toChildWidget()) {
+ do {
+ getGreedAttribute(theAttributeId);
+ } while (theAttributeId.empty() && myWidgetApi->toNextWidget());
+ }
}
}
} while (theAttributeId.empty() && myWidgetApi->toNextWidget());
if (!theFound && myWidgetApi->isPagedWidget()) {
//If current widget is toolbox or switch-casebox then fetch all
//it's pages recursively and setup into the widget.
- myWidgetApi->toChildWidget();
- do {
- moveToWidgetId(theWidgetId, theFound);
- } while (!theFound && myWidgetApi->toNextWidget());
+ if (myWidgetApi->toChildWidget()) {
+ do {
+ moveToWidgetId(theWidgetId, theFound);
+ } while (!theFound && myWidgetApi->toNextWidget());
+ }
}
}
} while (!theFound && myWidgetApi->toNextWidget());