Results 1 to 2 of 2

Thread: Using QGraphicsScene::itemAt, ignoring certain types of QGraphicsItems

  1. #1
    Join Date
    Nov 2010
    Posts
    77
    Thanks
    17
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Using QGraphicsScene::itemAt, ignoring certain types of QGraphicsItems

    I have two types of QGraphicsItems in my graphics scene: GraphicNodes (with rectangle-, ellipse- and diamond-shaped implementations) and GraphicArcs (arrows that currently lack an arrow head). When I use QGraphicsScene::itemAt to get the topmost object at a certain position, I want the GraphicArcs to be ignored.

    itemat.png

    In other words, I want to use itemAt as if there were no GraphicArcs on the scene, therefore returning the topmost GraphicNode at that position (if any). Is this possible?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Using QGraphicsScene::itemAt, ignoring certain types of QGraphicsItems

    Use QGraphicsScene::items() variant that takes a QPoint and iterate over the list you get until you find an item that suits your needs.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    blooglet (16th April 2011)

Similar Threads

  1. Replies: 2
    Last Post: 8th December 2010, 10:51
  2. Replies: 1
    Last Post: 15th March 2010, 08:51
  3. Replies: 4
    Last Post: 10th December 2009, 16:37
  4. QTreeWidget itemAt
    By maartenS in forum Newbie
    Replies: 4
    Last Post: 17th September 2008, 19:19
  5. Order of elemetns with QGraphicsScene::itemAt
    By Morea in forum Qt Programming
    Replies: 2
    Last Post: 20th December 2006, 21:00

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.