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. Disable QGraphicsScene autoscale
Qt 6.11 is out! See what's new in the release blog

Disable QGraphicsScene autoscale

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 4 Posters 1.6k Views 2 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.
  • P Offline
    P Offline
    PinTxO
    wrote on last edited by
    #1

    Hi guys.

    I have a scene where I paint a series of items using a drag-and-drop process. What I want to do is to place the item where I loose it, do not auto-scale it. What happens to me is that if for example, having the scene empty, I drag an item and release it very close to the right side of the scene, it puts me in the middle and that's not what I want. What I want is to put it where I let it go and if the item does not enter the horizontal axis the horizontal scroll appears so that the user can see it.

    Thank you.

    S 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      If you mean it expands when you add item, then maybe this is what you want
      https://forum.qt.io/topic/48564/force-qgraphicsview-size-to-match-qgraphicsscene-size

      1 Reply Last reply
      0
      • P PinTxO

        Hi guys.

        I have a scene where I paint a series of items using a drag-and-drop process. What I want to do is to place the item where I loose it, do not auto-scale it. What happens to me is that if for example, having the scene empty, I drag an item and release it very close to the right side of the scene, it puts me in the middle and that's not what I want. What I want is to put it where I let it go and if the item does not enter the horizontal axis the horizontal scroll appears so that the user can see it.

        Thank you.

        S Offline
        S Offline
        samdol
        wrote on last edited by
        #3

        @PinTxO

        Could you show me some of your code? You may did not set propagating mousereleaseEvent in your derived class.

        1 Reply Last reply
        1
        • A Offline
          A Offline
          Asperamanca
          wrote on last edited by
          #4

          A GraphicsScene's sceneRect will automatically grow when inserting items. I suspect that the view will the zoom into the changed sceneRect.

          To avoid this, explicitly call setSceneRect with the desired size.

          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