Results 1 to 6 of 6

Thread: QGraphicsScene qt_metacall problem

  1. #1
    Join Date
    Mar 2012
    Location
    India
    Posts
    22
    Thanks
    3
    Qt products
    Qt4

    Default QGraphicsScene qt_metacall problem

    Hi,
    I am facing an issue when, in QGraphicsScene using BSPItemIndex method, I try and delete a QGraphicsItem at some specific positions only.
    The application simply crashes and when tried debugging goes to QGraphicsScene::qt_metacall(..).

    If I change the ItemIndexMethod to NoIndex the application works correctly.

    The application requires a large dynamic scene, hence using NoIndex makes the application considerably slow.
    Is changing the ItemIndexMethod run-time advisable ?
    Please provide some pointers to the issue.

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QGraphicsScene qt_metacall problem

    Try removing the item from the scene first before deleting it.

    Turning indexing off and then back on is fairly expensive so I would avoid that for large scenes.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QGraphicsScene qt_metacall problem

    Don't delete items as a response to signals or events that carry that item as a parameter. Hide the item and schedule a deletion at a later point in time.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Mar 2012
    Location
    India
    Posts
    22
    Thanks
    3
    Qt products
    Qt4

    Default Re: QGraphicsScene qt_metacall problem

    I have already delete the item from the scene before deleting. Also there is no event or signal which is accepting item as parameter where i am deleting the item.

    The application has a graph like structure, so deleting a node also results in deletion of an edge. so removing both the items from the scene I instantiate its deletion.
    Also the problem is not reproducible every time. Only for a specific node, at a specific position and graph layout this problem occurs.
    To give you an idea deleting a node result in following process:
    1. Find the boundingRect() of the node and check the intersecting items for the bounding rect of type edge.
    2. Check if the egde is really connected to the node.
    3. If yes, remove the edge from the scene and instantiate deletion of the edge and the node from the graph.

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QGraphicsScene qt_metacall problem

    Seems an odd design. Why not have the modes keep a list of the edges they are connected to, and the edges the end nodes they connect to? Like the Diagram Scene Example.

  6. #6
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QGraphicsScene qt_metacall problem

    I think that wihout showing us the offending code we can't help you much.

    Or you could create minimal compilable example of the issue.

Similar Threads

  1. Replies: 10
    Last Post: 19th September 2012, 15:13
  2. QGraphicsScene problem/bug
    By rubenvb in forum Qt Programming
    Replies: 2
    Last Post: 27th September 2009, 23:34
  3. QGraphicsScene Position Problem
    By addu in forum Qt Programming
    Replies: 14
    Last Post: 22nd July 2009, 14:38
  4. Replies: 10
    Last Post: 29th May 2009, 09:06
  5. Componentes::qt_metacall(QMetaObject::Call, int, void**)':
    By Majestade in forum Qt Programming
    Replies: 8
    Last Post: 1st April 2007, 21:50

Tags for this Thread

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.