Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-75849

QGraphicsView: ScrollBarPolicy affects scale() and translate() methods

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P4: Low
    • Resolution: Unresolved
    • Affects Version/s: 5.12.3
    • Fix Version/s: None
    • Component/s: Widgets: GraphicsView
    • Labels:
      None
    • Environment:
      x64
    • Platform/s:
      Windows

      Description

      Hi,

      I'm trying to implement a QGraphicsView in which the user can move around the scene with the left mouse and zoom (in and out) with the mouse wheel. I also want the scrollbars of the QGraphicsView to be hidden.

      To do so, I set the ScrollBarPolicy of the vertical and horizontal scrollbar to ScrollBarAlwaysOff. However, it seems that doing so affects the behaviour of the scale() method: the anchor of the scale is not the center of the view (which is the behaviour I want).

      If I restore the ScrollBarPolicy of both scrollbars to the default value, the scale() method works properly, but the translate() method is no longer working and the scrollbars are visible (and would like them to be hidden).

      I have attached a Qt project with some source and header files which shows the issue.

      Is this behaviour a bug? And if not, could you provide me with a solution to resolve my issue?

       

      Thanks!

      Mathieu

       

        Attachments

        1. main.cpp
          0.4 kB
        2. sans_titre.pro
          1 kB
        3. Scene.cpp
          0.2 kB
        4. Scene.h
          0.2 kB
        5. View.cpp
          2 kB
        6. View.h
          0.7 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              qt.team.quick.subscriptions Qt Quick and Widgets Team
              Reporter:
              mathlizee Mathieu Lizée
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes