PDA

View Full Version : QGraphicsScene item removed signal



bossy
31st October 2013, 00:57
Hi,

I have a scene to which i add a custom widget(mainly a dialog), in my custom widget i have reimplemented closeEvent(QCloseEvent *) to perform specific action when the custom widget is closed, however the closeEvent is not triggered when the custom widget is added to the scene, works fine otherwise, how can i work around this or use a signal when items are removed

thanks




mydialog = new DialogWindow;
scene->addWidget(mydialog,Qt::Dialog);

bossy
3rd November 2013, 19:34
when you read the documentation carefully it helps
addWidget returns a pointer so you can use it to know when its being closed



QGraphicsProxyWidget *p = new QGraphicsProxyWidget;
p=scene->addWidget(mydialog,Qt::Dialog);
connect(p, SIGNAL(visibleChanged()),this,SLOT(closingTable()) );


if someone has a better solution please let me know