Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, August 2007
Re: Question about QGraphicsItem's child rotation


Message 1 in thread

On 30 Jul 2007 14:35:59 +0200, Giampaolo Bellini <iw2lsi@xxxxxxxxx> wrote:
>
> Hi
>
> I have a question for QT experts... this is my situation:
>
> A      is a QGraphicsItem
> B,C,D  are  QGraphicsItems ITEMS placed inside of A (A is given as their
> parent)



I'm not sure about why that's not working... can you write a smallish piece
of code for all of us to look at?

Also, perhaps installSceneEventFilter would be easier to use?

It would look something like this:

foreach (QGraphicsItem *child, A->children())
{
        child->installSceneEventFilter(A);
}


-and-


bool A::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
{
        if (event->type() == QEvent::QGraphicsSceneMousePress)
        {
                // ... do watcha gonna do
                // maybe store away what item was pressed?
                m_item_i_am_watching = watched;
        }
        return false; // Event is sent to the child.
}


Regards,

Chris

-- 
 [ signature omitted ]