def mousePressEvent(self, mouseEvent): pos = mouseEvent.pos() if self.pointInScroller(pos, QtCore.Qt.Vertical) or self.pointInScroller(pos, QtCore.Qt.Horizontal): self.clickedInScrollBar = True else: if self.ignored.count(mouseEvent): self.ignored.remove(mouseEvent) return QWebView.mousePressEvent(self, mouseEvent) if not self.pressed and not self.scrolling and mouseEvent.modifiers() == QtCore.Qt.NoModifier: if mouseEvent.buttons() == QtCore.Qt.LeftButton: self.pressed = True self.scrolling = False self.handIsClosed = False QApplication.setOverrideCursor(QtCore.Qt.OpenHandCursor) self.position = mouseEvent.pos() frame = self.page().mainFrame() xTuple = frame.evaluateJavaScript("window.scrollX").toInt() yTuple = frame.evaluateJavaScript("window.scrollY").toInt() self.offset = QPoint(xTuple[0], yTuple[0]) return return QWebView.mousePressEvent(self, mouseEvent)
def mousePressEvent(self, evt): """ Protected method called by a mouse press event. @param evt reference to the mouse event (QMouseEvent) """ if evt.button() == Qt.XButton1: self.pageAction(QWebPage.Back).trigger() elif evt.button() == Qt.XButton2: self.pageAction(QWebPage.Forward).trigger() else: QWebView.mousePressEvent(self, evt)
def mousePressEvent(self,e): ''' inner method ''' if e.button()!=QtCore.Qt.MidButton: QWebView.mousePressEvent(self,e) return link=self.anchorAt(e.pos()) self.keepnewtaburl=link if self.keepnewtaburl!=None and len(self.keepnewtaburl)!=0: if self.keepnewtaburl[0:4]=='http': self.emit(QtCore.SIGNAL('openremoteatnewtab'),self.keepnewtaburl) return self.emit(QtCore.SIGNAL('openatnewtab'),self.keepnewtaburl)
def mouseReleaseEvent(self, mouseEvent): if self.clickedInScrollBar: self.clickedInScrollBar = False else: if self.ignored.count(mouseEvent): self.ignored.remove(mouseEvent) return QWebView.mousePressEvent(self, mouseEvent) if self.scrolling: self.pressed = False self.scrolling = False self.handIsClosed = False QApplication.restoreOverrideCursor() return if self.pressed: self.pressed = False self.scrolling = False self.handIsClosed = False QApplication.restoreOverrideCursor() event1 = QMouseEvent(QEvent.MouseButtonPress, self.position, QtCore.Qt.LeftButton, QtCore.Qt.LeftButton, QtCore.Qt.NoModifier) event2 = QMouseEvent(mouseEvent) self.ignored.append(event1) self.ignored.append(event2) QApplication.postEvent(self, event1) QApplication.postEvent(self, event2) return return QWebView.mouseReleaseEvent(self, mouseEvent)
def mouse_press_event(self, event): """ Reimplementation from base class. Detects middle clicks and sets self.paste """ self.paste = (event.buttons() & Qt.MiddleButton) return QWebView.mousePressEvent(self, event)
def mousePressEvent(self, ev): QWebView.mousePressEvent(self, ev) self.checkActiveWindow()