Hi @Tank2005,
AFAIK setting anchors wont work from C++ side. You have to either do it on QML side or you can calculate the x and y positions programmatically on C++ side and set them. The latter can be done following way:
child->setProperty("x",parentItem->width()/2-child->width()/2); //calculate and set
child->setProperty("y",parentItem->height()/2-child->height()/2);
Edit: Since you want to fill you can use parentItem's width and height
item->setProperty("width", parentItem.width);
item->setProperty("height", parentItem.height);