auto-disconnect in ~QGraphicsItem?
Hi,
I have a lot of subclassed QGraphicsItems in a scene. Each of them is connected to slot x() of a class which handles the scene and the view. So when calling scene.clear(), all items will be destroyed, but will the connections also be disconnected or must I call this manually by
Code:
for (...)
{
scene->items().at(i).disconnect();
}
A brief look at the qt source hasn't made me clever... Thanks
Lykurg
Re: auto-disconnect in ~QGraphicsItem?
QObject destructor does cleanup existing signal-slot connections. QGraphicsItem doesn't know anything about signal-slot connections. Plain QGraphicsItems cannot even have slots. You must've inherited QObject to be able to have signals and/or slots in a graphics item.
Re: auto-disconnect in ~QGraphicsItem?
Hi,
here the related stuff of my virtual base class:
Code:
{
Q_OBJECT
public:
virtual QRectF boundingRect
() const = 0;
signals:
//...
}
{
}
So even if I give QObject no parent after destroying TextItemAbstract the QObject does cleanup, or must I call ~QObject() explicit?
Thanks,
Lykurg