Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Unclear sceneRect behavior when scaling QGraphicsView
Qt 6.12 LTS is out! See what's new in the release blog

Unclear sceneRect behavior when scaling QGraphicsView

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 253 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.
  • J Offline
    J Offline
    jan-tosovsky
    wrote on last edited by
    #1

    My simple image viewer consist of QGraphicsView > QGraphicsScene > QGraphicsPixmapItem. The sceneRect is 5 times larger than the image size which provides sufficient room for panning within the app window.
    However, when the image is zoomed out (actually via graphics_view.scale()), that margin is shrinked quickly with each zoom level and finally it is missing completely so panning is disabled.
    My goal is to keep that margin around the image same for all zoom levels (= 5x image size). I am thinking of updating sceneRect in scaling method (mouseWheel event), but I hope there is some fundamental issue in my code and there is more efficient way.
    My code is available here:
    https://github.com/drifted-in/jet-browser-qt-for-python/blob/main/jetbrowser.py

    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