zgulser
22nd October 2009, 09:38
Hi all,
I implemented my own rubberband to perform zooming. I'm done with all zooming stuff but selecting. I wrote the following code to do selection;
void Scene::performRubberbandSelection(QRectF* pRect)
{
QList<QGraphicsItem*> itemList = items(*pRect, Qt::IntersectsItemShape);
if(itemList.size() == 0)
return;
for( int i=0; i<itemList.size();i++)
{
if(itemList.at(i)->type() == 7)
{
continue;
}
else
cout<<itemList.at(i)<<endl;//to test
itemList.at(i)->setSelected(true);
}
}
but the problem is in items(...) method. it returns only one root item but not the others in the rubberband rectangle. What could go wrong here?
Thanks in advance
I implemented my own rubberband to perform zooming. I'm done with all zooming stuff but selecting. I wrote the following code to do selection;
void Scene::performRubberbandSelection(QRectF* pRect)
{
QList<QGraphicsItem*> itemList = items(*pRect, Qt::IntersectsItemShape);
if(itemList.size() == 0)
return;
for( int i=0; i<itemList.size();i++)
{
if(itemList.at(i)->type() == 7)
{
continue;
}
else
cout<<itemList.at(i)<<endl;//to test
itemList.at(i)->setSelected(true);
}
}
but the problem is in items(...) method. it returns only one root item but not the others in the rubberband rectangle. What could go wrong here?
Thanks in advance