peace_comp
23rd May 2008, 16:02
Hi..
I have a problem of how to use correcty the QGraphicsItemGroup ..
well. my application is about zooming on a map .. so depending on the zoom I should display or hide some details..
for example to put the names of cities after zooming I used:
void myview::zoomingin(){
for (int i=0;i<5;i++){
QGraphicsTextItem * txt=new QGraphicsTextItem(citiesName[i]);
txt->setPos(citiesX[i],citiesY[i]);
scene->addItem(txt);
group->addToGroup(txt);
}
graphicsView->scale(1.2,1.2);
}
>> citiesName,citiesX,citiesY are QList containin' the names and coordonates of each citie..
then I should hide them when we zoom out .. I try to used:
void myview::zoomingout(){
scene->destroyItemGroup(group);
graphicsView->scale(1/1.2,1/1.2);
}
but it doesnt work .. nd when the group became empty it stucks!!
plz if someOne have a idea !!!!!!!!!!!!!!!!!!!!!!:confused:
I have a problem of how to use correcty the QGraphicsItemGroup ..
well. my application is about zooming on a map .. so depending on the zoom I should display or hide some details..
for example to put the names of cities after zooming I used:
void myview::zoomingin(){
for (int i=0;i<5;i++){
QGraphicsTextItem * txt=new QGraphicsTextItem(citiesName[i]);
txt->setPos(citiesX[i],citiesY[i]);
scene->addItem(txt);
group->addToGroup(txt);
}
graphicsView->scale(1.2,1.2);
}
>> citiesName,citiesX,citiesY are QList containin' the names and coordonates of each citie..
then I should hide them when we zoom out .. I try to used:
void myview::zoomingout(){
scene->destroyItemGroup(group);
graphicsView->scale(1/1.2,1/1.2);
}
but it doesnt work .. nd when the group became empty it stucks!!
plz if someOne have a idea !!!!!!!!!!!!!!!!!!!!!!:confused: