0

I was trying to use use signals and slots in one of my class when I got this message as soon as I run the application :

QObject::connect: No such signal Scene::sceneRectChanged(QRectF) in graphicsview\qgraphicsview.cpp:1723

My class Scene derives from QGraphicsScene and QObject

Why is the control checking for such a signal in the library files ?

I have actually not used this signal in any of the connections I am making. I just have a custom SIGNAL called void sceneChanged(); in my derived class.

Amit Tomar
  • 4,800
  • 6
  • 50
  • 83

1 Answers1

2

As you said:

My class Scene derives from QGraphicsScene and QObject

It is source of problem, because QGraphicsScene is already QObject subclass, so you don't need manually inherit QObject. Just remove this unsuitable inheritance and all will be fine.

About graphicsview\qgraphicsview.cpp:1723. Currently this code you can see here.

if ((d->scene = scene)) {
      connect(d->scene, SIGNAL(sceneRectChanged(QRectF)),
              this, SLOT(updateSceneRect(QRectF)));

You don't use this signal of course, but when you set your custom scene to the view, view make all needed connection to be able to serve scene. Because of your mistake (multiple inheritance), signal (sceneRectChanged) was not created, so you got this error.

Jablonski
  • 18,083
  • 2
  • 46
  • 47