[PyKDE] rubberbanding a QCanvas (demo code)

Andrew Dalke adalke at mindspring.com
Fri May 17 00:49:01 BST 2002


Boudewijn Rempt:
> I might not be how real GUI programmers do that -- I wouldn't
> know either -- but it looks pretty smooth and easy to
> comprehend.

Thanks.  I suspect though that mixins isn't the right approach.
I'm going to rewrite it as a seperate class, which takes the
QCanvasItem in the constructor.  Thankfully, Python handles
cycles now.

In other words

class MyView(QCanvasView):
  def __init__(self, *args):
    ...
    self._scroller = AutoScroller(self)
  def contentsMousePressEvent(self):
    ...
    self._scroller.startAutoScroll()


> Looking at QIconView might be a good idea, or the code of 
> Killustrator^WKontour. Especially the file SelectTool.cc.

My version of Kontour doesn't support autoscrolling.  Though
this is version 1.1.1 and it may be in a newer one.  I also don't
see lassoing, and the 1.1.1 source doesn't contain the word "lasso".

QIconView's code is much simpler than mine for autoscrolling
since all it does is say that the spot under where the mouse
would be (if the window is big enough) needs to be visible.

                    Andrew





More information about the PyQt mailing list