The code below creates a single widget with three labels in one line. I would like the mouse cursor to change from a default "arrow" to a "hand" icon every time the mouse is positioned over one of the labels. How to achieve it?
class SquareLabel(QLabel): def __init__(self, parent=None): super(SquareLabel, self).__init__(parent) self.setAutoFillBackground(True) p = self.palette() p.setColor(self.backgroundRole(), QColor(223, 230, 248)) self.setPalette(p) def mousePressEvent(self, event): print event class SuperEdit(QWidget): def __init__(self, data, parent=None): super(SuperEdit, self).__init__(parent) layout = QHBoxLayout() layout.setContentsMargins(2, 2, 2, 2) self.setLayout(layout) for name in data: label = SquareLabel(self) label.setText(name) layout.addWidget(label) if __name__ == '__main__': names = ['Name 1', 'Name 2', 'Name 3'] app = QApplication([]) editor = SuperEdit(names) editor.show() app.exec_() 
