Results 1 to 4 of 4

Thread: How do I get the scaling factor by QGraphicsViews?

  1. #1
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How do I get the scaling factor by QGraphicsViews?

    From within QGraphicsItem's paint method, I need to get the scaling factor (m11 and m22) done by its viewer.

    I need to undo the scaling effect done by the zoom.

    I am doing cross plotting with different markers. When user zooms the plot, the markers are scaled too (just as font was scaled, undesirable features). It doesn't increase the data resolution by this, whatever was covered by other markers are still covered by those markers... that is why I need to get view's scaling factor and apply inverse scaling before redrawing...

    Thanks

  2. #2
    Join Date
    Jan 2006
    Posts
    132
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How do I get the scaling factor by QGraphicsViews?

    QPainter::transform() should hold that information

  3. #3
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How do I get the scaling factor by QGraphicsViews?

    Quote Originally Posted by seneca View Post
    QPainter::transform() should hold that information
    But QPainter also holds the item's own scaling. I need the scaling purely from the viewer...

    paint(...) has a widget id, and its parent seems to be the viewer's id which I can cast to QGraphicsView, but I wonder how reliable this is...

  4. #4
    Join Date
    Jan 2006
    Posts
    132
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How do I get the scaling factor by QGraphicsViews?

    From docs:

    The widget argument is optional. If provided, it points to the widget that is being painted on; otherwise, it is 0. For cached painting, widget is always 0.
    Does not sound as if it is very reliable.

    Why not divide the overall scaling in the painter by the item scaling?

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.