예제 #1
0
 def mousePressEvent(self, event):
     """called when you click a result"""
     QTreeView.mousePressEvent(self, event)
     if event.button() == Qt.LeftButton:
         self.on_left_mouse_button()
     elif event.button() == Qt.RightButton:
         self.on_right_mouse_button()
예제 #2
0
    def mousePressEvent(self, position):
        QTreeView.mousePressEvent(self, position)
        indexes = self.selectedIndexes()

        # trace the tree to find the selected item
        rows = []
        for index in indexes:
            row = index.row()
            rows.append(row)
            level = 0
            while index.parent().isValid():
                index = index.parent()
                row = index.row()
                rows.append(row)
                level += 1
        rows.reverse()

        # TODO: what is this for???
        if rows != self.old_rows:
            self.old_rows = rows
        valid, keys = self.get_row()
        if not valid:
            print('invalid=%s keys=%s' % (valid, keys))
        else:
            print('valid=%s keys=%s' % (valid, keys))
예제 #3
0
파일: editor.py 프로젝트: slaclab/nalms
 def mousePressEvent(self, event):
     self.clearSelection()
     self.selectionModel().reset()
     QTreeView.mousePressEvent(self, event)