Results 1 to 2 of 2

Thread: QGraphicsItem, QLineF Precise Selection

  1. #1
    Join Date
    Sep 2009
    Posts
    49
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QGraphicsItem, QLineF Precise Selection

    Related to: PyQt4.6

    In a custom QGraphicsItem class, I am drawing a line using QLineF. This item is selectable. The problem is that QGraphicsItem's selection is based on bounding box and in case when line is drawn almost diagonally, Clicking even far away from line also make it selectable. Is there any way to make the line selectable when precisely clicking on it. (even margin of 1 or 2 pixel would be fine in case)
    Prashant


    qt-sdk-win-opensource-2009.03.1.exe
    Python 2.6.3
    PyQt-Py2.6-gpl-4.6-1
    Win XP, 32 Bit

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QGraphicsItem, QLineF Precise Selection

    Override QGraphicsItem::shape of your graphics item

    Also have a look at the diagram scene example in Qt Demos. (Qt Demos --> Graphics View --> Diagram Scene)

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

    prashant (30th October 2009)

Similar Threads

  1. destruction of QGraphicsItem
    By killkolor in forum Qt Programming
    Replies: 2
    Last Post: 5th December 2009, 10:31
  2. QGraphicsItem selection trouble
    By zgulser in forum Qt Programming
    Replies: 10
    Last Post: 13th August 2009, 15:33
  3. QGraphicsItem selection
    By navi1084 in forum Qt Programming
    Replies: 2
    Last Post: 27th July 2009, 14:57
  4. selection of QGraphicsItem
    By navi1084 in forum Qt Programming
    Replies: 6
    Last Post: 23rd July 2009, 06:33

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.