On Mon, Oct 11, 2010 at 5:18 AM, TP <wing...@gmail.com> wrote:
> I am trying to implement an image processing application that will
> have multiple image viewers created with a subclass of QGraphicsView.
> I need to be able to optionally keep all the image viewers in sync
> with respect to zoom and position as the user clicks on the
> scrollbars, uses the scroll wheel to zoom, uses menus to fit the view
> to the window, etc.
>
> Looking at C:\Qt\4.6.1\src\gui\graphicsview\qgraphicsview.cpp it seems
> like I should be able to do the following:
>
>  class ImageViewerView(QtGui.QGraphicsView):
>      def __init__(self, scene=None, parent=None):
>          if scene:
>              super(ImageViewerView, self).__init__(scene, parent)
>          else:
>              super(ImageViewerView, self).__init__(parent)
>
>      def setTransform(self, QTransform, combine=False):
>          super(ImageViewerView, self).setTransform(QTransform, combine)
>          print("transform = %s, %s" % (QTransform, combine))
>
> to keep track of view changes since things like fitInView() calls
> scale() which in turns calls setTransform().
>
> However, when I run my test application I never seem to see any calls
> to setTransform()?
>
> So... how does one determine when a QGraphicsView's transform has been
> changed? I didn't see any applicable built-in signals, so I figured
> I'd just emit my own, but now I can't quite see where to do that.
>
> Or maybe there's an entirely different way to track changes to a 
> QGraphicsView?
>

I just figured out why my setTransform() method is never called. It's
because the underlying C++ method isn't declared as virtual (you can
only tell this by looking at the Qt docs rather than the PyQt docs).

I'd still like to know how to tell when a QGraphicsView's view changes?
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to