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. QScrollArea with "negative" values
Forum Updated to NodeBB v4.3 + New Features

QScrollArea with "negative" values

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 255 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.
  • C Offline
    C Offline
    Cerno_b
    wrote on last edited by Cerno_b
    #1

    Hi!

    I am working with a QScrollArea that allows zooming and panning of an image.
    When I zoom out so far that the whole image is visible (no scrollbars needed), Qt will freeze the image and I cannot pan anymore.

    Is it possible to still enable panning in that situation?

    What I am looking for is a way to allow the scrollbars to work even if the whole image fits inside the QScrollArea.
    This would basically mean to allow negative values for QScrollbar.setValue(), but it seems to me like this is not possible.

    I thought about changing the image size when I get to the edge, but since I am working with coordinates within the image, it is crucial that these values do not change, e.g. when determining the position of the mouse cursor within the widget, so I'm hestiant to just make the image larger. This would also be a waste of resources.

    Gimp does something similar to what I have in mind: When the image is panned outside the viewport, the scrollbars extend as if the image was larger than it actually is. As you return to the original position, the scrollbars shrink again until they disappear when the whole image fits inside the viewport.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      It sounds that you might be implementing something that could already be available through the Graphics View Framework. You should take a look at it.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • C Offline
        C Offline
        Cerno_b
        wrote on last edited by Cerno_b
        #3

        Thank you.

        That looks very nice at first glance! I'll look into it!

        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