2016-03-19 12 views

答えて

1

自分自身に答える:

class MainWindow(QMainWindow): 
    def __init__(self): 
     super(MainWindow, self).__init__() 

     self.view = QWebView(self) 
     self.view.installEventFilter(self) 
     # create other components here 


    def eventFilter(self, obj, event): 
     if obj == self.view: 
      if (event.type() == QEvent.MouseButtonRelease): 
       htc = self.view.page().mainFrame().hitTestContent(event.pos()) 
       e = htc.element() 
       if e: 
        #do somesing with e 
        return True 
     return QMainWindow.eventFilter(obj, event) 
関連する問題