How to access the 3rd element (ComponentWidth) in QList (solved)
-
How to access the 3rd element (ComponentWidth) in QList
QList<CComponent>* ComponentList = new QList<CComponent>(); CComponent ComponentTemplate; while (xmlGet.findNextAndDescend("Component")) { QString ComponentID = xmlGet.getAttributeString("ID","unknown"); QString ComponentType = xmlGet.getAttributeString("Type","unknown"); int ComponentX = xmlGet.getAttributeInt("X"); int ComponentY = xmlGet.getAttributeInt("Y"); int ComponentWidth = xmlGet.getAttributeInt("Width"); int ComponentHeight = xmlGet.getAttributeInt("Height"); int ComponentZOrder = xmlGet.getAttributeInt("ZOrder"); int ComponentAspectRatio = xmlGet.getAttributeInt("AspectRatio"); ComponentTemplate.SetComponentID(ComponentID); ComponentTemplate.SetComponentType(ComponentType); ComponentTemplate.SetComponentX(ComponentX); ComponentTemplate.SetComponentY(ComponentY); ComponentTemplate.SetComponentWidth(ComponentWidth); ComponentTemplate.SetComponentHeight(ComponentHeight); ComponentTemplate.SetComponentZOrder(ComponentZOrder); ComponentTemplate.SetComponentAspectRatio(ComponentAspectRatio); if (xmlGet.findNext("Background")) { int Transparent = xmlGet.getAttributeInt("Transparent"); int Red = xmlGet.getAttributeInt("Red"); int Green = xmlGet.getAttributeInt("Green"); int Blue = xmlGet.getAttributeInt("Blue"); ComponentTemplate.SetComponentBackgroundTransparent(Transparent); ComponentTemplate.SetComponentBackgroundRed(Red); ComponentTemplate.SetComponentBackgroundGreen(Green); ComponentTemplate.SetComponentBackgroundBlue(Blue); } xmlGet.rise(); ComponentList->push_back(ComponentTemplate); //how access 3rd element }