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. QGraphicsScene, Fixed sceneRect, Prevent resizing

QGraphicsScene, Fixed sceneRect, Prevent resizing

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.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.
  • A Offline
    A Offline
    alizadeh91
    wrote on last edited by
    #1

    In the QGraphicsScene, is it possible to fix the sceneRect to prevent growing it when an item is added.
    For example suppose I have a view with size of 300*120px. I want the scene to be exactly fit in the view with no scroll.
    How can i do that?

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

      Just "setSceneRect":http://qt-project.org/doc/qt-5/qgraphicsscene.html#sceneRect-prop .

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alizadeh91
        wrote on last edited by
        #3

        That's right, but when user moves items around the scene, the sceneRect changes automatically.

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          qxoz
          wrote on last edited by
          #4

          Not happened for me. What OS and Qt version do you use?
          Mine are
          Qt 5.3
          mingw
          Windows 7

          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