示例#1
0
 def mouseMoveEvent(self, ev):
     idx = self.indexAt(ev.pos())
     if idx.isValid():
         ci = self.currentIndex()
         if idx.row() != ci.row():
             self.setCurrentIndex(idx)
     return QListView.mouseMoveEvent(self, ev)
示例#2
0
 def mouseMoveEvent(self, ev):
     index = self.indexAt(ev.pos())
     if index.isValid():
         row = index.row()
         if row != self.last_mouse_idx:
             self.last_mouse_idx = row
             try:
                 char_code = int(self.model().data(index, Qt.ItemDataRole.UserRole))
             except (TypeError, ValueError):
                 pass
             else:
                 self.show_name.emit(char_code)
         self.setCursor(Qt.CursorShape.PointingHandCursor)
     else:
         self.setCursor(Qt.CursorShape.ArrowCursor)
         self.show_name.emit(-1)
         self.last_mouse_idx = -1
     return QListView.mouseMoveEvent(self, ev)