Results 1 to 2 of 2

Thread: Strange behaviour in QGraphicsScene

  1. #1
    Join Date
    Dec 2007
    Location
    London
    Posts
    206
    Thanks
    40
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Strange behaviour in QGraphicsScene

    Hello All,

    On a QGraphicsScene I have some items and I connect them via Arrow items(subclass of QGraphicsLineItem) like in DiagramEditor example...

    Here is the problem:

    I make my drawing. I save the items in an xml file. And then I load the xml file. Everything looks perfect till now. But After loading the items, when i try to make a new connection via arrow items, the arrows are added on the seen but they(the new ones) cannot be seen. I debug their visibility property, it is ok.. On the scene, when i move the scroll bar up and down they become visible ! Moreover I call the update function manually but paint event is not triggered..

    Question:

    What may I have done (during loading) to make arrow items behave like that? (I couldnt see anything strange)
    Why doesnt paint event get called after update() ?(Although visible property true)

    Thanks in advance..

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Strange behaviour in QGraphicsScene

    I guess you create a new QGraphicsLineItem, with scene as parent, it addition to this, make sure you add the newly created object of QGraphicsLineItem, to the scene using QGraphicsScene::addItem().

    I assume you are referring to calling update() on the view. Calling update on the view is not required, the graphics scene will internally manage updating the view.

Similar Threads

  1. Strange behaviour with QPen
    By franco.amato in forum Qt Programming
    Replies: 4
    Last Post: 19th January 2010, 05:51
  2. Strange behaviour with QPainter
    By franco.amato in forum Qt Programming
    Replies: 12
    Last Post: 14th January 2010, 05:30
  3. Strange mouseReleaseEvent behaviour.
    By ricardo in forum Newbie
    Replies: 11
    Last Post: 5th May 2009, 23:35
  4. Need help: Strange behaviour
    By navi1084 in forum Qt Programming
    Replies: 3
    Last Post: 14th November 2008, 04:03
  5. very strange behaviour
    By regix in forum Qt Programming
    Replies: 23
    Last Post: 20th July 2006, 17:38

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.