Results 1 to 3 of 3

Thread: QGraphicsScene with scaled item freezes application on click

  1. #1
    Join Date
    May 2010
    Posts
    16
    Qt products
    Qt4
    Platforms
    Windows

    Default QGraphicsScene with scaled item freezes application on click

    Hey Guys,
    I've got a nice little application which computes location-based scientific results and shows them, "pre-rendered" as Image-Files on a QGraphicsScene / QGraphicsView setup. Just to give you an idea: there are about 6 QGraphicPixmapItems / a few QGraphicsPolygon / QGraphicsLineItems on the screen, all static. The performance is fine so far.
    Additionally I give the user the opportunity to load own datasets into the scene (like a map or whatever, format can be bmp, png or jpeg). The size of the image doesn't matter, it is automatically being scaled to the extend of previous datasets (e.g. a digital elevation model). Before actually adding the image, all "white" parts of the image are filtered (transparent Black/White-Map) Now this works fine as well. But as soon as I click somewhere in the scene the whole application freezes for more than a minute, stuck in the static bool EqualRegion(...) loop of qregion.cpp. After it is done with that, the general performance of the Scene slows down.
    Any thoughts or tips on that?
    Thanks,
    Daniel

  2. #2
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QGraphicsScene with scaled item freezes application on click

    Hi Daniel!

    Is there maybe a problem with one of your boundingRect or shape methods? Put breakpoints in them and see if one is called repeatedly.

    HIH

    Joh

  3. #3
    Join Date
    May 2010
    Posts
    16
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QGraphicsScene with scaled item freezes application on click

    Thanks,
    first of all I realized that the bounding rect of the QGraphicsPixmapItem stays the same size, even if it has been scaled. I don't know if that's a problem as the boundingRect in that case is bigger than the Scene/View. The reason why my program is stuck is the function static bool EqualRegion(...) of qregion.cpp, but I can't really find the reason for this call, how to avoid it etc, but it seems to me that there is a strong relation between Image-Size and Scaling / Displaying-Performance if the Image is transparent, which is the case.
    Daniel

Similar Threads

  1. Send a mouse right click into QGRaphicsScene
    By jano_alex_es in forum Newbie
    Replies: 2
    Last Post: 11th March 2010, 15:47
  2. Replies: 0
    Last Post: 6th April 2009, 02:20
  3. application freezes without crashing (and closing)
    By nass in forum Qt Programming
    Replies: 15
    Last Post: 25th September 2007, 12:21
  4. QGraphicsScene Click / Double Click
    By philentropist in forum Qt Programming
    Replies: 1
    Last Post: 9th February 2007, 05:32
  5. My SDI application freezes when it is inactive ...why ?
    By yellowmat in forum Qt Programming
    Replies: 1
    Last Post: 5th September 2006, 17:37

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.