Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Disable scrolling in QGraphicsView
Qt 6.12 LTS is out! See what's new in the release blog

Disable scrolling in QGraphicsView

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 10.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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hi, I got an application where I use the mouse wheel to zoom in and out (scale) the contents of the QGraphicsView.
    But when the QGraphicsView's sceneRect is smaller than the scene, I get scrollbars, and the scene is scrolled to the edge before any QWheelEvent's are passed to my QMainWindow.

    How can i solve this?

    1 Reply Last reply
    0
    • V Offline
      V Offline
      vsorokin
      wrote on last edited by
      #2

      try add:
      @
      youGraphicsViewObject->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
      youGraphicsViewObject->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
      @

      --
      Vasiliy

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        thank you, but that only makes the scrollbars invisible, the view still scrolls.

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          just a guess: isn't it because of the overshoot (I think that is how it is called)?

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            yes, it is because of the overshoot, but I always have overshoot..

            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
            • Unsolved