<div class="gmail_quote">On Fri, Oct 30, 2009 at 9:44 AM, Antonio Valentino <span dir="ltr">&lt;<a href="mailto:antonio.valentino@tiscali.it">antonio.valentino@tiscali.it</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
</div>I have the same problem. At the moment I have a solution based on<br>
event filters but I&#39;m very interested in a solution exploiting built-in<br>
features so please keep updated.<br>
</blockquote></div><br>Interesting to see that I&#39;m not alone in this :-) I tried looking into event filters, but I don&#39;t grasp how they work yet. I tried the following code to capture the selection position, but it doesn&#39;t behave like I expected, maybe you can shed some light on this?<br>
<br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">class Dialog(QWidget):<br>  def __init__(self, parent=None):<br>    QWidget.__init__(self, parent)<br>
    <a href="http://self.gs">self.gs</a> = QGraphicsScene()<br>    self.gv = QGraphicsView(<a href="http://self.gs">self.gs</a>)<br>    self.gv.installEventFilter(self)<br>    self.gv.show()<br>    <br>  def eventFilter(self, object, event):<br>
    if event.type() == QEvent.MouseButtonPress:<br>      self.p0 = self.mapFromGlobal(event.globalPos()) </blockquote><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
      return True<br>    elif event.type() == QEvent.MouseButtonRelease:<br>      self.p1 = self.mapFromGlobal(event.globalPos())<br>      return True<br>    else:<br>      return False<br></blockquote><br clear="all">So I attach the eventfilter to the QGraphicsView instance, and capture the position at the mouse button press and release. When I print p0 and p1, only p0 (the button press one) responds, the release does nothing. Any ideas why?<br>
<br>For the other readers, I&#39;m still interested in how to get to the QGraphicsView&#39;s rubberband selection data, as I think that would be the most elegant solution.<br><br>-- <br>Alex Borghgraef<br>