Qt-interest Archive, July 2007
QGraphicsItemGroup problem
Message 1 in thread
Hi All,
I am trying to create an item group in the QGraphicsView.
Unlike the default behaviour, I would like to show individual items to
be also shown as selected
when the group is selected. OR once group is selected, each individual
items also can be selected.
I have tried:-
1. setHandlesChildEvents(false);
2. I have tried doing :-
QVariant ItemGroup::itemChange ( GraphicsItemChange change, const
QVariant & value )
{
QVariant ret = QGraphicsItemGroup::itemChange(change, value);
if (change == ItemSelectedChange && scene())
{
bool isSelected = value.toBool();
if(isSelected == true)
{
QPainterPath path = shape(); // Line A
QGraphicsScene * s = scene(); // Line B
s->setSelectionArea(path); // Line C
}
else
{
}
}
return ret;
}
This gives wierd results with line A, B and C beign executed infinite
times, I dont know why, maybe its a bug ?
Can anyone suggest, how to do this ?
Regards
Prateek