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. Having a QGraphicsItem always at the center of QGraphicsScene?

Having a QGraphicsItem always at the center of QGraphicsScene?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.3k 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.
  • Q Offline
    Q Offline
    qwhos
    wrote on last edited by
    #1

    So basically, I have a bunch of QGraphicsItem objects in one scene. I can actually move just one item and I want to have that item to always be centralized to the scene. The scene is much larger than the view itself, so I want to have the camera to follow one item/object. How should I go about doing this?

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qwhos
      wrote on last edited by
      #2

      So any help?

      Q 1 Reply Last reply
      0
      • Q qwhos

        So any help?

        Q Offline
        Q Offline
        qtgamer
        wrote on last edited by
        #3

        @qwhos did you find out how to do it?

        JonBJ 1 Reply Last reply
        0
        • Q qtgamer

          @qwhos did you find out how to do it?

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @qtgamer
          I don't think the OP really meant "I want to have that item to always be centralized to the scene". I suspect he/you meant "centralized to the view", right?

          In which case, move/resize the QGraphicsView as necessary when the target item changes position/size, e.g. maybe void QGraphicsView::centerOn(const QGraphicsItem *item).

          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