Results 1 to 2 of 2

Thread: QGraphicsScene item removed signal

  1. #1
    Join Date
    Jan 2012
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QGraphicsScene item removed signal

    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


    Qt Code:
    1. mydialog = new DialogWindow;
    2. scene->addWidget(mydialog,Qt::Dialog);
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2012
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QGraphicsScene item removed signal

    when you read the documentation carefully it helps
    addWidget returns a pointer so you can use it to know when its being closed

    Qt Code:
    1. QGraphicsProxyWidget *p = new QGraphicsProxyWidget;
    2. p=scene->addWidget(mydialog,Qt::Dialog);
    3. connect(p, SIGNAL(visibleChanged()),this,SLOT(closingTable()));
    To copy to clipboard, switch view to plain text mode 

    if someone has a better solution please let me know

Similar Threads

  1. Replies: 1
    Last Post: 5th March 2012, 19:26
  2. QListWidget - signal when items are added/removed
    By Andrej08 in forum Qt Programming
    Replies: 1
    Last Post: 19th January 2011, 02:13
  3. Rotate Item qgraphicsscene
    By pispipepe in forum Qt Programming
    Replies: 5
    Last Post: 28th July 2010, 20:05
  4. Crazy over the QGraphicsScene/Item
    By Morea in forum Qt Programming
    Replies: 6
    Last Post: 20th November 2006, 09:18
  5. QWidget item in QGraphicsScene
    By IUnknown in forum Qt Programming
    Replies: 4
    Last Post: 4th November 2006, 00:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.