Page 2 of 2 FirstFirst 12
Results 21 to 26 of 26

Thread: Rubberband relative to QGraphicsScene

  1. #21
    Join Date
    Aug 2006
    Posts
    250
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    19
    Thanked 49 Times in 36 Posts

    Default Re: Rubberband relative to QGraphicsScene

    Quote Originally Posted by pherthyl View Post
    So now I just have to figure out the strange selection bug...
    Aha! Now I've isolated the problem.

    Can someone please try out the attached code and select the items as shown in the screenshot? The ellipse is correctly selected, while the rectangle is not. Not sure where this is coming from yet. Something to do with that the rect item has a default shape implementation?
    Attached Images Attached Images
    Attached Files Attached Files

  2. #22
    Join Date
    Aug 2006
    Posts
    250
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    19
    Thanked 49 Times in 36 Posts

    Default Re: Rubberband relative to QGraphicsScene

    Quote Originally Posted by pherthyl View Post
    I'll have to rethink that function.
    CacheBackground fixed this problem.

  3. #23
    Join Date
    Aug 2006
    Posts
    250
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    19
    Thanked 49 Times in 36 Posts

    Default Re: Rubberband relative to QGraphicsScene

    Well I fixed the selection bug by implementing my own version of setSelectionArea and reporting the bug to Trolltech. Now everything works.

  4. #24
    Join Date
    Aug 2006
    Location
    Bangalore,India
    Posts
    419
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    37
    Thanked 53 Times in 40 Posts

    Default Re: Rubberband relative to QGraphicsScene

    Nice, but what bug was there in qt's setSelectionArea function ?
    The biggest difference between time and space is that you can't reuse time.
    -- Merrick Furst

  5. #25
    Join Date
    Aug 2006
    Posts
    250
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    19
    Thanked 49 Times in 36 Posts

    Default Re: Rubberband relative to QGraphicsScene

    Quote Originally Posted by Gopala Krishna View Post
    Nice, but what bug was there in qt's setSelectionArea function ?
    No idea. I just gave them the compileable example and let them figure it out
    But I wrote my own that just iterates through all the items and uses either shape().intersects() (for line items) and sceneBoundingRect().intersects() for my boxes. Maybe not so great for large numbers of items (haven't checked how qt does it), but I don't anticipate having more than about 100 on the scene at once.

  6. #26
    Join Date
    Aug 2006
    Posts
    250
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    19
    Thanked 49 Times in 36 Posts

    Default Re: Rubberband relative to QGraphicsScene

    Got a response from Trolltech support:

    This does indeed look like a bug in Qt. The problem is most likely the
    same as the one reported here

    http://trolltech.com/developer/task-...ntry&id=191706

    as QGraphicsScene uses QPainterPath for calculating whether the
    rectangle intersects with the selection rectangle.

    We'll verify that fixing this also solves your problem.

    Thanks for reporting.

Similar Threads

  1. Replies: 12
    Last Post: 7th September 2011, 16:37
  2. QGraphicsView, QGraphicsItem, QGraphicsScene
    By Shuchi Agrawal in forum Newbie
    Replies: 10
    Last Post: 23rd March 2011, 20:50
  3. QPrinter on QGraphicsScene Border Problem
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 14th November 2007, 15:49
  4. QGraphicsScene and QGraphicsView
    By rossd in forum Qt Programming
    Replies: 2
    Last Post: 25th April 2007, 14:43
  5. When to use QGraphicsScene or QWidget
    By fossill in forum Qt Programming
    Replies: 2
    Last Post: 9th February 2007, 23:58

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
  •  
Qt is a trademark of The Qt Company.