PDA

View Full Version : connection Problem



maverick_pol
2nd August 2007, 17:50
Hi guys,

I have 2 classes: graph and gscene(which inherits QGraphicsScene). THe graph class includes a gscene object. I would like to connect the gscene signal to the parent graph class, but after connecting the slot is not invoked.

Here's the code: (signal in the gscene)

signals:
void vSignalZoomRectangle(QRectF _rectangle);

and here is the connection in the gscene constructor:

connect(this,SIGNAL(vSignalZoomRectangle(QRectF)), this>parent(),SLOT(vZoomSceneRectangle(QRectF)));


the code compiles, but does not work.

Any idea?
THank you beforehand.

Maverick

marcel
2nd August 2007, 17:54
You will have to do an explicit cast to ggraph(if I understand correctly ).

So you have ggraph which contains a scene.
What is the base class for ggraph and what parent do you pass when you create it?

If in your code parent() means QObject::parent(), then a cast is needed.

Check the debug output. A warning message should be there: connect: no such slot....

Regards

maverick_pol
2nd August 2007, 17:59
Thank you, you're right.
Unfortunately, my problem was so 'novice'. I've declared the slot as a simple method not as a slot. No comment needed.

Thank you for your reply.

Maverick