mario
mario

Reputation: 131

How to hover event on label

I need a hover event on label when I move mouse over label to change a mouse pointer.
I tried something like this:

void MainWindow::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
if(event->GraphicsSceneHoverEnter){
    QCursor car;
    car.setShape(Qt::PointingHandCursor);
    ui->label_no->setCursor(car);
}

}

Upvotes: 0

Views: 354

Answers (1)

Jablonski
Jablonski

Reputation: 18504

You need only this code in MainWindow constructor.

QCursor crs(Qt::PointingHandCursor);
ui->label_no->setCursor(crs);

Upvotes: 2

Related Questions