PDA

View Full Version : how to you send signals to a graphics item?



technoViking
6th November 2009, 01:13
Hi so what I'm trying to do is when I click a button I want a graphics item to transition in from the side.

How can I send a signal to the graphics item to come in when I click this button?

aamer4yu
6th November 2009, 04:54
You dont need to send signal to the graphics item in this case.
Just on button click, start changing the geometry of the item from some controller class. In the item you will need to provide functions for changing geometry/shape etc.

Lykurg
6th November 2009, 15:08
just make QObject a parent of your item and then you can use it like any other widget in the connect method.

technoViking
6th November 2009, 18:09
oh wow I didn't think that was possible, I just took a 6 day training course and the instructor told us if you use graphic items you can't ever use signals/slots on them, you have to use events.

Can you give a short code snippet on how you would force the parent to be QObject?

Thanks!

Lykurg
6th November 2009, 19:40
...what I meant was, the you item has to inherit from QObject:

class MyItem : public QGraphicsItem, public QObject
{
Q_OBJECT
//...
}