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. QGraphicsView with auto-scrolling
QtWS25 Last Chance

QGraphicsView with auto-scrolling

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

    Hi all

    In my program I have an QGraphicsView (with scene), and many QGraphicsPixmap items, that are much smaller than the view. Items are movable via ItemIsMovable flag. But when a user moves item out the viewport, it doesn't scroll so the moving item remains fully visible. How do I implement this functionality? Please, include working source code. I'm using Qt 4.7.

    Thanks ahead

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Franzk
      wrote on last edited by
      #2

      Homework assignment? Forums aren't for 'helping' other people by posting the source code. Forums are for helping people by pointing them in the right direction.

      Somewhere you'll get drag events. Maybe you can mock something up with the ensureVisible() functions.

      "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • V Offline
        V Offline
        vlad2048
        wrote on last edited by
        #3

        'ensureVisisble' can't be called every time the item received mouseMove event - the program crashes (it seems to be a stack overflow exception). Actually I have tested all available functions which described in help: ensureVisible (crashes), centerOn (crashes), setSceneRect, translate (does not work because of automatic alignment, which I cannot turn off - confirmed bug), used scroll bars (same problem as translate) - none of them give desirable or at least acceptable results. I'm asking for WORKING source code because I tried to post other forums, and people suggest the functions described above. Also I hope that somebody had already solved this problem and he would share his solution which works (I suggest that auto-scrolling is very common problem).

        1 Reply Last reply
        0
        • V Offline
          V Offline
          vlad2048
          wrote on last edited by
          #4

          Also when just set an ItemIsMovable flag, and drag my item outside the viewport area, I encounter many error warnings in QtCreator saying: "QPainter.<some_qpainter_method>: painter not active, aborting>. What abous this problem?

          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