Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Is it possible to have a visible QGraphicsItem with no location?
Forum Updated to NodeBB v4.3 + New Features

Is it possible to have a visible QGraphicsItem with no location?

Scheduled Pinned Locked Moved General and Desktop
11 Posts 2 Posters 5.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? This user is from outside of this forum
    ? This user is from outside of this forum
    Guest
    wrote on last edited by
    #2

    [quote author="Bradley" date="1291827845"]Is it possible to have a visible QGraphicsItem with no location?[/quote]

    items belonging to a scene and which are visible, will have a location i.e. a geometry

    [quote author="Bradley" date="1291827845"]With QGraphicsScene, is there any way to have items in the scene which will not be returned by items(QPoint) and still visible in the scene?[/quote]

    you are interested in the items(QPoint) call, so you can probably check the different options available for Qt::ItemSelectionMode and see if something suits you
    items that are not located at this point, are of course still visible and will not be returned with items(QPoint) call ...

    1 Reply Last reply
    0
    • G Offline
      G Offline
      GordonSchumacher
      wrote on last edited by
      #3

      Why do you want to do this? Perhaps there's a different way to accomplish it.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        baysmith
        wrote on last edited by
        #4

        I have a QGraphicsView which does certain actions based the items in the scene (for example re-framing the view to center and zoom on certain items). However, the scene also contains heads-up-display (HUD) items which must be ignored. Currently I'm filtering the HUD items when re-framing. I'm wondering if there is a more creative solution.

        Nokia Certified Qt Specialist.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          baysmith
          wrote on last edited by
          #5

          [quote author="chetankjain" date="1291830853"]you are interested in the items(QPoint) call, so you can probably check the different options available for Qt::ItemSelectionMode and see if something suits you
          items that are not located at this point, are of course still visible and will not be returned with items(QPoint) call ...
          [/quote]

          I don't see an Qt::ItemSelectionMode that would apply, since I want to create an special item that would not be selected even though some other regular item at the same location would be.

          Nokia Certified Qt Specialist.

          1 Reply Last reply
          0
          • ? This user is from outside of this forum
            ? This user is from outside of this forum
            Guest
            wrote on last edited by
            #6

            [quote author="Bradley" date="1291836670"]
            I don't see an Qt::ItemSelectionMode that would apply, since I want to create an special item that would not be selected even though some other regular item at the same location would be.
            [/quote]

            ah ok, in that case I think you have to extend QGraphicsScene, reimplement items() to do what you want

            1 Reply Last reply
            0
            • G Offline
              G Offline
              GordonSchumacher
              wrote on last edited by
              #7

              Not necessarily; see also "this message":http://lists.trolltech.com/pipermail/qt-interest/2010-March/020837.html from the mailing list.

              1 Reply Last reply
              0
              • B Offline
                B Offline
                baysmith
                wrote on last edited by
                #8

                A transparent overlay widget would then mean the items are not in the scene. I guess reimplementing items() or filtering the results from items() is all I can do.

                Nokia Certified Qt Specialist.

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  GordonSchumacher
                  wrote on last edited by
                  #9

                  Hm. I think I'm missing something; why do they need to be in the same scene?

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    baysmith
                    wrote on last edited by
                    #10

                    The some interaction with other items in the scene.

                    Nokia Certified Qt Specialist.

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      GordonSchumacher
                      wrote on last edited by
                      #11

                      I suspect you're right then, and those are your best options. A fast way to do the filtering (however it's done) might be to check QGraphicsItem::type() - or better (if you can), make all the HUD objects children of a single item and set QGraphicsItem::ItemHasNoContents on that parent item. That way (I think) you'd only have one QGraphicsItem to check.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved