Results 1 to 7 of 7

Thread: selection of QGraphicsItem

  1. #1
    Join Date
    Aug 2008
    Posts
    134
    Thanks
    10
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default selection of QGraphicsItem

    Hi All,
    I am developing some custom QGraphicsItem which are resizable. Ex: I am creating rectangle using QGraphicsRectItem and these rectangle has resizable points at the corners to resize the shape.

    My question is: wheneven i place multiple rectangle and if one rectangle intersected with another. i.e recently created item intersected partially with previous item. In this case selecting previous item, and resizing from the 'resizable points' which are intersected in recently created items is not possible. I usually change the mouse cursor when mouse hovers on handles. and this will not work on the item's 'resizable points', which is intersected by the recent item.

    how can i overcome from this problem:
    i.e even though, items are intersected by recently created items, i should able to resize previously created items.

  2. #2
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: selection of QGraphicsItem

    First of all, the issue is not clear up to the mark. What I understood is the problem of wrong bounding rect. Re-implement it yourself. And before changing size of any item, first set is selectable. Once a item gets the focus, it by-default comes top of others. So the intersections will not irritate you.

  3. The following user says thank you to yogeshgokul for this useful post:

    navi1084 (21st July 2009)

  4. #3
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: selection of QGraphicsItem

    or else try to set the z-value of the item to some higher value to the item which is selcted or focussed .. void QGraphicsItem::setZValue ( qreal z )
    "Behind every great fortune lies a crime" - Balzac

  5. The following user says thank you to wagmare for this useful post:

    navi1084 (21st July 2009)

  6. #4
    Join Date
    Aug 2008
    Posts
    134
    Thanks
    10
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: selection of QGraphicsItem

    yes SetZValue() works fine. Thank you.

  7. #5
    Join Date
    Aug 2008
    Posts
    134
    Thanks
    10
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: selection of QGraphicsItem

    In a particular case i am drawing group of items at once. This time when i select the group, all the items in the group are selected and re sizable which is correct. But the above problem still produces in the case of grouped items. I have attached a sample .bmp file of group of items. Here in QGraphicsItemGroup i am adding ellipse first and rectangle.

    Can anyone tell how can i resolve above problem in QGraphicsItemGroup.
    Attached Images Attached Images

  8. #6
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: selection of QGraphicsItem

    i think u need this one ... but not sure .
    ItemGroup->setHandlesChildEvents (false );
    "Behind every great fortune lies a crime" - Balzac

  9. #7
    Join Date
    Aug 2008
    Posts
    134
    Thanks
    10
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: selection of QGraphicsItem

    This i already used. The mentioned function() allows me resize the child item.
    But above mentioned probem will not be solved using this function.

Similar Threads

  1. [SOLVED] QTreeView drawing selection with icons
    By Timewarp in forum Qt Programming
    Replies: 7
    Last Post: 7th February 2013, 07:52
  2. destruction of QGraphicsItem
    By killkolor in forum Qt Programming
    Replies: 2
    Last Post: 5th December 2009, 10:31
  3. Replies: 1
    Last Post: 18th November 2009, 23:21
  4. Replies: 1
    Last Post: 25th February 2009, 00:34
  5. Save & Restore a selection in QTreeWidget
    By youkai in forum Qt Programming
    Replies: 1
    Last Post: 1st September 2008, 19:54

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.