You have several options. First, as a subclass of QLabel, you can handle mouse events directly in your class. Be sure to use QWidget :: setMouseTracking () to enable this. In such a scenario, you can do whatever you want, but you will have to redefine the drawing procedure so that your class can draw itself in a certain way.
Unfortunately, QLabel does not support the state of hover stylesheets, so you cannot do this easily with sheet styles. However, if you are considering a subclass from QPushButton, you can get this great feature so that with CSS you get a nice high intensity effect. For more information about QT style sheets, see here .
QPushButton , .
, , :
QPushButton:hover {
background-color: black;
}
QPushButton:hover {
background-color: white;
}
>