Results 1 to 5 of 5

Thread: How to keep parts of a QGraphicsScene in view at all times, when scrolling

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2007
    Posts
    17
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default Re: How to keep parts of a QGraphicsScene in view at all times, when scrolling

    Thanks Marcel, I was able to achieve what I wanted using your suggestion.

    The two widgets do scroll in one direction each, so in their paintEvents I get the GraphicsView's scrollbar positions and paint the widgets based on this position.

    It feels a bit hackish, as the widget has to selectively paint itself based on the scrollbar position; I would rather it didn't have to worry about that, i.e. it just paints itself, and some item "viewing" it decides which portions of it to show. I may try making those two widgets in the margins inherit from AbstractScrollAreas at some point, but it works fine for now
    Qpsycle -- open-source modular music studio built with Qt

  2. #2
    Join Date
    Mar 2006
    Posts
    7
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: How to keep parts of a QGraphicsScene in view at all times, when scrolling

    I believe it would be much better to buid that with a Model/View, subclassing TableModelView to make custom painting.

  3. #3
    Join Date
    Apr 2007
    Posts
    17
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default Re: How to keep parts of a QGraphicsScene in view at all times, when scrolling

    Hi mr.costa

    That occurred to me too, but two things stopped me trying it:

    a) The central area has quite a lot of paint operations and moving items, as well as area selection -- I wasn't sure if doing all that in widget paint events would be efficient (Would be a problem?)

    b) I'd already done most of the work in a QGraphicsView, so had a legacy system to contend with!

    Someday when I get time to go back to it I want to try different methods with it.
    Qpsycle -- open-source modular music studio built with Qt

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.